On Wed, Jul 15, 2015 at 12:01 AM, Yourfriend <doudou...@gmail.com> wrote: > for example, SO201507_1001, PO201503_1280, etc. > > As these IDs would be the most important attribute to the business, so, we > hope there is no gap for the IDs.
That's a requirement I've heard a number of times before. If you're relying on a sequence for this purpose, your application is already broken [1]. UPSERT need not be involved at all. [1] http://www.varlena.com/GeneralBits/130.php -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers