pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Make rewriter prevent auto-updates on views with conditional INS
7+ messages / 1 participants
[nested] [flat]

* pgsql: Make rewriter prevent auto-updates on views with conditional INS
@ 2020-01-14 09:58 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2020-01-14 09:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make rewriter prevent auto-updates on views with conditional INSTEAD rules.

A view with conditional INSTEAD rules and no unconditional INSTEAD
rules or INSTEAD OF triggers is not auto-updatable. Previously we
relied on a check in the executor to catch this, but that's
problematic since the planner may fail to properly handle such a query
and thus return a particularly unhelpful error to the user, before
reaching the executor check.

Instead, trap this in the rewriter and report the correct error there.
Doing so also allows us to include more useful error detail than the
executor check can provide. This doesn't change the existing behaviour
of updatable views; it merely ensures that useful error messages are
reported when a view isn't updatable.

Per report from Pengzhou Tang, though not adopting that suggested fix.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAG4reAQn+4xB6xHJqWdtE0ve_WqJkdyCV4P=trYr4Kn8_3_PEA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d751ba523546df2b2709c1ffd4d12d6a25e25bf6

Modified Files
--------------
src/backend/executor/execMain.c               |  8 ++--
src/backend/rewrite/rewriteHandler.c          | 60 ++++++++++++++++++++++++---
src/test/regress/expected/updatable_views.out | 21 ++++++++++
src/test/regress/sql/updatable_views.sql      | 14 +++++++
4 files changed, 94 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Make rewriter prevent auto-updates on views with conditional INS
@ 2020-01-14 09:58 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2020-01-14 09:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make rewriter prevent auto-updates on views with conditional INSTEAD rules.

A view with conditional INSTEAD rules and no unconditional INSTEAD
rules or INSTEAD OF triggers is not auto-updatable. Previously we
relied on a check in the executor to catch this, but that's
problematic since the planner may fail to properly handle such a query
and thus return a particularly unhelpful error to the user, before
reaching the executor check.

Instead, trap this in the rewriter and report the correct error there.
Doing so also allows us to include more useful error detail than the
executor check can provide. This doesn't change the existing behaviour
of updatable views; it merely ensures that useful error messages are
reported when a view isn't updatable.

Per report from Pengzhou Tang, though not adopting that suggested fix.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAG4reAQn+4xB6xHJqWdtE0ve_WqJkdyCV4P=trYr4Kn8_3_PEA@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fd5476b79c2ff63dd32e154198f8201553180e58

Modified Files
--------------
src/backend/executor/execMain.c               |  8 ++--
src/backend/rewrite/rewriteHandler.c          | 60 ++++++++++++++++++++++++---
src/test/regress/expected/updatable_views.out | 21 ++++++++++
src/test/regress/sql/updatable_views.sql      | 14 +++++++
4 files changed, 94 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Make rewriter prevent auto-updates on views with conditional INS
@ 2020-01-14 09:58 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2020-01-14 09:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make rewriter prevent auto-updates on views with conditional INSTEAD rules.

A view with conditional INSTEAD rules and no unconditional INSTEAD
rules or INSTEAD OF triggers is not auto-updatable. Previously we
relied on a check in the executor to catch this, but that's
problematic since the planner may fail to properly handle such a query
and thus return a particularly unhelpful error to the user, before
reaching the executor check.

Instead, trap this in the rewriter and report the correct error there.
Doing so also allows us to include more useful error detail than the
executor check can provide. This doesn't change the existing behaviour
of updatable views; it merely ensures that useful error messages are
reported when a view isn't updatable.

Per report from Pengzhou Tang, though not adopting that suggested fix.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAG4reAQn+4xB6xHJqWdtE0ve_WqJkdyCV4P=trYr4Kn8_3_PEA@mail.gmail.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9bdb1f0e37d4f65cdc32cec1563744dc92213d71

Modified Files
--------------
src/backend/executor/execMain.c               |  8 ++--
src/backend/rewrite/rewriteHandler.c          | 60 ++++++++++++++++++++++++---
src/test/regress/expected/updatable_views.out | 21 ++++++++++
src/test/regress/sql/updatable_views.sql      | 14 +++++++
4 files changed, 94 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Make rewriter prevent auto-updates on views with conditional INS
@ 2020-01-14 09:58 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2020-01-14 09:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make rewriter prevent auto-updates on views with conditional INSTEAD rules.

A view with conditional INSTEAD rules and no unconditional INSTEAD
rules or INSTEAD OF triggers is not auto-updatable. Previously we
relied on a check in the executor to catch this, but that's
problematic since the planner may fail to properly handle such a query
and thus return a particularly unhelpful error to the user, before
reaching the executor check.

Instead, trap this in the rewriter and report the correct error there.
Doing so also allows us to include more useful error detail than the
executor check can provide. This doesn't change the existing behaviour
of updatable views; it merely ensures that useful error messages are
reported when a view isn't updatable.

Per report from Pengzhou Tang, though not adopting that suggested fix.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAG4reAQn+4xB6xHJqWdtE0ve_WqJkdyCV4P=trYr4Kn8_3_PEA@mail.gmail.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/353cd826f44537871063c6525dc0e108c974a68c

