]> granicus.if.org Git - postgresql/commit
Disallow SELECT FOR UPDATE/SHARE on sequences.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Jun 2011 18:46:27 +0000 (14:46 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Jun 2011 18:46:27 +0000 (14:46 -0400)
commit23138a5203fe14d6adf5019482f341ebfe2136ad
tree5b816f9ab56e87f9fa6ba6e3dfc31dca4159e071
parent8057b7554bde98d887f02f5c0c7aeca01c8b52c9
Disallow SELECT FOR UPDATE/SHARE on sequences.

We can't allow this because such an operation stores its transaction XID
into the sequence tuple's xmax.  Because VACUUM doesn't process sequences
(and we don't want it to start doing so), such an xmax value won't get
frozen, meaning it will eventually refer to nonexistent pg_clog storage,
and even wrap around completely.  Since the row lock is ignored by nextval
and setval, the usefulness of the operation is highly debatable anyway.
Per reports of trouble with pgpool 3.0, which had ill-advisedly started
using such commands as a form of locking.

In HEAD, also disallow SELECT FOR UPDATE/SHARE on toast tables.  Although
this does work safely given the current implementation, there seems no
good reason to allow it.  I refrained from changing that behavior in
back branches, however.
src/backend/executor/execMain.c