postgresql/src/test/regress/expected
Dean Rasheed 75c737636b Fix multi-row DEFAULT handling for INSERT ... SELECT rules.
Given an updatable view with a DO ALSO INSERT ... SELECT rule, a
multi-row INSERT ... VALUES query on the view fails if the VALUES list
contains any DEFAULTs that are not replaced by view defaults. This
manifests as an "unrecognized node type" error, or an Assert failure,
in an assert-enabled build.

The reason is that when RewriteQuery() attempts to replace the
remaining DEFAULT items with NULLs in any product queries, using
rewriteValuesRTEToNulls(), it assumes that the VALUES RTE is located
at the same rangetable index in each product query. However, if the
product query is an INSERT ... SELECT, then the VALUES RTE is actually
in the SELECT part of that query (at the same index), rather than the
top-level product query itself.

Fix, by descending to the SELECT in such cases. Note that we can't
simply use getInsertSelectQuery() for this, since that expects to be
given a raw rule action with OLD and NEW placeholder entries, so we
duplicate its logic instead.

While at it, beef up the checks in getInsertSelectQuery() by checking
that the jointree->fromlist node is indeed a RangeTblRef, and that the
RTE it points to has rtekind == RTE_SUBQUERY.

Per bug #17803, from Alexander Lakhin. Back-patch to all supported
branches.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/17803-53c63ed4ecb4eac6%40postgresql.org
2023-02-23 10:53:01 +00:00
..
advisory_lock.out tests: Restrict pg_locks queries in advisory_locks.sql to current database 2022-10-05 10:44:38 -07:00
aggregates.out Implement ANY_VALUE aggregate 2023-02-22 09:33:07 +01:00
alter_generic.out Add a SET option to the GRANT command. 2022-11-18 12:32:56 -05:00
alter_operator.out
alter_table.out Fix various typos in code and tests 2023-02-09 14:43:53 +09:00
amutils.out Support INCLUDE'd columns in SP-GiST. 2021-04-05 18:41:21 -04:00
arrays.out Convert a few datatype input functions to use "soft" error reporting. 2022-12-09 10:14:53 -05:00
async.out
bit.out Convert a few more datatype input functions to report errors softly. 2022-12-14 13:22:08 -05:00
bitmapops.out
boolean.out Convert a few datatype input functions to use "soft" error reporting. 2022-12-09 10:14:53 -05:00
box.out Convert the geometric input functions to report errors softly. 2022-12-14 16:10:20 -05:00
brin_bloom.out BRIN bloom indexes 2021-03-26 13:35:32 +01:00
brin_multi.out Fix handling of NaN values in BRIN minmax multi 2021-11-06 01:50:44 +01:00
brin.out Avoid loss of code coverage with unlogged-index test cases. 2022-09-25 13:10:17 -04:00
btree_index.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
case.out Add support for NullIfExpr in eval_const_expressions 2021-04-02 11:01:49 +02:00
char_1.out Convert a few more datatype input functions to report errors softly. 2022-12-14 19:42:05 -05:00
char_2.out Convert a few more datatype input functions to report errors softly. 2022-12-14 19:42:05 -05:00
char.out Convert a few more datatype input functions to report errors softly. 2022-12-14 19:42:05 -05:00
circle.out Clean up ancient test style 2020-12-15 22:03:39 +01:00
cluster.out Fix MAINTAIN privileges for toast tables and partitions. 2023-01-14 00:16:23 -08:00
collate.icu.utf8_1.out
collate.icu.utf8.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
collate.linux.utf8_1.out
collate.linux.utf8.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
collate.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
collate.windows.win1252_1.out Windows support in pg_import_system_collations 2023-01-03 14:21:56 +01:00
collate.windows.win1252.out Update expected/collate.windows.win1252.out for 47bb9db75. 2023-01-18 15:27:41 -05:00
combocid.out Sanitize the term "combo CID" in code comments 2021-03-25 16:08:03 +09:00
comments.out
compression_1.out Remove error message hints mentioning configure options 2022-04-08 07:41:55 +02:00
compression.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
constraints.out Choose FK name correctly during partition attachment 2022-09-08 13:17:02 +02:00
conversion.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
copy2.out Add more tests for COPY with incorrect option combinations 2022-11-02 09:57:54 +09:00
copy.out Fix typos in comments, code and documentation 2023-01-03 16:26:14 +09:00
copydml.out Extend a test case a little 2021-02-26 09:11:15 +01:00
copyselect.out psql: Show all query results by default 2022-04-04 20:00:33 +02:00
create_aggregate.out
create_am.out Improve handling of SET ACCESS METHOD for ALTER MATERIALIZED VIEW 2022-03-19 19:13:52 +09:00
create_cast.out Record dependencies of a cast on other casts that it requires. 2022-10-17 14:02:05 -04:00
create_function_c.out Rename create_function_N test scripts for clarity. 2022-02-08 15:40:08 -05:00
create_function_sql.out Fix handling of R/W expanded datums that are passed to SQL functions. 2022-08-10 13:37:25 -04:00
create_index_spgist.out Add a planner support function for starts_with(). 2021-11-17 16:54:12 -05:00
create_index.out Fix a few issues with REINDEX grammar 2022-07-26 10:16:26 +09:00
create_misc.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
create_operator.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
create_procedure.out Fix various typos in code and tests 2023-02-09 14:43:53 +09:00
create_role.out DROP ROLE regress_role_limited_admin at end of test 2023-01-26 08:14:41 -05:00
create_table_like.out Don't print extra parens around expressions in extended stats 2021-09-01 00:43:22 +02:00
create_table.out Report a more useful error for reloptions on a partitioned table. 2022-11-09 12:28:34 -05:00
create_type.out Add test scaffolding for soft error reporting from input functions. 2022-12-09 10:08:44 -05:00
create_view.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
date.out Accept "+infinity" in date and timestamp[tz] input. 2023-01-01 14:16:07 -05:00
dbsize.out Teach pg_size_pretty and pg_size_bytes about petabytes 2021-07-09 18:56:00 +12:00
delete.out
dependency.out Add grantable MAINTAIN privilege and pg_maintain role. 2022-12-13 17:33:28 -08:00
domain.out Convert domain_in to report errors softly. 2022-12-11 12:56:54 -05:00
drop_if_exists.out
drop_operator.out
enum.out Convert enum_in() to report errors softly. 2022-12-25 14:32:30 -05:00
equivclass.out
errors.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
event_trigger.out Allow event trigger table_rewrite for ALTER MATERIALIZED VIEW 2022-08-17 14:55:20 +09:00
explain.out Track I/O timing for temporary file blocks in EXPLAIN (BUFFERS) 2022-04-08 11:27:21 +09:00
expressions.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
fast_default.out Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
float4-misrounded-input.out Convert a few datatype input functions to use "soft" error reporting. 2022-12-09 10:14:53 -05:00
float4.out Convert a few datatype input functions to use "soft" error reporting. 2022-12-09 10:14:53 -05:00
float8.out Convert a few datatype input functions to use "soft" error reporting. 2022-12-09 10:14:53 -05:00
foreign_data.out Add a SET option to the GRANT command. 2022-11-18 12:32:56 -05:00
foreign_key.out Create FKs properly when attaching table as partition 2022-11-03 20:40:21 +01:00
functional_deps.out
generated.out Fix check for child column generation status matching parent. 2023-02-16 18:51:55 -05:00
geometry.out Convert the geometric input functions to report errors softly. 2022-12-14 16:10:20 -05:00
gin.out Avoid loss of code coverage with unlogged-index test cases. 2022-09-25 13:10:17 -04:00
gist.out Avoid loss of code coverage with unlogged-index test cases. 2022-09-25 13:10:17 -04:00
groupingsets.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
guc.out Remove SQL regression tests for GUCs related to NO_SHOW_ALL 2023-02-08 16:56:21 +09:00
hash_func.out Fix portability issue in tests from commit ce773f230. 2021-09-03 10:01:02 -04:00
hash_index.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
hash_part.out Avoid using ambiguous word "non-negative" in error messages. 2021-07-28 01:20:16 +09:00
horology.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
identity.out Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
incremental_sort.out Have the planner consider Incremental Sort for DISTINCT 2023-01-11 10:25:43 +13:00
index_including_gist.out
index_including.out Support INCLUDE'd columns in SP-GiST. 2021-04-05 18:41:21 -04:00
indexing.out Fix subtly-incorrect matching of parent and child partitioned indexes. 2022-08-18 12:12:03 -04:00
indirect_toast.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
inet.out Convert a few more datatype input functions to report errors softly. 2022-12-14 13:22:08 -05:00
infinite_recurse_1.out Paper over regression failures in infinite_recurse() on PPC64 Linux. 2020-10-13 17:44:56 -04:00
infinite_recurse.out Paper over regression failures in infinite_recurse() on PPC64 Linux. 2020-10-13 17:44:56 -04:00
inherit.out Allow ordered partition scans in more cases 2021-08-03 12:25:52 +12:00
init_privs.out
insert_conflict.out Give better hints for ambiguous or unreferenceable columns. 2022-11-22 18:46:31 -05:00
insert.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
int2.out Allow underscores in integer and numeric constants. 2023-02-04 09:48:51 +00:00
int4.out Allow underscores in integer and numeric constants. 2023-02-04 09:48:51 +00:00
int8.out Allow underscores in integer and numeric constants. 2023-02-04 09:48:51 +00:00
interval.out Fix parsing of ISO-8601 interval fields with exponential notation. 2023-02-20 16:55:59 -05:00
join_hash.out Increase hash_mem_multiplier default to 2.0. 2022-02-16 18:41:52 -08:00
join.out Fix some issues with wrong placement of pseudo-constant quals. 2023-02-22 12:39:11 -05:00
json_encoding_1.out Convert json_in and jsonb_in to report errors softly. 2022-12-11 11:28:15 -05:00
json_encoding_2.out
json_encoding.out Convert json_in and jsonb_in to report errors softly. 2022-12-11 11:28:15 -05:00
json.out Convert json_in and jsonb_in to report errors softly. 2022-12-11 11:28:15 -05:00
jsonb_jsonpath.out Fix jsonpath existense checking of missing variables 2023-01-12 18:16:34 +03:00
jsonb.out Fix jsonb subscripting to cope with toasted subscript values. 2022-12-12 16:17:54 -05:00
jsonpath_encoding_1.out
jsonpath_encoding_2.out
jsonpath_encoding.out
jsonpath.out Convert jsonpath's input function to report errors softly 2022-12-24 15:21:20 -05:00
largeobject_1.out Prevent write operations on large objects in read-only transactions 2022-07-04 15:48:52 +09:00
largeobject.out Prevent write operations on large objects in read-only transactions 2022-07-04 15:48:52 +09:00
limit.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
line.out Convert the geometric input functions to report errors softly. 2022-12-14 16:10:20 -05:00
lock.out Add support for security invoker views. 2022-03-22 10:28:10 +00:00
lseg.out Convert the geometric input functions to report errors softly. 2022-12-14 16:10:20 -05:00
macaddr8.out Convert a few more datatype input functions to report errors softly. 2022-12-14 13:22:08 -05:00
macaddr.out Convert a few more datatype input functions to report errors softly. 2022-12-14 13:22:08 -05:00
matview.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
md5.out Put tests of md5() function into separate test file 2022-10-13 12:02:31 +02:00
memoize.out Use OFFSET 0 instead of ORDER BY to stop subquery pullup 2023-01-24 13:49:10 +13:00
merge.out Fix Assert failure for MERGE into a partitioned table with RLS. 2023-02-22 10:51:34 +00:00
misc_functions.out Rename pg_dissect_walfile_name() to pg_split_walfile_name() 2022-12-23 09:15:01 +09:00
misc_sanity.out Replace explicit PIN entries in pg_depend with an OID range test. 2021-07-15 11:41:47 -04:00
misc.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
money.out Convert a few more datatype input functions to report errors softly. 2022-12-14 18:03:11 -05:00
multirangetypes.out Rename force_parallel_mode to debug_parallel_query 2023-02-15 21:21:59 +13:00
mvcc.out Fix typo in MVCC test comment 2022-08-25 10:31:20 +02:00
name.out Clean up ancient test style 2020-12-15 22:03:39 +01:00
namespace.out
numeric_big.out Improve the accuracy of numeric power() for integer exponents. 2022-10-20 10:10:17 +01:00
numeric.out Allow underscores in integer and numeric constants. 2023-02-04 09:48:51 +00:00
numerology.out Allow underscores in integer and numeric constants. 2023-02-04 09:48:51 +00:00
object_address.out Fix object identity string for transforms 2023-02-13 14:03:09 +01:00
oid.out Convert a few more datatype input functions to report errors softly. 2022-12-14 17:50:24 -05:00
oidjoins.out Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
opr_sanity.out Move provariadic sanity check to a more appropriate place 2022-12-15 07:54:48 +01:00
partition_aggregate.out Remove redundant grouping and DISTINCT columns. 2023-01-18 12:37:57 -05:00
partition_info.out
partition_join.out Make Vars be outer-join-aware. 2023-01-30 13:16:20 -05:00
partition_prune.out Allow underscores in integer and numeric constants. 2023-02-04 09:48:51 +00:00
password.out
path.out Convert the geometric input functions to report errors softly. 2022-12-14 16:10:20 -05:00
pg_lsn.out Convert a few more datatype input functions to report errors softly. 2022-12-14 17:50:24 -05:00
plancache.out
plpgsql.out In plpgsql, don't preassign portal names to bound cursor variables. 2023-01-01 13:22:34 -05:00
point.out Convert the geometric input functions to report errors softly. 2022-12-14 16:10:20 -05:00
polygon.out Convert the geometric input functions to report errors softly. 2022-12-14 16:10:20 -05:00
polymorphism.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
portals_p2.out
portals.out Fix incorrect logic in HaveRegisteredOrActiveSnapshot(). 2022-04-16 16:04:50 -04:00
prepare.out Fix pg_prepared_statements.result_types for DML statements 2022-07-05 10:26:36 +02:00
prepared_xacts_1.out Fix check for conflicting session- vs transaction-level locks. 2021-07-24 18:35:52 -04:00
prepared_xacts.out Fix check for conflicting session- vs transaction-level locks. 2021-07-24 18:35:52 -04:00
privileges.out Simplify permissions for LOCK TABLE. 2023-01-13 14:33:19 -08:00
psql_crosstab.out Change return type of EXTRACT to numeric 2021-04-06 07:20:42 +02:00
psql.out Add USER SET parameter values for pg_db_role_setting 2022-12-09 13:12:20 +03:00
publication.out Improve some publication-related error messages 2022-09-27 14:11:31 +02:00
random.out Round off random_normal() test results one more decimal place. 2023-01-09 22:44:16 -05:00
rangefuncs.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
rangetypes.out Rename force_parallel_mode to debug_parallel_query 2023-02-15 21:21:59 +13:00
regex.out Fix regexp misbehavior with capturing parens inside "{0}". 2021-08-24 16:37:26 -04:00
regproc.out Remove new locale dependency in regproc regression test. 2022-12-27 13:06:42 -05:00
reindex_catalog.out Fix rd_firstRelfilenodeSubid for nailed relations, in parallel workers. 2020-09-09 18:50:24 -07:00
reloptions.out Try to stabilize reloptions test, again. 2022-01-20 23:10:40 +13:00
replica_identity.out Allow REPLICA IDENTITY to be set on an index that's not (yet) valid. 2023-01-21 13:10:29 -05:00
returning.out
roleattributes.out
rowsecurity.out Add grantable MAINTAIN privilege and pg_maintain role. 2022-12-13 17:33:28 -08:00
rowtypes.out Convert a few datatype input functions to use "soft" error reporting. 2022-12-09 10:14:53 -05:00
rules.out Print the correct aliases for DML target tables in ruleutils. 2023-02-17 16:40:34 -05:00
sanity_check.out Test ALIGNOF_DOUBLE==4 compatibility under ALIGNOF_DOUBLE==8. 2022-04-22 20:20:11 -07:00
security_label.out
select_distinct_on.out Use Limit instead of Unique to implement DISTINCT, when possible 2022-10-28 23:04:38 +13:00
select_distinct.out Remove redundant grouping and DISTINCT columns. 2023-01-18 12:37:57 -05:00
select_having_1.out
select_having_2.out
select_having.out
select_implicit_1.out Remove gratuitous uses of deprecated SELECT INTO 2021-01-28 14:28:41 +01:00
select_implicit_2.out Remove gratuitous uses of deprecated SELECT INTO 2021-01-28 14:28:41 +01:00
select_implicit.out Remove gratuitous uses of deprecated SELECT INTO 2021-01-28 14:28:41 +01:00
select_into.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
select_parallel.out Rename force_parallel_mode to debug_parallel_query 2023-02-15 21:21:59 +13:00
select_views.out
select.out Fix core dump in transformValuesClause when there are no columns. 2022-05-09 14:15:37 -04:00
sequence.out Unlogged sequences 2022-04-07 16:18:00 +02:00
spgist.out Avoid loss of code coverage with unlogged-index test cases. 2022-09-25 13:10:17 -04:00
stats_ext.out Fix planner failure with extended statistics on partitioned tables. 2022-11-01 14:34:44 -04:00
stats.out Add tests for pg_stat_io 2023-02-11 10:05:04 -08:00
strings.out Convert a few more datatype input functions to report errors softly. 2022-12-14 19:42:05 -05:00
subscription.out Fix error handling in libpqrcv_connect() 2023-01-23 18:27:42 -08:00
subselect.out Improve ruleutils' printout of LATERAL references within subplans. 2022-11-16 20:06:09 -05:00
sysviews.out Add enable_presorted_aggregate GUC 2022-12-20 22:28:58 +13:00
tablesample.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
tablespace.out Create regress_tblspc in test_setup 2023-02-11 10:03:04 -08:00
temp.out
test_setup.out Create regress_tblspc in test_setup 2023-02-11 10:03:04 -08:00
text.out Rearrange core regression tests to reduce cross-script dependencies. 2022-02-08 15:30:38 -05:00
tid.out Convert a few more datatype input functions to report errors softly. 2022-12-14 17:50:24 -05:00
tidrangescan.out Add TID Range Scans to support efficient scanning ranges of TIDs 2021-02-27 22:59:36 +13:00
tidscan.out Avoid making commutatively-duplicate clauses in EquivalenceClasses. 2022-10-27 14:42:18 -04:00
time.out Convert datetime input functions to use "soft" error reporting. 2022-12-09 16:07:49 -05:00
timestamp.out Detect overflow in timestamp[tz] subtraction. 2023-02-20 17:26:25 -05:00
timestamptz.out Detect overflow in timestamp[tz] subtraction. 2023-02-20 17:26:25 -05:00
timetz.out Convert datetime input functions to use "soft" error reporting. 2022-12-09 16:07:49 -05:00
transactions.out Introduce GUC_NO_RESET flag. 2022-09-27 11:47:12 -04:00
triggers.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
truncate.out
tsdicts.out
tsearch.out Fix ts_headline() to handle ORs and phrase queries more honestly. 2023-01-19 16:21:44 -05:00
tsrf.out
tstypes.out Convert tsqueryin and tsvectorin to report errors softly. 2022-12-27 12:00:31 -05:00
tuplesort.out Improve performance of ORDER BY / DISTINCT aggregates 2022-08-02 23:11:45 +12:00
txid.out
type_sanity.out Move provariadic sanity check to a more appropriate place 2022-12-15 07:54:48 +01:00
typed_table.out
unicode_1.out
unicode.out Fix buffer overrun in unicode string normalization with empty input 2021-11-11 15:00:59 +09:00
union.out Give better hints for ambiguous or unreferenceable columns. 2022-11-22 18:46:31 -05:00
updatable_views.out Fix multi-row DEFAULT handling for INSERT ... SELECT rules. 2023-02-23 10:53:01 +00:00
update.out Fix mishandling of resjunk columns in ON CONFLICT ... UPDATE tlists. 2021-05-10 11:02:29 -04:00
uuid.out Convert a few more datatype input functions to report errors softly. 2022-12-14 18:03:11 -05:00
vacuum_parallel.out Don't overlook indexes during parallel VACUUM. 2021-11-02 12:06:17 -07:00
vacuum.out Fix MAINTAIN privileges for toast tables and partitions. 2023-01-14 00:16:23 -08:00
varchar_1.out Convert a few more datatype input functions to report errors softly. 2022-12-14 19:42:05 -05:00
varchar_2.out Convert a few more datatype input functions to report errors softly. 2022-12-14 19:42:05 -05:00
varchar.out Convert a few more datatype input functions to report errors softly. 2022-12-14 19:42:05 -05:00
window.out Teach planner about more monotonic window functions 2023-01-27 16:08:41 +13:00
with.out Rename force_parallel_mode to debug_parallel_query 2023-02-15 21:21:59 +13:00
write_parallel.out Enable parallelism in REFRESH MATERIALIZED VIEW. 2021-03-17 15:04:17 +13:00
xid.out Detect bad input for types xid, xid8, and cid. 2022-12-27 11:40:01 -05:00
xml_1.out Convert xml_in to report errors softly. 2022-12-16 11:10:40 -05:00
xml_2.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
xml.out Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
xmlmap_1.out Remove error message hints mentioning configure options 2022-04-08 07:41:55 +02:00
xmlmap.out Fix incorrect xmlschema output for types timetz and timestamptz. 2022-03-18 16:01:42 -04:00