Search Postgresql Archives

Re: How to generate unique invoice numbers for each day

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux