pgsql: Forbid ALTER TABLE and CLUSTER when there are pending

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Forbid ALTER TABLE and CLUSTER when there are pending
Date: 2008-01-02 23:34:42
Message-ID: 20080102233442.8F9DA7540F0@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Forbid ALTER TABLE and CLUSTER when there are pending AFTER-trigger events
in the current backend for the target table. These operations move tuples
around and would thus invalidate the TIDs stored in the trigger event records.
(We need not worry about events in other backends, since acquiring exclusive
lock should be enough to ensure there aren't any.) It might be sufficient
to forbid only the table-rewriting variants of ALTER TABLE, but in the absence
of any compelling use-case, let's just be safe and simple. Per follow-on
investigation of bug #3847, though this is not actually the same problem
reported therein.

Possibly this should be back-patched, but since the case has never been
reported from the field, I didn't bother.

Modified Files:
--------------
pgsql/src/backend/commands:
cluster.c (r1.166 -> r1.167)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/cluster.c?r1=1.166&r2=1.167)
tablecmds.c (r1.238 -> r1.239)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?r1=1.238&r2=1.239)
trigger.c (r1.226 -> r1.227)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/trigger.c?r1=1.226&r2=1.227)
pgsql/src/include/commands:
trigger.h (r1.65 -> r1.66)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/commands/trigger.h?r1=1.65&r2=1.66)

Browse pgsql-committers by date

  From Date Subject
Next Message User Mkz 2008-01-03 09:05:11 pgbouncer - pgbouncer: allow autoconf 2.59
Previous Message User Rlucas 2008-01-02 23:28:17 aupg - aupg_src: Modified the aupgschema.rowid() types to use SQL