postgresql/src/backend/utils/adt
Tom Lane 94131cd53c 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
..
.gitignore Build all Flex files standalone 2022-09-04 12:09:01 +07:00
acl.c Add has_largeobject_privilege function. 2024-09-12 21:51:26 +09:00
amutils.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
array_expanded.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
array_selfuncs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
array_typanalyze.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
array_userfuncs.c Add SQL function array_reverse() 2024-11-01 10:32:19 +09:00
arrayfuncs.c Add contrib/pg_logicalinspect. 2024-10-14 17:22:02 -07:00
arraysubs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
arrayutils.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
ascii.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
bool.c Remove hardcoded hash opclass function signature exceptions 2024-09-12 12:57:43 +02:00
cash.c Remove dependence on -fwrapv semantics in a few places. 2024-08-15 15:47:31 -05:00
char.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
cryptohashfuncs.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
date.c Remove hardcoded hash opclass function signature exceptions 2024-09-12 12:57:43 +02:00
datetime.c Use camel case for "DateStyle" in some error messages 2024-10-07 12:36:00 +09:00
datum.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
dbsize.c Define PG_TBLSPC_DIR for path pg_tblspc/ in data folder 2024-09-03 09:11:54 +09:00
domains.c Adjust populate_record_field() to handle errors softly 2024-01-24 15:04:33 +09:00
encode.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
enum.c Allow more cases to pass the unsafe-use-of-new-enum-value restriction. 2024-03-24 14:30:29 -04:00
expandeddatum.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
expandedrecord.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
float.c Remove unused #include's from backend .c files 2024-10-27 08:26:50 +01:00
format_type.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
formatting.c Modernize to_char's Roman-numeral code, fixing overflow problems. 2024-09-26 11:02:31 -04:00
genfile.c Add pg_ls_summariesdir(). 2024-10-11 11:02:09 -05:00
geo_ops.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
geo_selfuncs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
geo_spgist.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
hbafuncs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
inet_cidr_ntop.c Avoid conflicts with library versions of inet_net_ntop() and friends. 2019-08-18 19:27:23 -04:00
inet_net_pton.c Avoid conflicts with library versions of inet_net_ntop() and friends. 2019-08-18 19:27:23 -04:00
int.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
int8.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
json.c Fix unique key checks in JSON object constructors 2024-09-11 13:21:10 +02:00
jsonb.c Optimize escaping of JSON strings 2024-07-27 23:46:07 +12:00
jsonb_gin.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
jsonb_op.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
jsonb_util.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
jsonbsubs.c Make the order of the header file includes consistent 2024-03-13 15:07:00 +01:00
jsonfuncs.c Further reduce dependence on -fwrapv semantics in jsonb. 2024-08-16 15:06:40 -05:00
jsonpath.c Optimize escaping of JSON strings 2024-07-27 23:46:07 +12:00
jsonpath_exec.c Remove unused #include's from backend .c files 2024-10-27 08:26:50 +01:00
jsonpath_gram.y Implement various jsonpath methods 2024-01-25 10:15:43 -05:00
jsonpath_internal.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
jsonpath_scan.l Implement various jsonpath methods 2024-01-25 10:15:43 -05:00
levenshtein.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
like.c Remove separate locale_is_c arguments 2024-09-13 16:10:52 +02:00
like_match.c Remove separate locale_is_c arguments 2024-09-13 16:10:52 +02:00
like_support.c Fix missed case for builtin collation provider. 2024-10-11 16:59:29 -07:00
lockfuncs.c Create waitfuncs.c for pg_isolation_test_session_is_blocked(). 2024-06-27 19:21:05 -07:00
mac.c Remove TRACE_SORT macro 2024-08-14 08:07:52 +02:00
mac8.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
Makefile Move libc-specific code from pg_locale.c into pg_locale_libc.c. 2024-10-14 12:48:43 -07:00
mcxtfuncs.c Remove "parent" column from pg_backend_memory_contexts 2024-08-12 15:42:16 +12:00
meson.build Move libc-specific code from pg_locale.c into pg_locale_libc.c. 2024-10-14 12:48:43 -07:00
misc.c Define PG_TBLSPC_DIR for path pg_tblspc/ in data folder 2024-09-03 09:11:54 +09:00
multirangetypes.c Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
multirangetypes_selfuncs.c Make the order of the header file includes consistent 2024-03-13 15:07:00 +01:00
name.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
network.c Remove TRACE_SORT macro 2024-08-14 08:07:52 +02:00
network_gist.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
network_selfuncs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
network_spgist.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
numeric.c Speed up numeric division by always using the "fast" algorithm. 2024-10-04 09:49:24 +01:00
numutils.c Remove dependence on -fwrapv semantics in a few places. 2024-08-15 15:47:31 -05:00
oid.c Use new overflow-safe integer comparison functions. 2024-02-16 14:05:36 -06:00
oracle_compat.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
orderedsetaggs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
partitionfuncs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
pg_locale.c Refactor the code to create a pg_locale_t into new function. 2024-10-25 16:31:08 -07:00
pg_locale_icu.c Move ICU-specific code from pg_locale.c into pg_locale_icu.c. 2024-10-14 12:13:26 -07:00
pg_locale_libc.c Move libc-specific code from pg_locale.c into pg_locale_libc.c. 2024-10-14 12:48:43 -07:00
pg_lsn.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
pg_upgrade_support.c Remove unused #include's from backend .c files 2024-10-27 08:26:50 +01:00
pgstatfuncs.c Add two attributes to pg_stat_database for parallel workers activity 2024-11-11 10:40:48 +09:00
pseudorandomfuncs.c Add functions to generate random numbers in a specified range. 2024-03-27 10:12:39 +00:00
pseudotypes.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
quote.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
rangetypes.c Add planner support functions for range operators <@ and @>. 2024-01-20 13:57:54 -05:00
rangetypes_gist.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
rangetypes_selfuncs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
rangetypes_spgist.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
rangetypes_typanalyze.c Make the order of the header file includes consistent 2024-03-13 15:07:00 +01:00
regexp.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
regproc.c Add to_regtypemod function to extract typemod from a string type name. 2024-03-20 17:11:28 -04:00
ri_triggers.c Fix collation handling for foreign keys 2024-11-15 14:55:54 +01:00
rowtypes.c Add min and max aggregates for composite types (records). 2024-07-11 11:50:50 -04:00
ruleutils.c Avoid assertion failure if a setop leaf query contains setops. 2024-11-20 12:03:47 -05:00
selfuncs.c Avoid crash in estimate_array_length with null root pointer. 2024-10-09 17:07:53 -04:00
tid.c Assign error codes where missing for user-facing failures 2024-07-04 09:48:40 +09:00
timestamp.c Remove hardcoded hash opclass function signature exceptions 2024-09-12 12:57:43 +02:00
trigfuncs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
tsginidx.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
tsgistidx.c Use psprintf to simplify gtsvectorout() 2024-08-06 23:05:25 +03:00
tsquery.c Fix parsing of ignored operators in websearch_to_tsquery(). 2024-06-13 20:35:02 -04:00
tsquery_cleanup.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
tsquery_gist.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
tsquery_op.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
tsquery_rewrite.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
tsquery_util.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
tsrank.c Refactor getWeights to write to caller-supplied buffer 2024-07-30 22:06:07 +03:00
tsvector.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
tsvector_op.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
tsvector_parser.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
uuid.c Remove TRACE_SORT macro 2024-08-14 08:07:52 +02:00
varbit.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
varchar.c Simplify checks for deterministic collations. 2024-09-12 13:35:56 -07:00
varlena.c Add min and max aggregates for bytea type. 2024-10-08 13:52:14 -04:00
version.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
waitfuncs.c Remove unused #include's from backend .c files 2024-10-27 08:26:50 +01:00
windowfuncs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
xid.c Remove hardcoded hash opclass function signature exceptions 2024-09-12 12:57:43 +02:00
xid8funcs.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
xml.c Neaten up our choices of SQLSTATEs for XML-related errors. 2024-09-24 12:59:56 -04:00