From: | Andy Colson <andy(at)squeakycode(dot)net> |
---|---|
To: | Andrus Moor <kobruleht2(at)hot(dot)ee> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to generate unique invoice numbers for each day |
Date: | 2011-01-16 17:20:17 |
Message-ID: | 4D3328D1.1060109@squeakycode.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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, given a description of how hard and how messy something will be to code, I have convinced people that a simple business change and 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Colson | 2011-01-16 17:28:03 | Re: database slowdown |
Previous Message | Sefer Tov | 2011-01-16 17:14:55 | Efficient count(distinct x) query question |