From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix bug around assignment expressions containing indirections. |
Date: | 2015-07-24 09:58:05 |
Message-ID: | E1ZIZjx-0005EG-1P@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix bug around assignment expressions containing indirections.
Handling of assigned-to expressions with indirection (e.g. set f1[1] =
3) was broken for ON CONFLICT DO UPDATE. The problem was that
ParseState was consulted to determine if an INSERT-appropriate or
UPDATE-appropriate behavior should be used when transforming expressions
with indirections. When the wrong path was taken the old row was
substituted with NULL, leading to wrong results..
To fix remove p_is_update and only use p_is_insert to decide how to
transform the assignment expression, and uset p_is_insert while parsing
the on conflict statement. This isn't particularly pretty, but it's not
any worse than before.
Author: Peter Geoghegan, slightly edited by me
Discussion: CAM3SWZS8RPvA=KFxADZWw3wAHnnbxMxDzkEC6fNaFc7zSm411w(at)mail(dot)gmail(dot)com
Backpatch: 9.5, where the feature was introduced
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/c1ca3a19df376bcbb6d651d15b9a4ffcaa377ff1
Modified Files
--------------
src/backend/parser/analyze.c | 8 +++++++-
src/include/parser/parse_node.h | 1 -
src/test/regress/expected/arrays.out | 21 +++++++++++++++++++++
src/test/regress/sql/arrays.sql | 13 +++++++++++++
4 files changed, 41 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2015-07-24 09:58:06 | pgsql: Fix bug around assignment expressions containing indirections. |
Previous Message | Andrew Dunstan | 2015-07-23 13:54:03 | pgsql: Redirect install output of make check into a log file |