Fix crash in error report of invalid tuple lock
Alvaro Herrera <alvherre@alvh.no-ip.org>
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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/plan/planner.c | modified | +2 −1 |
| src/backend/parser/analyze.c | modified | +9 −16 |
| src/include/parser/analyze.h | modified | +1 −1 |
| src/test/regress/expected/portals.out | modified | +4 −0 |
| src/test/regress/expected/union.out | modified | +2 −0 |
| src/test/regress/sql/portals.sql | modified | +3 −0 |
| src/test/regress/sql/union.sql | modified | +2 −0 |