postgresql/src
Dean Rasheed d751ba5235 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
2020-01-14 09:52:21 +00:00
..
backend Make rewriter prevent auto-updates on views with conditional INSTEAD rules. 2020-01-14 09:52:21 +00:00
bin pgbench: Make more debug messages use common logging API 2020-01-10 09:02:25 +09:00
common Add support for automatically updating Unicode derived files 2020-01-09 10:08:14 +01:00
fe_utils Reduce size of backend scanner's tables. 2020-01-13 15:04:31 -05:00
include Reduce size of backend scanner's tables. 2020-01-13 15:04:31 -05:00
interfaces Reduce size of backend scanner's tables. 2020-01-13 15:04:31 -05:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
pl Reduce size of backend scanner's tables. 2020-01-13 15:04:31 -05:00
port Update copyrights for 2020 2020-01-01 12:21:45 -05:00
template Fix compiler warning for ppoll() on Cygwin 2019-12-22 23:20:00 +01:00
test Make rewriter prevent auto-updates on views with conditional INSTEAD rules. 2020-01-14 09:52:21 +00:00
timezone Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tools Add support for automatically updating Unicode derived files 2020-01-09 10:08:14 +01:00
tutorial Update copyrights for 2020 2020-01-01 12:21:45 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Add support for automatically updating Unicode derived files 2020-01-09 10:08:14 +01:00
Makefile.shlib Clean up MinGW def file generation 2019-10-20 10:19:13 +02:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00