]> granicus.if.org Git - postgresql/commit
Fix ALTER TABLE ONLY .. DROP CONSTRAINT.
authorRobert Haas <rhaas@postgresql.org>
Mon, 10 Oct 2011 03:39:52 +0000 (23:39 -0400)
committerRobert Haas <rhaas@postgresql.org>
Mon, 10 Oct 2011 03:39:52 +0000 (23:39 -0400)
commitc0f03aae0469e758964faac0fb741685170c39a5
treed16e8329ed2adc76c5693440a638edd9280188fa
parentc980426c69ae76b04aa9de010027438457aeaa7f
Fix ALTER TABLE ONLY .. DROP CONSTRAINT.

When I consolidated two copies of the HOT-chain search logic in commit
4da99ea4231e3d8bbf28b666748c1028e7b7d665, I introduced a behavior
change: the old code wouldn't necessarily traverse the entire chain,
if the most recently returned tuple were updated while the HOT chain
traversal is in progress.  The new behavior seems more correct, but
unfortunately, the code here relies on a scan with SnapshotNow failing
to see its own updates.  That seems pretty shaky even with the old HOT
chain traversal behavior, since there's no guarantee that these
updates will always be HOT, but it's trivial to broke a failure with
the new HOT search logic.  Fix by updating just the first matching
pg_constraint tuple, rather than all of them, since there should be
only one anyway.  But since nobody has reproduced this failure on older
versions, no back-patch for now.

Report and test case by Alex Hunsaker; tablecmds.c changes by me.
src/backend/commands/tablecmds.c
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql