Re: How to generate unique invoice numbers for each day
От | Andrus Moor |
---|---|
Тема | Re: How to generate unique invoice numbers for each day |
Дата | |
Msg-id | D75CBAB60C17468A9F41AECCE57EAA93@server обсуждение исходный текст |
Ответ на | Re: How to generate unique invoice numbers for each day (Andy Colson <andy@squeakycode.net>) |
Ответы |
Re: How to generate unique invoice numbers for each day
|
Список | pgsql-general |
>> 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. My Visual FoxPro application works OK in this case. I used FLOCK() to lock invoice header table (FLOCK() waits indefinitely until lock is obtained and reads fresh data from disk), used SELECT MAX( CAST( SUBSTRING(invoiceno,8) AS INT ) )+1 FROM invoices WHERE date= m.invoice_date to get next free number, inserted invoice and unlocked the table. Customer expects Postgres to be more powerful than FoxPro . He don't understand why this stops working after upgrade. Andrus.
В списке pgsql-general по дате отправления: