Re: How to generate unique invoice numbers for each day

Поиск
Список
Период
Сортировка
От Andy Colson
Тема Re: How to generate unique invoice numbers for each day
Дата
Msg-id 4D3328D1.1060109@squeakycode.net
обсуждение исходный текст
Ответ на Re: How to generate unique invoice numbers for each day  ("Andrus Moor" <kobruleht2@hot.ee>)
Ответы Re: How to generate unique invoice numbers for each day
Список pgsql-general
On 01/16/2011 11:00 AM, Andrus Moor wrote:
> Andy,
>
>>> SELECT COALESCE(MAX(nullif(substring( substring(tasudok from 7), '^[0-9]*'),'')::int),0)+1
>>> FROM invoice
>>> where date= ?invoicedate
>>>
>>> is used to get next free invoice number if new invoice is saved.
>>>
>>> If multiple invoices are saved concurrently from different processes, they will probably get same number.
>
>> I understand this is a business rule, and you cant change it.
>
> Yes. This is customer requirement and I cannot change it.
OR... can you go back to your customer and tell them they wont like this.  Really really they should let you do it
correctly. I find people dont change because they dont have to, not because there is an actual reason.  Many times,
givena description of how hard and how messy something will be to code, I have convinced people that a simple business
changeand simple code is really the best approach.  But I have hit walls.  Things I could not change, but I did try. 


> Is it reasonable/how to implement the following:

Sorry, I have no idea.

-Andy

В списке pgsql-general по дате отправления:

Предыдущее
От: "Andrus Moor"
Дата:
Сообщение: Re: How to generate unique invoice numbers for each day
Следующее
От: Andy Colson
Дата:
Сообщение: Re: database slowdown