postgresql/src/backend
Tom Lane 630520c22f Avoid assertion failure if a setop leaf query contains setops.
Ordinarily transformSetOperationTree will collect all UNION/
INTERSECT/EXCEPT steps into the setOperations tree of the topmost
Query, so that leaf queries do not contain any setOperations.
However, it cannot thus flatten a subquery that also contains
WITH, ORDER BY, FOR UPDATE, or LIMIT.  I (tgl) forgot that in
commit 07b4c48b6 and wrote an assertion in rule deparsing that
a leaf's setOperations would always be empty.

If it were nonempty then we would want to parenthesize the subquery
to ensure that the output represents the setop nesting correctly
(e.g. UNION below INTERSECT had better get parenthesized).  So
rather than just removing the faulty Assert, let's change it into
an additional case to check to decide whether to add parens.  We
don't expect that the additional case will ever fire, but it's
cheap insurance.

Man Zeng and Tom Lane

Discussion: https://postgr.es/m/tencent_7ABF9B1F23B0C77606FC5FE3@qq.com
2024-11-20 12:03:47 -05:00
..
access Fix improper interactions between session_authorization and role. 2024-11-11 10:29:54 -05:00
bootstrap Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
catalog Suppress new "may be used uninitialized" warning. 2024-11-02 19:42:57 -07:00
commands Fix arrays comparison in CompareOpclassOptions() 2024-11-12 01:54:38 +02:00
executor Ensure cached plans are correctly marked as dependent on role. 2024-11-11 09:00:00 -06:00
foreign Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:20 -07:00
jit Monkey-patch LLVM code to fix ARM relocation bug. 2024-11-06 23:10:05 +13:00
lib Fix lock assertions in dshash.c. 2022-07-11 15:48:54 +12:00
libpq Fix regression in TLS session ticket disabling 2024-08-19 12:55:11 +02:00
main Fix outdated --help message for postgres -f 2022-08-15 13:37:40 +09:00
nodes Further fixes for MULTIEXPR_SUBLINK fix. 2022-09-06 16:38:18 -04:00
optimizer Compare collations before merging UNION operations. 2024-11-19 18:26:19 -05:00
parser Remove incorrect Assert. 2024-09-11 11:42:19 -04:00
partitioning Fix creation of partition descriptor during concurrent detach+drop 2024-08-12 18:17:56 -04:00
po Translation updates 2024-11-11 13:58:30 +01:00
port Check for STATUS_DELETE_PENDING on Windows. 2024-11-08 09:44:46 +10:30
postmaster Avoid deadlock during orphan temp table removal. 2024-04-02 14:59:04 -04:00
regex Fix recently-exposed portability issue in regex optimization. 2024-11-17 14:14:06 -05:00
replication Fix a possibility of logical replication slot's restart_lsn going backwards. 2024-11-15 17:05:57 -08:00
rewrite Ensure cached plans are correctly marked as dependent on role. 2024-11-11 09:00:00 -06:00
snowball In the Snowball dictionary, don't try to stem excessively-long words. 2022-08-31 10:42:05 -04:00
statistics Fix incorrectly reported stats kind in "can't happen" ERROR 2024-03-05 16:19:05 +13:00
storage At end of recovery, reset all sinval-managed caches. 2024-10-25 06:51:08 -07:00
tcop Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:20 -07:00
tsearch Limit to_tsvector_byid's initial array allocation to something sane. 2023-09-25 11:50:28 -04:00
utils Avoid assertion failure if a setop leaf query contains setops. 2024-11-20 12:03:47 -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 2020-09-14 13:14:53 +02:00