pgsql: Disallow SELECT FOR UPDATE/SHARE on sequences.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Disallow SELECT FOR UPDATE/SHARE on sequences.
Date: 2011-06-02 18:47:08
Message-ID: E1QSCvE-0005Xc-Kp@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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.

Branch
------
REL8_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/d369ddd9f1d5908e36616e5b9e953ecefde43be4

Modified Files
--------------
src/backend/executor/execMain.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2011-06-02 19:11:56 pgsql: Fix vim-induced typo.
Previous Message Tom Lane 2011-06-02 17:37:39 pgsql: Typo fix.

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexey Klyukin 2011-06-02 18:58:09 Estimating total amount of shared memory required by postmaster
Previous Message Christopher Browne 2011-06-02 18:46:18 Re: storing TZ along timestamps