Modified Files
--------------
src/backend/executor/execMain.c               |  8 ++--
src/backend/rewrite/rewriteHandler.c          | 60 ++++++++++++++++++++++++---
src/test/regress/expected/updatable_views.out | 21 ++++++++++
src/test/regress/sql/updatable_views.sql      | 14 +++++++
4 files changed, 94 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Make rewriter prevent auto-updates on views with conditional INS
@ 2020-01-14 09:58 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2020-01-14 09:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make rewriter prevent auto-updates on views with conditional INSTEAD rules.

A view with conditional INSTEAD rules and no unconditional INSTEAD
rules or INSTEAD OF triggers is not auto-updatable. Previously we
relied on a check in the executor to catch this, but that's
problematic since the planner may fail to properly handle such a query
and thus return a particularly unhelpful error to the user, before
reaching the executor check.

Instead, trap this in the rewriter and report the correct error there.
Doing so also allows us to include more useful error detail than the
executor check can provide. This doesn't change the existing behaviour
of updatable views; it merely ensures that useful error messages are
reported when a view isn't updatable.

Per report from Pengzhou Tang, though not adopting that suggested fix.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAG4reAQn+4xB6xHJqWdtE0ve_WqJkdyCV4P=trYr4Kn8_3_PEA@mail.gmail.com

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fd87262de55e402c72d4bdacee830838735b1f27

Modified Files
--------------
src/backend/executor/execMain.c               |  8 ++--
src/backend/rewrite/rewriteHandler.c          | 60 ++++++++++++++++++++++++---
src/test/regress/expected/updatable_views.out | 21 ++++++++++
src/test/regress/sql/updatable_views.sql      | 14 +++++++
4 files changed, 94 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Make rewriter prevent auto-updates on views with conditional INS
@ 2020-01-14 09:58 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2020-01-14 09:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make rewriter prevent auto-updates on views with conditional INSTEAD rules.

A view with conditional INSTEAD rules and no unconditional INSTEAD
rules or INSTEAD OF triggers is not auto-updatable. Previously we
relied on a check in the executor to catch this, but that's
problematic since the planner may fail to properly handle such a query
and thus return a particularly unhelpful error to the user, before
reaching the executor check.

Instead, trap this in the rewriter and report the correct error there.
Doing so also allows us to include more useful error detail than the
executor check can provide. This doesn't change the existing behaviour
of updatable views; it merely ensures that useful error messages are
reported when a view isn't updatable.

Per report from Pengzhou Tang, though not adopting that suggested fix.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAG4reAQn+4xB6xHJqWdtE0ve_WqJkdyCV4P=trYr4Kn8_3_PEA@mail.gmail.com

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bb09a9414f1e149aac6064d217b5d5cab8f13723

Modified Files
--------------
src/backend/executor/execMain.c               |  8 ++--
src/backend/rewrite/rewriteHandler.c          | 60 ++++++++++++++++++++++++---
src/test/regress/expected/updatable_views.out | 21 ++++++++++
src/test/regress/sql/updatable_views.sql      | 14 +++++++
4 files changed, 94 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Make rewriter prevent auto-updates on views with conditional INS
@ 2020-01-14 09:58 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2020-01-14 09:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make rewriter prevent auto-updates on views with conditional INSTEAD rules.

A view with conditional INSTEAD rules and no unconditional INSTEAD
rules or INSTEAD OF triggers is not auto-updatable. Previously we
relied on a check in the executor to catch this, but that's
problematic since the planner may fail to properly handle such a query
and thus return a particularly unhelpful error to the user, before
reaching the executor check.

Instead, trap this in the rewriter and report the correct error there.
Doing so also allows us to include more useful error detail than the
executor check can provide. This doesn't change the existing behaviour
of updatable views; it merely ensures that useful error messages are
reported when a view isn't updatable.

Per report from Pengzhou Tang, though not adopting that suggested fix.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAG4reAQn+4xB6xHJqWdtE0ve_WqJkdyCV4P=trYr4Kn8_3_PEA@mail.gmail.com

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9be6fcb3e4e21c5d745dba314a451dc40f6f388b

Modified Files
--------------
src/backend/executor/execMain.c               |  8 ++--
src/backend/rewrite/rewriteHandler.c          | 60 ++++++++++++++++++++++++---
src/test/regress/expected/updatable_views.out | 21 ++++++++++
src/test/regress/sql/updatable_views.sql      | 14 +++++++
4 files changed, 94 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2020-01-14 09:58 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-01-14 09:58 pgsql: Make rewriter prevent auto-updates on views with conditional INS Dean Rasheed <dean.a.rasheed@gmail.com>
2020-01-14 09:58 pgsql: Make rewriter prevent auto-updates on views with conditional INS Dean Rasheed <dean.a.rasheed@gmail.com>
2020-01-14 09:58 pgsql: Make rewriter prevent auto-updates on views with conditional INS Dean Rasheed <dean.a.rasheed@gmail.com>
2020-01-14 09:58 pgsql: Make rewriter prevent auto-updates on views with conditional INS Dean Rasheed <dean.a.rasheed@gmail.com>
2020-01-14 09:58 pgsql: Make rewriter prevent auto-updates on views with conditional INS Dean Rasheed <dean.a.rasheed@gmail.com>
2020-01-14 09:58 pgsql: Make rewriter prevent auto-updates on views with conditional INS Dean Rasheed <dean.a.rasheed@gmail.com>
2020-01-14 09:58 pgsql: Make rewriter prevent auto-updates on views with conditional INS Dean Rasheed <dean.a.rasheed@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox