From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix plan created for inherited UPDATE/DELETE with all tables exc |
Date: | 2019-02-22 17:23:47 |
Message-ID: | E1gxEY7-0002xr-BF@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Fix plan created for inherited UPDATE/DELETE with all tables excluded.
In the case where inheritance_planner() finds that every table has
been excluded by constraints, it thought it could get away with
making a plan consisting of just a dummy Result node. While certainly
there's no updating or deleting to be done, this had two user-visible
problems: the plan did not report the correct set of output columns
when a RETURNING clause was present, and if there were any
statement-level triggers that should be fired, it didn't fire them.
Hence, rather than only generating the dummy Result, we need to
stick a valid ModifyTable node on top, which requires a tad more
effort here.
It's been broken this way for as long as inheritance_planner() has
known about deleting excluded subplans at all (cf commit 635d42e9c),
so back-patch to all supported branches.
Amit Langote and Tom Lane, per a report from Petr Fedorov.
Discussion: https://postgr.es/m/5da6f0f0-1364-1876-6978-907678f89a3e@phystech.edu
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/ab5fcf2b04f9cc4ecccb1832faabadb047087d23
Modified Files
--------------
src/backend/optimizer/plan/planner.c | 68 +++++++++++++++++++++++-----------
src/test/regress/expected/inherit.out | 41 ++++++++++++++++++++
src/test/regress/expected/triggers.out | 34 +++++++++++++++++
src/test/regress/sql/inherit.sql | 15 ++++++++
src/test/regress/sql/triggers.sql | 27 ++++++++++++++
5 files changed, 163 insertions(+), 22 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2019-02-22 23:18:51 | Re: pgsql: pg_regress: Don't use absolute paths for the diff |
Previous Message | Alvaro Herrera | 2019-02-22 16:01:10 | pgsql: Report correct name in autovacuum "work items" activity |
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2019-02-22 17:35:20 | Re: Remove Deprecated Exclusive Backup Mode |
Previous Message | Corey Huinker | 2019-02-22 17:22:06 | Re: Referential Integrity Checks with Statement-level Triggers |