pgsql: Fix crash in error report of invalid tuple lock

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix crash in error report of invalid tuple lock
Date: 2013-08-02 17:19:58
Message-ID: E1V5J1C-0006Rc-Uz@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix crash in error report of invalid tuple lock

My tweak of these error messages in commit c359a1b082 contained the
thinko that a query would always have rowMarks set for a query
containing a locking clause. Not so: when declaring a cursor, for
instance, rowMarks isn't set at the point we're checking, so we'd be
dereferencing a NULL pointer.

The fix is to pass the lock strength to the function raising the error,
instead of trying to reverse-engineer it. The result not only is more
robust, but it also seems cleaner overall.

Per report from Robert Haas.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/88c556680ca3faa40f7428c7705455d744a9859e

Modified Files
--------------
src/backend/optimizer/plan/planner.c | 3 ++-
src/backend/parser/analyze.c | 25 +++++++++----------------
src/include/parser/analyze.h | 2 +-
src/test/regress/expected/matview.out | 3 +++
src/test/regress/expected/portals.out | 4 ++++
src/test/regress/expected/union.out | 2 ++
src/test/regress/sql/matview.sql | 3 +++
src/test/regress/sql/portals.sql | 3 +++
src/test/regress/sql/union.sql | 2 ++
9 files changed, 29 insertions(+), 18 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2013-08-02 17:39:13 pgsql: Fix crash in error report of invalid tuple lock
Previous Message Robert Haas 2013-08-02 13:16:43 pgsql: Fix typo in comment.