Search Postgresql Archives

sequence used on null value or get the max value for a column whith concurrency

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

 



In some table, I have a bigint column which at the app level can be null. Call it "DocumentNumber", and of course is not the PK.
In most cases, the applications give some value to the column.

But sometimes, the value remains null, expecting the backend or someone assign it a unique value.

Could I use a sequence only when the field arrives to the backend as null? How? Using a triger?

Alternatively:

How could I get the max value for the column and increment it by one, but with concurrency warranty? Something as a table lock?

TIA





--
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