pgsql: Fix UPDATE/DELETE WHERE CURRENT OF to support repeated update and

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix UPDATE/DELETE WHERE CURRENT OF to support repeated update and
Date: 2007-10-24 18:37:09
Message-ID: 20071024183709.2B412754229@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Fix UPDATE/DELETE WHERE CURRENT OF to support repeated update and update-
then-delete on the current cursor row. The basic fix is that nodeTidscan.c
has to apply heap_get_latest_tid() to the current-scan-TID obtained from the
cursor query; this ensures we get the latest row version to work with.
However, since that only works if the query plan is a TID scan, we also have
to hack the planner to make sure only that type of plan will be selected.
(Formerly, the planner might decide to apply a seqscan if the table is very
small. This change is probably a Good Thing anyway, since it's hard to see
how a seqscan could really win.) That means the execQual.c code to support
CurrentOfExpr as a regular expression type is dead code, so replace it with
just an elog(). Also, add regression tests covering these cases. Note
that the added tests expose the fact that re-fetching an updated row
misbehaves if the cursor used FOR UPDATE. That's an independent bug that
should be fixed later. Per report from Dharmendra Goyal.

Modified Files:
--------------
pgsql/src/backend/executor:
execQual.c (r1.222 -> r1.223)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execQual.c?r1=1.222&r2=1.223)
nodeTidscan.c (r1.55 -> r1.56)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeTidscan.c?r1=1.55&r2=1.56)
pgsql/src/backend/optimizer/path:
costsize.c (r1.186 -> r1.187)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/costsize.c?r1=1.186&r2=1.187)
pgsql/src/include/nodes:
execnodes.h (r1.178 -> r1.179)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/execnodes.h?r1=1.178&r2=1.179)
pgsql/src/test/regress/expected:
portals.out (r1.14 -> r1.15)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/portals.out?r1=1.14&r2=1.15)
pgsql/src/test/regress/sql:
portals.sql (r1.11 -> r1.12)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/portals.sql?r1=1.11&r2=1.12)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2007-10-24 19:08:26 pgsql: Minor changes to autovacuum worker: change error handling so that
Previous Message Tom Lane 2007-10-24 13:05:57 pgsql: Keep heap_page_prune from marking the buffer dirty when it didn't