postgresql/src/backend
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
..
access Fix comment in heapam.c 2020-01-13 17:57:38 +09:00
bootstrap Update copyrights for 2020 2020-01-01 12:21:45 -05:00
catalog Reconsider the representation of join alias Vars. 2020-01-09 11:56:59 -05:00
commands Make lsn argument of walrcv_create_slot() optional 2020-01-11 09:07:14 +01:00
executor Make rewriter prevent auto-updates on views with conditional INSTEAD rules. 2020-01-14 09:52:21 +00:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit Update copyrights for 2020 2020-01-01 12:21:45 -05:00
lib Update copyrights for 2020 2020-01-01 12:21:45 -05:00
libpq Extensive code review for GSSAPI encryption mechanism. 2020-01-11 17:14:08 -05:00
main Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodes Reconsider the representation of join alias Vars. 2020-01-09 11:56:59 -05:00
optimizer Reconsider the representation of join alias Vars. 2020-01-09 11:56:59 -05:00
parser Reduce size of backend scanner's tables. 2020-01-13 15:04:31 -05:00
partitioning Update copyrights for 2020 2020-01-01 12:21:45 -05:00
po Translation updates 2019-06-17 15:30:20 +02:00
port Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postmaster Update copyrights for 2020 2020-01-01 12:21:45 -05:00
regex Update copyrights for 2020 2020-01-01 12:21:45 -05:00
replication Fix base backup with database OIDs larger than INT32_MAX 2020-01-13 13:41:12 +01:00
rewrite Make rewriter prevent auto-updates on views with conditional INSTEAD rules. 2020-01-14 09:52:21 +00:00
snowball Update copyrights for 2020 2020-01-01 12:21:45 -05:00
statistics Apply multiple multivariate MCV lists when possible 2020-01-13 01:21:17 +01:00
storage Remove STATUS_FOUND 2020-01-11 07:48:57 +01:00
tcop Make better use of ParseState in ProcessUtility 2020-01-04 13:12:41 +01:00
tsearch Update copyrights for 2020 2020-01-01 12:21:45 -05:00
utils Fix edge-case crashes and misestimation in range containment selectivity. 2020-01-12 14:36:59 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nls.mk Translation updates 2019-05-20 16:00:53 +02:00