Re: Enforcing serial uniqueness? - Mailing list pgsql-general

From Steven Brown
Subject Re: Enforcing serial uniqueness?
Date
Msg-id 44215B91.4080405@ucsd.edu
Whole thread Raw
In response to Re: Enforcing serial uniqueness?  (Tino Wildenhain <tino@wildenhain.de>)
List pgsql-general
Tino Wildenhain wrote:

> since your insert above would call nextval() per default,
> its save to use currval() in the same transaction.

Ah, I didn't realize currval() was handled session-local - that removes
my need to support any non-default value to my serial column.  So, if I
can identify use of a non-default value via a trigger, that solves my
first problem.  I'll try writing such a trigger tomorrow.

That leaves only preventing use of setval() as a problem.  If I revoke
UPDATE, it also blocks the use of nextval() by the default value for the
serial column on INSERT.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: invalid page header
Next
From: Tom Lane
Date:
Subject: Re: Enforcing serial uniqueness?