pg_query 4.2.1 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +6 -8
- data/Rakefile +5 -6
- data/ext/pg_query/extconf.rb +14 -4
- data/ext/pg_query/include/pg_query.h +27 -3
- data/ext/pg_query/include/pg_query_enum_defs.c +311 -149
- data/ext/pg_query/include/pg_query_fingerprint_conds.c +545 -489
- data/ext/pg_query/include/pg_query_fingerprint_defs.c +5092 -4432
- data/ext/pg_query/include/pg_query_outfuncs_conds.c +385 -343
- data/ext/pg_query/include/pg_query_outfuncs_defs.c +1294 -1161
- data/ext/pg_query/include/pg_query_readfuncs_conds.c +137 -123
- data/ext/pg_query/include/pg_query_readfuncs_defs.c +1657 -1496
- data/ext/pg_query/include/{access → postgres/access}/amapi.h +3 -1
- data/ext/pg_query/include/{access → postgres/access}/attmap.h +5 -3
- data/ext/pg_query/include/{access → postgres/access}/attnum.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/clog.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/commit_ts.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/detoast.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/genam.h +7 -5
- data/ext/pg_query/include/{access → postgres/access}/gin.h +16 -3
- data/ext/pg_query/include/{access → postgres/access}/htup.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/htup_details.h +6 -2
- data/ext/pg_query/include/{access → postgres/access}/itup.h +61 -58
- data/ext/pg_query/include/{access → postgres/access}/parallel.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/printtup.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/relation.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/relscan.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/rmgrlist.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/sdir.h +12 -3
- data/ext/pg_query/include/{access → postgres/access}/skey.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/stratnum.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/sysattr.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/table.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/tableam.h +68 -45
- data/ext/pg_query/include/{access → postgres/access}/toast_compression.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/transam.h +1 -1
- data/ext/pg_query/include/postgres/access/tsmapi.h +82 -0
- data/ext/pg_query/include/{access → postgres/access}/tupconvert.h +5 -2
- data/ext/pg_query/include/{access → postgres/access}/tupdesc.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/tupmacs.h +58 -98
- data/ext/pg_query/include/{access → postgres/access}/twophase.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/xact.h +25 -18
- data/ext/pg_query/include/{access → postgres/access}/xlog.h +15 -16
- data/ext/pg_query/include/{access → postgres/access}/xlog_internal.h +100 -62
- data/ext/pg_query/include/postgres/access/xlogbackup.h +41 -0
- data/ext/pg_query/include/{access → postgres/access}/xlogdefs.h +6 -25
- data/ext/pg_query/include/{access → postgres/access}/xlogprefetcher.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/xlogreader.h +7 -6
- data/ext/pg_query/include/{access → postgres/access}/xlogrecord.h +17 -5
- data/ext/pg_query/include/{access → postgres/access}/xlogrecovery.h +4 -3
- data/ext/pg_query/include/postgres/archive/archive_module.h +59 -0
- data/ext/pg_query/include/{c.h → postgres/c.h} +144 -156
- data/ext/pg_query/include/{catalog → postgres/catalog}/catalog.h +4 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/catversion.h +6 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/dependency.h +5 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/genbki.h +7 -6
- data/ext/pg_query/include/{catalog → postgres/catalog}/index.h +4 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/indexing.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/namespace.h +2 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaccess.h +10 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaddress.h +3 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute.h +19 -17
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute_d.h +19 -19
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation_d.h +4 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint.h +2 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_control.h +9 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion.h +2 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion_d.h +1 -1
- data/ext/pg_query/include/postgres/catalog/pg_database.h +124 -0
- data/ext/pg_query/include/postgres/catalog/pg_database_d.h +52 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily.h +3 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily_d.h +4 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication.h +2 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/storage.h +6 -6
- data/ext/pg_query/include/{commands → postgres/commands}/async.h +1 -1
- data/ext/pg_query/include/{commands → postgres/commands}/dbcommands.h +2 -1
- data/ext/pg_query/include/{commands → postgres/commands}/defrem.h +2 -1
- data/ext/pg_query/include/{commands → postgres/commands}/event_trigger.h +1 -1
- data/ext/pg_query/include/{commands → postgres/commands}/explain.h +3 -1
- data/ext/pg_query/include/{commands → postgres/commands}/prepare.h +1 -1
- data/ext/pg_query/include/{commands → postgres/commands}/tablespace.h +4 -4
- data/ext/pg_query/include/{commands → postgres/commands}/trigger.h +15 -14
- data/ext/pg_query/include/{commands → postgres/commands}/user.h +9 -3
- data/ext/pg_query/include/{commands → postgres/commands}/vacuum.h +60 -14
- data/ext/pg_query/include/postgres/common/cryptohash.h +39 -0
- data/ext/pg_query/include/{common → postgres/common}/file_perm.h +1 -1
- data/ext/pg_query/include/{common → postgres/common}/hashfn.h +1 -1
- data/ext/pg_query/include/postgres/common/int.h +437 -0
- data/ext/pg_query/include/{common → postgres/common}/keywords.h +1 -1
- data/ext/pg_query/include/{common → postgres/common}/kwlookup.h +2 -2
- data/ext/pg_query/include/{common → postgres/common}/pg_prng.h +3 -2
- data/ext/pg_query/include/{common → postgres/common}/relpath.h +20 -13
- data/ext/pg_query/include/postgres/common/scram-common.h +70 -0
- data/ext/pg_query/include/postgres/common/sha2.h +32 -0
- data/ext/pg_query/include/{common → postgres/common}/string.h +5 -3
- data/ext/pg_query/include/{common → postgres/common}/unicode_east_asian_fw_table.h +10 -10
- data/ext/pg_query/include/{common/unicode_combining_table.h → postgres/common/unicode_nonspacing_table.h} +31 -13
- data/ext/pg_query/include/postgres/copyfuncs.funcs.c +5013 -0
- data/ext/pg_query/include/postgres/copyfuncs.switch.c +938 -0
- data/ext/pg_query/include/{datatype → postgres/datatype}/timestamp.h +11 -4
- data/ext/pg_query/include/postgres/equalfuncs.funcs.c +3097 -0
- data/ext/pg_query/include/postgres/equalfuncs.switch.c +785 -0
- data/ext/pg_query/include/{executor → postgres/executor}/execdesc.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/executor.h +34 -17
- data/ext/pg_query/include/{executor → postgres/executor}/functions.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/instrument.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/spi.h +2 -2
- data/ext/pg_query/include/{executor → postgres/executor}/tablefunc.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/tuptable.h +18 -11
- data/ext/pg_query/include/{fmgr.h → postgres/fmgr.h} +21 -2
- data/ext/pg_query/include/postgres/foreign/fdwapi.h +294 -0
- data/ext/pg_query/include/{funcapi.h → postgres/funcapi.h} +12 -12
- data/ext/pg_query/include/postgres/gram.h +1127 -0
- data/ext/pg_query/include/{parser → postgres}/gramparse.h +4 -4
- data/ext/pg_query/include/{jit → postgres/jit}/jit.h +2 -2
- data/ext/pg_query/include/postgres/kwlist_d.h +1119 -0
- data/ext/pg_query/include/{lib → postgres/lib}/dshash.h +4 -1
- data/ext/pg_query/include/{lib → postgres/lib}/ilist.h +435 -22
- data/ext/pg_query/include/{lib → postgres/lib}/pairingheap.h +1 -1
- data/ext/pg_query/include/{lib → postgres/lib}/simplehash.h +9 -9
- data/ext/pg_query/include/{lib → postgres/lib}/sort_template.h +1 -1
- data/ext/pg_query/include/{lib → postgres/lib}/stringinfo.h +3 -3
- data/ext/pg_query/include/{libpq → postgres/libpq}/auth.h +8 -2
- data/ext/pg_query/include/{libpq → postgres/libpq}/crypt.h +1 -1
- data/ext/pg_query/include/{libpq → postgres/libpq}/hba.h +24 -17
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq-be.h +36 -25
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq.h +1 -1
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqcomm.h +10 -41
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqformat.h +2 -2
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqsignal.h +22 -10
- data/ext/pg_query/include/postgres/libpq/sasl.h +136 -0
- data/ext/pg_query/include/postgres/libpq/scram.h +37 -0
- data/ext/pg_query/include/{mb → postgres/mb}/pg_wchar.h +35 -18
- data/ext/pg_query/include/{mb → postgres/mb}/stringinfo_mb.h +1 -1
- data/ext/pg_query/include/{miscadmin.h → postgres/miscadmin.h} +27 -15
- data/ext/pg_query/include/{nodes → postgres/nodes}/bitmapset.h +11 -7
- data/ext/pg_query/include/{nodes → postgres/nodes}/execnodes.h +83 -30
- data/ext/pg_query/include/{nodes → postgres/nodes}/extensible.h +5 -3
- data/ext/pg_query/include/{nodes → postgres/nodes}/lockoptions.h +1 -1
- data/ext/pg_query/include/{nodes → postgres/nodes}/makefuncs.h +14 -2
- data/ext/pg_query/include/{nodes → postgres/nodes}/memnodes.h +7 -4
- data/ext/pg_query/include/postgres/nodes/miscnodes.h +56 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/nodeFuncs.h +89 -29
- data/ext/pg_query/include/{nodes → postgres/nodes}/nodes.h +96 -511
- data/ext/pg_query/include/postgres/nodes/nodetags.h +471 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/params.h +3 -3
- data/ext/pg_query/include/{nodes → postgres/nodes}/parsenodes.h +377 -139
- data/ext/pg_query/include/{nodes → postgres/nodes}/pathnodes.h +1090 -440
- data/ext/pg_query/include/{nodes → postgres/nodes}/pg_list.h +30 -7
- data/ext/pg_query/include/{nodes → postgres/nodes}/plannodes.h +367 -124
- data/ext/pg_query/include/{nodes → postgres/nodes}/primnodes.h +670 -222
- data/ext/pg_query/include/{nodes → postgres/nodes}/print.h +1 -1
- data/ext/pg_query/include/{utils → postgres/nodes}/queryjumble.h +5 -7
- data/ext/pg_query/include/postgres/nodes/replnodes.h +111 -0
- data/ext/pg_query/include/postgres/nodes/supportnodes.h +346 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/tidbitmap.h +1 -1
- data/ext/pg_query/include/{nodes → postgres/nodes}/value.h +12 -2
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/cost.h +6 -4
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo.h +1 -1
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo_gene.h +1 -1
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/optimizer.h +8 -8
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/paths.h +16 -7
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/planmain.h +3 -6
- data/ext/pg_query/include/{parser → postgres/parser}/analyze.h +4 -3
- data/ext/pg_query/include/{parser → postgres/parser}/kwlist.h +12 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_agg.h +4 -2
- data/ext/pg_query/include/{parser → postgres/parser}/parse_coerce.h +3 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_expr.h +1 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_func.h +1 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_node.h +22 -4
- data/ext/pg_query/include/{parser → postgres/parser}/parse_oper.h +3 -3
- data/ext/pg_query/include/{parser → postgres/parser}/parse_relation.h +8 -3
- data/ext/pg_query/include/{parser → postgres/parser}/parse_type.h +4 -3
- data/ext/pg_query/include/{parser → postgres/parser}/parser.h +4 -4
- data/ext/pg_query/include/{parser → postgres/parser}/parsetree.h +1 -1
- data/ext/pg_query/include/{parser → postgres/parser}/scanner.h +2 -2
- data/ext/pg_query/include/{parser → postgres/parser}/scansup.h +1 -1
- data/ext/pg_query/include/{partitioning → postgres/partitioning}/partdefs.h +1 -1
- data/ext/pg_query/include/{pg_config.h → postgres/pg_config.h} +158 -218
- data/ext/pg_query/include/{pg_config_manual.h → postgres/pg_config_manual.h} +8 -46
- data/ext/pg_query/include/postgres/pg_config_os.h +8 -0
- data/ext/pg_query/include/{pg_getopt.h → postgres/pg_getopt.h} +1 -1
- data/ext/pg_query/include/{pg_trace.h → postgres/pg_trace.h} +1 -1
- data/ext/pg_query/include/{pgstat.h → postgres/pgstat.h} +173 -94
- data/ext/pg_query/include/{pgtime.h → postgres/pgtime.h} +3 -3
- data/ext/pg_query/include/{pl_gram.h → postgres/pl_gram.h} +66 -64
- data/ext/pg_query/include/{pl_reserved_kwlist.h → postgres/pl_reserved_kwlist.h} +1 -1
- data/ext/pg_query/include/{pl_reserved_kwlist_d.h → postgres/pl_reserved_kwlist_d.h} +1 -1
- data/ext/pg_query/include/{pl_unreserved_kwlist.h → postgres/pl_unreserved_kwlist.h} +2 -1
- data/ext/pg_query/include/{pl_unreserved_kwlist_d.h → postgres/pl_unreserved_kwlist_d.h} +48 -46
- data/ext/pg_query/include/{plpgsql.h → postgres/plpgsql.h} +28 -33
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-arm.h +3 -3
- data/ext/pg_query/include/postgres/port/atomics/arch-hppa.h +17 -0
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-ppc.h +21 -21
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-x86.h +2 -2
- data/ext/pg_query/include/{port → postgres/port}/atomics/fallback.h +3 -3
- data/ext/pg_query/include/{port → postgres/port}/atomics/generic-gcc.h +1 -1
- data/ext/pg_query/include/postgres/port/atomics/generic-msvc.h +101 -0
- data/ext/pg_query/include/postgres/port/atomics/generic-sunpro.h +106 -0
- data/ext/pg_query/include/{port → postgres/port}/atomics/generic.h +1 -1
- data/ext/pg_query/include/{port → postgres/port}/atomics.h +2 -7
- data/ext/pg_query/include/{port → postgres/port}/pg_bitutils.h +62 -25
- data/ext/pg_query/include/{port → postgres/port}/pg_bswap.h +1 -1
- data/ext/pg_query/include/{port → postgres/port}/pg_crc32c.h +1 -1
- data/ext/pg_query/include/postgres/port/simd.h +375 -0
- data/ext/pg_query/include/postgres/port/win32/arpa/inet.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/dlfcn.h +1 -0
- data/ext/pg_query/include/postgres/port/win32/grp.h +1 -0
- data/ext/pg_query/include/postgres/port/win32/netdb.h +7 -0
- data/ext/pg_query/include/postgres/port/win32/netinet/in.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/netinet/tcp.h +7 -0
- data/ext/pg_query/include/postgres/port/win32/pwd.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/sys/resource.h +20 -0
- data/ext/pg_query/include/postgres/port/win32/sys/select.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/sys/socket.h +26 -0
- data/ext/pg_query/include/postgres/port/win32/sys/un.h +17 -0
- data/ext/pg_query/include/postgres/port/win32/sys/wait.h +3 -0
- data/ext/pg_query/include/postgres/port/win32.h +59 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/dirent.h +34 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/file.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/param.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/time.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/unistd.h +9 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/utime.h +3 -0
- data/ext/pg_query/include/postgres/port/win32_port.h +594 -0
- data/ext/pg_query/include/{port.h → postgres/port.h} +42 -75
- data/ext/pg_query/include/postgres/portability/instr_time.h +197 -0
- data/ext/pg_query/include/postgres/postgres.h +579 -0
- data/ext/pg_query/include/{postgres_ext.h → postgres/postgres_ext.h} +0 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/autovacuum.h +1 -4
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker.h +2 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker_internals.h +1 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgwriter.h +2 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/interrupt.h +1 -1
- data/ext/pg_query/include/postgres/postmaster/pgarch.h +36 -0
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/postmaster.h +6 -3
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/startup.h +3 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/syslogger.h +2 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/walwriter.h +3 -1
- data/ext/pg_query/include/{regex → postgres/regex}/regex.h +9 -6
- data/ext/pg_query/include/{replication → postgres/replication}/logicallauncher.h +6 -1
- data/ext/pg_query/include/{replication → postgres/replication}/logicalproto.h +30 -10
- data/ext/pg_query/include/postgres/replication/logicalworker.h +32 -0
- data/ext/pg_query/include/{replication → postgres/replication}/origin.h +4 -4
- data/ext/pg_query/include/{replication → postgres/replication}/reorderbuffer.h +113 -45
- data/ext/pg_query/include/{replication → postgres/replication}/slot.h +25 -6
- data/ext/pg_query/include/{replication → postgres/replication}/syncrep.h +2 -8
- data/ext/pg_query/include/{replication → postgres/replication}/walreceiver.h +15 -9
- data/ext/pg_query/include/{replication → postgres/replication}/walsender.h +13 -13
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/prs2lock.h +1 -1
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteHandler.h +1 -4
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteManip.h +11 -2
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteSupport.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/backendid.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/block.h +24 -31
- data/ext/pg_query/include/{storage → postgres/storage}/buf.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/bufmgr.h +183 -87
- data/ext/pg_query/include/{storage → postgres/storage}/bufpage.h +146 -93
- data/ext/pg_query/include/{storage → postgres/storage}/condition_variable.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/dsm.h +3 -6
- data/ext/pg_query/include/{storage → postgres/storage}/dsm_impl.h +4 -1
- data/ext/pg_query/include/{storage → postgres/storage}/fd.h +24 -20
- data/ext/pg_query/include/{storage → postgres/storage}/fileset.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/ipc.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/item.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/itemid.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/itemptr.h +94 -57
- data/ext/pg_query/include/{storage → postgres/storage}/large_object.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/latch.h +9 -1
- data/ext/pg_query/include/{storage → postgres/storage}/lmgr.h +6 -1
- data/ext/pg_query/include/{storage → postgres/storage}/lock.h +21 -13
- data/ext/pg_query/include/{storage → postgres/storage}/lockdefs.h +3 -3
- data/ext/pg_query/include/{storage → postgres/storage}/lwlock.h +16 -2
- data/ext/pg_query/include/{storage → postgres/storage}/off.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pg_sema.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pg_shmem.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pmsignal.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/predicate.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/proc.h +22 -17
- data/ext/pg_query/include/{storage → postgres/storage}/procarray.h +3 -2
- data/ext/pg_query/include/{storage → postgres/storage}/proclist_types.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/procsignal.h +3 -1
- data/ext/pg_query/include/postgres/storage/relfilelocator.h +99 -0
- data/ext/pg_query/include/{storage → postgres/storage}/s_lock.h +66 -309
- data/ext/pg_query/include/{storage → postgres/storage}/sharedfileset.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/shm_mq.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/shm_toc.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/shmem.h +1 -23
- data/ext/pg_query/include/{storage → postgres/storage}/sinval.h +3 -3
- data/ext/pg_query/include/{storage → postgres/storage}/sinvaladt.h +4 -2
- data/ext/pg_query/include/{storage → postgres/storage}/smgr.h +12 -10
- data/ext/pg_query/include/{storage → postgres/storage}/spin.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/standby.h +9 -8
- data/ext/pg_query/include/{storage → postgres/storage}/standbydefs.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/sync.h +3 -3
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtag.h +7 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtaglist.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/deparse_utility.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/dest.h +1 -3
- data/ext/pg_query/include/{tcop → postgres/tcop}/fastpath.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/pquery.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/tcopprot.h +3 -6
- data/ext/pg_query/include/{tcop → postgres/tcop}/utility.h +1 -1
- data/ext/pg_query/include/{tsearch → postgres/tsearch}/ts_cache.h +2 -4
- data/ext/pg_query/include/{utils → postgres/utils}/acl.h +26 -81
- data/ext/pg_query/include/{utils → postgres/utils}/aclchk_internal.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/array.h +19 -1
- data/ext/pg_query/include/{utils → postgres/utils}/backend_progress.h +2 -1
- data/ext/pg_query/include/{utils → postgres/utils}/backend_status.h +24 -3
- data/ext/pg_query/include/{utils → postgres/utils}/builtins.h +15 -6
- data/ext/pg_query/include/{utils → postgres/utils}/bytea.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/catcache.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/date.h +37 -9
- data/ext/pg_query/include/{utils → postgres/utils}/datetime.h +41 -21
- data/ext/pg_query/include/{utils → postgres/utils}/datum.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/dsa.h +5 -1
- data/ext/pg_query/include/{utils → postgres/utils}/elog.h +104 -29
- data/ext/pg_query/include/{utils → postgres/utils}/expandeddatum.h +14 -3
- data/ext/pg_query/include/{utils → postgres/utils}/expandedrecord.h +14 -4
- data/ext/pg_query/include/{utils → postgres/utils}/float.h +7 -6
- data/ext/pg_query/include/{utils → postgres/utils}/fmgroids.h +54 -1
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrprotos.h +45 -3
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrtab.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/guc.h +59 -86
- data/ext/pg_query/include/postgres/utils/guc_hooks.h +163 -0
- data/ext/pg_query/include/{utils → postgres/utils}/guc_tables.h +49 -3
- data/ext/pg_query/include/{utils → postgres/utils}/hsearch.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/inval.h +3 -3
- data/ext/pg_query/include/postgres/utils/logtape.h +77 -0
- data/ext/pg_query/include/{utils → postgres/utils}/lsyscache.h +5 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memdebug.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memutils.h +7 -51
- data/ext/pg_query/include/postgres/utils/memutils_internal.h +136 -0
- data/ext/pg_query/include/postgres/utils/memutils_memorychunk.h +237 -0
- data/ext/pg_query/include/{utils → postgres/utils}/numeric.h +20 -5
- data/ext/pg_query/include/{utils → postgres/utils}/palloc.h +9 -2
- data/ext/pg_query/include/{utils → postgres/utils}/partcache.h +3 -2
- data/ext/pg_query/include/{utils → postgres/utils}/pg_locale.h +22 -14
- data/ext/pg_query/include/{utils → postgres/utils}/pgstat_internal.h +37 -7
- data/ext/pg_query/include/{utils → postgres/utils}/plancache.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/portal.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/probes.h +6 -6
- data/ext/pg_query/include/postgres/utils/ps_status.h +47 -0
- data/ext/pg_query/include/{utils → postgres/utils}/queryenvironment.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/regproc.h +3 -3
- data/ext/pg_query/include/{utils → postgres/utils}/rel.h +60 -43
- data/ext/pg_query/include/{utils → postgres/utils}/relcache.h +13 -8
- data/ext/pg_query/include/{utils → postgres/utils}/reltrigger.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/resowner.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/ruleutils.h +6 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sharedtuplestore.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/snapmgr.h +4 -2
- data/ext/pg_query/include/{utils → postgres/utils}/snapshot.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sortsupport.h +2 -2
- data/ext/pg_query/include/{utils → postgres/utils}/syscache.h +4 -1
- data/ext/pg_query/include/{utils → postgres/utils}/timeout.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/timestamp.h +41 -11
- data/ext/pg_query/include/{utils → postgres/utils}/tuplesort.h +189 -35
- data/ext/pg_query/include/{utils → postgres/utils}/tuplestore.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/typcache.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/varlena.h +13 -1
- data/ext/pg_query/include/{utils → postgres/utils}/wait_event.h +9 -4
- data/ext/pg_query/include/{utils → postgres/utils}/xml.h +15 -5
- data/ext/pg_query/include/{postgres.h → postgres/varatt.h} +7 -457
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +6186 -5585
- data/ext/pg_query/include/protobuf/pg_query.pb.h +112443 -91222
- data/ext/pg_query/pg_query.c +10 -1
- data/ext/pg_query/pg_query.pb-c.c +19755 -17757
- data/ext/pg_query/pg_query_deparse.c +1 -10635
- data/ext/pg_query/pg_query_fingerprint.c +12 -8
- data/ext/pg_query/pg_query_fingerprint.h +1 -1
- data/ext/pg_query/pg_query_internal.h +1 -1
- data/ext/pg_query/pg_query_json_plpgsql.c +1 -0
- data/ext/pg_query/pg_query_normalize.c +1 -1
- data/ext/pg_query/pg_query_outfuncs_json.c +6 -0
- data/ext/pg_query/pg_query_outfuncs_protobuf.c +3 -2
- data/ext/pg_query/pg_query_parse.c +47 -5
- data/ext/pg_query/pg_query_parse_plpgsql.c +7 -5
- data/ext/pg_query/pg_query_readfuncs_protobuf.c +1 -0
- data/ext/pg_query/pg_query_ruby.c +5 -0
- data/ext/pg_query/pg_query_ruby_freebsd.sym +2 -0
- data/ext/pg_query/pg_query_scan.c +1 -1
- data/ext/pg_query/pg_query_split.c +3 -3
- data/ext/pg_query/postgres_deparse.c +11067 -0
- data/ext/pg_query/postgres_deparse.h +9 -0
- data/ext/pg_query/src_backend_catalog_namespace.c +7 -2
- data/ext/pg_query/src_backend_catalog_pg_proc.c +1 -1
- data/ext/pg_query/src_backend_commands_define.c +1 -1
- data/ext/pg_query/src_backend_nodes_bitmapset.c +11 -70
- data/ext/pg_query/src_backend_nodes_copyfuncs.c +96 -6202
- data/ext/pg_query/src_backend_nodes_equalfuncs.c +95 -4068
- data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
- data/ext/pg_query/src_backend_nodes_list.c +14 -2
- data/ext/pg_query/src_backend_nodes_makefuncs.c +95 -1
- data/ext/pg_query/src_backend_nodes_nodeFuncs.c +283 -132
- data/ext/pg_query/src_backend_nodes_nodes.c +38 -0
- data/ext/pg_query/src_backend_nodes_value.c +1 -1
- data/ext/pg_query/src_backend_parser_gram.c +33208 -31806
- data/ext/pg_query/src_backend_parser_parser.c +28 -2
- data/ext/pg_query/src_backend_parser_scan.c +4318 -3329
- data/ext/pg_query/src_backend_parser_scansup.c +1 -1
- data/ext/pg_query/src_backend_storage_ipc_ipc.c +1 -1
- data/ext/pg_query/src_backend_tcop_postgres.c +66 -87
- data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_datum.c +5 -7
- data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_format_type.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_numutils.c +489 -0
- data/ext/pg_query/src_backend_utils_adt_ruleutils.c +79 -5
- data/ext/pg_query/src_backend_utils_error_assert.c +4 -7
- data/ext/pg_query/src_backend_utils_error_elog.c +371 -249
- data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +33 -1
- data/ext/pg_query/src_backend_utils_init_globals.c +6 -3
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +21 -67
- data/ext/pg_query/src_backend_utils_misc_guc_tables.c +492 -0
- data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +163 -0
- data/ext/pg_query/src_backend_utils_mmgr_aset.c +449 -312
- data/ext/pg_query/src_backend_utils_mmgr_generation.c +1039 -0
- data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +398 -49
- data/ext/pg_query/src_backend_utils_mmgr_slab.c +1021 -0
- data/ext/pg_query/src_common_encnames.c +4 -1
- data/ext/pg_query/src_common_hashfn.c +1 -1
- data/ext/pg_query/src_common_keywords.c +1 -1
- data/ext/pg_query/src_common_kwlist_d.h +534 -510
- data/ext/pg_query/src_common_kwlookup.c +1 -1
- data/ext/pg_query/src_common_psprintf.c +1 -1
- data/ext/pg_query/src_common_stringinfo.c +4 -4
- data/ext/pg_query/src_common_wchar.c +9 -8
- data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +661 -694
- data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +48 -46
- data/ext/pg_query/src_port_pg_bitutils.c +79 -5
- data/ext/pg_query/src_port_pgstrcasecmp.c +29 -1
- data/ext/pg_query/src_port_snprintf.c +6 -10
- data/ext/pg_query/src_port_strerror.c +1 -1
- data/ext/pg_query/src_port_strlcpy.c +79 -0
- data/lib/pg_query/fingerprint.rb +2 -3
- data/lib/pg_query/node.rb +16 -11
- data/lib/pg_query/parse.rb +1 -1
- data/lib/pg_query/pg_query_pb.rb +166 -3191
- data/lib/pg_query/treewalker.rb +23 -5
- data/lib/pg_query/version.rb +1 -1
- metadata +432 -380
- data/ext/pg_query/guc-file.c +0 -0
- data/ext/pg_query/include/catalog/pg_parameter_acl.h +0 -60
- data/ext/pg_query/include/catalog/pg_parameter_acl_d.h +0 -34
- data/ext/pg_query/include/commands/variable.h +0 -38
- data/ext/pg_query/include/common/ip.h +0 -31
- data/ext/pg_query/include/getaddrinfo.h +0 -162
- data/ext/pg_query/include/kwlist_d.h +0 -1095
- data/ext/pg_query/include/parser/gram.h +0 -1101
- data/ext/pg_query/include/pg_config_os.h +0 -8
- data/ext/pg_query/include/portability/instr_time.h +0 -256
- data/ext/pg_query/include/postmaster/auxprocess.h +0 -20
- data/ext/pg_query/include/postmaster/fork_process.h +0 -17
- data/ext/pg_query/include/postmaster/pgarch.h +0 -73
- data/ext/pg_query/include/replication/logicalworker.h +0 -19
- data/ext/pg_query/include/storage/relfilenode.h +0 -99
- data/ext/pg_query/include/utils/dynahash.h +0 -20
- data/ext/pg_query/include/utils/pg_lsn.h +0 -29
- data/ext/pg_query/include/utils/pidfile.h +0 -56
- data/ext/pg_query/include/utils/ps_status.h +0 -25
- data/ext/pg_query/include/utils/rls.h +0 -50
- data/ext/pg_query/include/utils/tzparser.h +0 -39
- data/ext/pg_query/src_backend_postmaster_postmaster.c +0 -2201
- data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -371
- data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1116
- data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1993
- data/ext/pg_query/src_common_pg_prng.c +0 -152
- data/ext/pg_query/src_common_string.c +0 -92
- data/ext/pg_query/src_port_pgsleep.c +0 -69
- data/ext/pg_query/src_port_strnlen.c +0 -39
- /data/ext/pg_query/include/{access → postgres/access}/rmgr.h +0 -0
- /data/ext/pg_query/include/{pg_config_ext.h → postgres/pg_config_ext.h} +0 -0
- /data/ext/pg_query/include/{plerrcodes.h → postgres/plerrcodes.h} +0 -0
- /data/ext/pg_query/include/{storage → postgres/storage}/lwlocknames.h +0 -0
- /data/ext/pg_query/include/{utils → postgres/utils}/errcodes.h +0 -0
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* pathnodes.h
|
|
4
4
|
* Definitions for planner's internal data structures, especially Paths.
|
|
5
5
|
*
|
|
6
|
+
* We don't support copying RelOptInfo, IndexOptInfo, or Path nodes.
|
|
7
|
+
* There are some subsidiary structs that are useful to copy, though.
|
|
6
8
|
*
|
|
7
|
-
* Portions Copyright (c) 1996-
|
|
9
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
8
10
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
9
11
|
*
|
|
10
12
|
* src/include/nodes/pathnodes.h
|
|
@@ -85,51 +87,79 @@ typedef enum UpperRelationKind
|
|
|
85
87
|
* PlannerGlobal holds state for an entire planner invocation; this state
|
|
86
88
|
* is shared across all levels of sub-Queries that exist in the command being
|
|
87
89
|
* planned.
|
|
90
|
+
*
|
|
91
|
+
* Not all fields are printed. (In some cases, there is no print support for
|
|
92
|
+
* the field type; in others, doing so would lead to infinite recursion.)
|
|
88
93
|
*----------
|
|
89
94
|
*/
|
|
90
95
|
typedef struct PlannerGlobal
|
|
91
96
|
{
|
|
97
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
98
|
+
|
|
92
99
|
NodeTag type;
|
|
93
100
|
|
|
94
|
-
|
|
101
|
+
/* Param values provided to planner() */
|
|
102
|
+
ParamListInfo boundParams pg_node_attr(read_write_ignore);
|
|
95
103
|
|
|
96
|
-
|
|
104
|
+
/* Plans for SubPlan nodes */
|
|
105
|
+
List *subplans;
|
|
97
106
|
|
|
98
|
-
|
|
107
|
+
/* PlannerInfos for SubPlan nodes */
|
|
108
|
+
List *subroots pg_node_attr(read_write_ignore);
|
|
99
109
|
|
|
100
|
-
|
|
110
|
+
/* indices of subplans that require REWIND */
|
|
111
|
+
Bitmapset *rewindPlanIDs;
|
|
101
112
|
|
|
102
|
-
|
|
113
|
+
/* "flat" rangetable for executor */
|
|
114
|
+
List *finalrtable;
|
|
103
115
|
|
|
104
|
-
|
|
116
|
+
/* "flat" list of RTEPermissionInfos */
|
|
117
|
+
List *finalrteperminfos;
|
|
105
118
|
|
|
106
|
-
|
|
119
|
+
/* "flat" list of PlanRowMarks */
|
|
120
|
+
List *finalrowmarks;
|
|
107
121
|
|
|
108
|
-
|
|
122
|
+
/* "flat" list of integer RT indexes */
|
|
123
|
+
List *resultRelations;
|
|
109
124
|
|
|
110
|
-
|
|
125
|
+
/* "flat" list of AppendRelInfos */
|
|
126
|
+
List *appendRelations;
|
|
111
127
|
|
|
112
|
-
|
|
128
|
+
/* OIDs of relations the plan depends on */
|
|
129
|
+
List *relationOids;
|
|
113
130
|
|
|
114
|
-
|
|
131
|
+
/* other dependencies, as PlanInvalItems */
|
|
132
|
+
List *invalItems;
|
|
115
133
|
|
|
116
|
-
|
|
134
|
+
/* type OIDs for PARAM_EXEC Params */
|
|
135
|
+
List *paramExecTypes;
|
|
117
136
|
|
|
118
|
-
|
|
137
|
+
/* highest PlaceHolderVar ID assigned */
|
|
138
|
+
Index lastPHId;
|
|
119
139
|
|
|
120
|
-
|
|
140
|
+
/* highest PlanRowMark ID assigned */
|
|
141
|
+
Index lastRowMarkId;
|
|
121
142
|
|
|
122
|
-
|
|
143
|
+
/* highest plan node ID assigned */
|
|
144
|
+
int lastPlanNodeId;
|
|
123
145
|
|
|
124
|
-
|
|
146
|
+
/* redo plan when TransactionXmin changes? */
|
|
147
|
+
bool transientPlan;
|
|
125
148
|
|
|
126
|
-
|
|
149
|
+
/* is plan specific to current role? */
|
|
150
|
+
bool dependsOnRole;
|
|
127
151
|
|
|
128
|
-
|
|
152
|
+
/* parallel mode potentially OK? */
|
|
153
|
+
bool parallelModeOK;
|
|
129
154
|
|
|
130
|
-
|
|
155
|
+
/* parallel mode actually required? */
|
|
156
|
+
bool parallelModeNeeded;
|
|
131
157
|
|
|
132
|
-
|
|
158
|
+
/* worst PROPARALLEL hazard level */
|
|
159
|
+
char maxParallelHazard;
|
|
160
|
+
|
|
161
|
+
/* partition descriptors */
|
|
162
|
+
PartitionDirectory partition_directory pg_node_attr(read_write_ignore);
|
|
133
163
|
} PlannerGlobal;
|
|
134
164
|
|
|
135
165
|
/* macro for fetching the Plan associated with a SubPlan node */
|
|
@@ -148,6 +178,10 @@ typedef struct PlannerGlobal
|
|
|
148
178
|
*
|
|
149
179
|
* For reasons explained in optimizer/optimizer.h, we define the typedef
|
|
150
180
|
* either here or in that header, whichever is read first.
|
|
181
|
+
*
|
|
182
|
+
* Not all fields are printed. (In some cases, there is no print support for
|
|
183
|
+
* the field type; in others, doing so would lead to infinite recursion or
|
|
184
|
+
* bloat dump output more than seems useful.)
|
|
151
185
|
*----------
|
|
152
186
|
*/
|
|
153
187
|
#ifndef HAVE_PLANNERINFO_TYPEDEF
|
|
@@ -157,15 +191,21 @@ typedef struct PlannerInfo PlannerInfo;
|
|
|
157
191
|
|
|
158
192
|
struct PlannerInfo
|
|
159
193
|
{
|
|
194
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
195
|
+
|
|
160
196
|
NodeTag type;
|
|
161
197
|
|
|
162
|
-
|
|
198
|
+
/* the Query being planned */
|
|
199
|
+
Query *parse;
|
|
163
200
|
|
|
164
|
-
|
|
201
|
+
/* global info for current planner run */
|
|
202
|
+
PlannerGlobal *glob;
|
|
165
203
|
|
|
166
|
-
|
|
204
|
+
/* 1 at the outermost Query */
|
|
205
|
+
Index query_level;
|
|
167
206
|
|
|
168
|
-
|
|
207
|
+
/* NULL at outermost Query */
|
|
208
|
+
PlannerInfo *parent_root pg_node_attr(read_write_ignore);
|
|
169
209
|
|
|
170
210
|
/*
|
|
171
211
|
* plan_params contains the expressions that this query level needs to
|
|
@@ -173,7 +213,8 @@ struct PlannerInfo
|
|
|
173
213
|
* outer_params contains the paramIds of PARAM_EXEC Params that outer
|
|
174
214
|
* query levels will make available to this query level.
|
|
175
215
|
*/
|
|
176
|
-
|
|
216
|
+
/* list of PlannerParamItems, see below */
|
|
217
|
+
List *plan_params;
|
|
177
218
|
Bitmapset *outer_params;
|
|
178
219
|
|
|
179
220
|
/*
|
|
@@ -183,39 +224,46 @@ struct PlannerInfo
|
|
|
183
224
|
* does not correspond to a base relation, such as a join RTE or an
|
|
184
225
|
* unreferenced view RTE; or if the RelOptInfo hasn't been made yet.
|
|
185
226
|
*/
|
|
186
|
-
struct RelOptInfo **simple_rel_array;
|
|
187
|
-
|
|
227
|
+
struct RelOptInfo **simple_rel_array pg_node_attr(array_size(simple_rel_array_size));
|
|
228
|
+
/* allocated size of array */
|
|
229
|
+
int simple_rel_array_size;
|
|
188
230
|
|
|
189
231
|
/*
|
|
190
232
|
* simple_rte_array is the same length as simple_rel_array and holds
|
|
191
233
|
* pointers to the associated rangetable entries. Using this is a shade
|
|
192
|
-
* faster than using rt_fetch(), mostly due to fewer indirections.
|
|
234
|
+
* faster than using rt_fetch(), mostly due to fewer indirections. (Not
|
|
235
|
+
* printed because it'd be redundant with parse->rtable.)
|
|
193
236
|
*/
|
|
194
|
-
RangeTblEntry **simple_rte_array;
|
|
237
|
+
RangeTblEntry **simple_rte_array pg_node_attr(read_write_ignore);
|
|
195
238
|
|
|
196
239
|
/*
|
|
197
240
|
* append_rel_array is the same length as the above arrays, and holds
|
|
198
241
|
* pointers to the corresponding AppendRelInfo entry indexed by
|
|
199
242
|
* child_relid, or NULL if the rel is not an appendrel child. The array
|
|
200
|
-
* itself is not allocated if append_rel_list is empty.
|
|
243
|
+
* itself is not allocated if append_rel_list is empty. (Not printed
|
|
244
|
+
* because it'd be redundant with append_rel_list.)
|
|
201
245
|
*/
|
|
202
|
-
struct AppendRelInfo **append_rel_array;
|
|
246
|
+
struct AppendRelInfo **append_rel_array pg_node_attr(read_write_ignore);
|
|
203
247
|
|
|
204
248
|
/*
|
|
205
|
-
* all_baserels is a Relids set of all base relids (but not
|
|
206
|
-
*
|
|
207
|
-
* we need to form. This is computed in make_one_rel, just before we
|
|
208
|
-
* start making Paths.
|
|
249
|
+
* all_baserels is a Relids set of all base relids (but not joins or
|
|
250
|
+
* "other" rels) in the query. This is computed in deconstruct_jointree.
|
|
209
251
|
*/
|
|
210
252
|
Relids all_baserels;
|
|
211
253
|
|
|
212
254
|
/*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
|
|
216
|
-
|
|
255
|
+
* outer_join_rels is a Relids set of all outer-join relids in the query.
|
|
256
|
+
* This is computed in deconstruct_jointree.
|
|
257
|
+
*/
|
|
258
|
+
Relids outer_join_rels;
|
|
259
|
+
|
|
260
|
+
/*
|
|
261
|
+
* all_query_rels is a Relids set of all base relids and outer join relids
|
|
262
|
+
* (but not "other" relids) in the query. This is the Relids identifier
|
|
263
|
+
* of the final join we need to form. This is computed in
|
|
264
|
+
* deconstruct_jointree.
|
|
217
265
|
*/
|
|
218
|
-
Relids
|
|
266
|
+
Relids all_query_rels;
|
|
219
267
|
|
|
220
268
|
/*
|
|
221
269
|
* join_rel_list is a list of all join-relation RelOptInfos we have
|
|
@@ -226,8 +274,8 @@ struct PlannerInfo
|
|
|
226
274
|
* even when using the hash table for lookups; this simplifies life for
|
|
227
275
|
* GEQO.
|
|
228
276
|
*/
|
|
229
|
-
List *join_rel_list;
|
|
230
|
-
struct HTAB *join_rel_hash;
|
|
277
|
+
List *join_rel_list;
|
|
278
|
+
struct HTAB *join_rel_hash pg_node_attr(read_write_ignore);
|
|
231
279
|
|
|
232
280
|
/*
|
|
233
281
|
* When doing a dynamic-programming-style join search, join_rel_level[k]
|
|
@@ -235,36 +283,61 @@ struct PlannerInfo
|
|
|
235
283
|
* join_cur_level is the current level. New join-relation RelOptInfos are
|
|
236
284
|
* automatically added to the join_rel_level[join_cur_level] list.
|
|
237
285
|
* join_rel_level is NULL if not in use.
|
|
286
|
+
*
|
|
287
|
+
* Note: we've already printed all baserel and joinrel RelOptInfos above,
|
|
288
|
+
* so we don't dump join_rel_level or other lists of RelOptInfos.
|
|
289
|
+
*/
|
|
290
|
+
/* lists of join-relation RelOptInfos */
|
|
291
|
+
List **join_rel_level pg_node_attr(read_write_ignore);
|
|
292
|
+
/* index of list being extended */
|
|
293
|
+
int join_cur_level;
|
|
294
|
+
|
|
295
|
+
/* init SubPlans for query */
|
|
296
|
+
List *init_plans;
|
|
297
|
+
|
|
298
|
+
/*
|
|
299
|
+
* per-CTE-item list of subplan IDs (or -1 if no subplan was made for that
|
|
300
|
+
* CTE)
|
|
238
301
|
*/
|
|
239
|
-
List
|
|
240
|
-
int join_cur_level; /* index of list being extended */
|
|
302
|
+
List *cte_plan_ids;
|
|
241
303
|
|
|
242
|
-
|
|
304
|
+
/* List of Lists of Params for MULTIEXPR subquery outputs */
|
|
305
|
+
List *multiexpr_params;
|
|
243
306
|
|
|
244
|
-
|
|
245
|
-
|
|
307
|
+
/* list of JoinDomains used in the query (higher ones first) */
|
|
308
|
+
List *join_domains;
|
|
246
309
|
|
|
247
|
-
|
|
248
|
-
|
|
310
|
+
/* list of active EquivalenceClasses */
|
|
311
|
+
List *eq_classes;
|
|
249
312
|
|
|
250
|
-
|
|
313
|
+
/* set true once ECs are canonical */
|
|
314
|
+
bool ec_merging_done;
|
|
251
315
|
|
|
252
|
-
|
|
316
|
+
/* list of "canonical" PathKeys */
|
|
317
|
+
List *canon_pathkeys;
|
|
253
318
|
|
|
254
|
-
|
|
319
|
+
/*
|
|
320
|
+
* list of OuterJoinClauseInfos for mergejoinable outer join clauses
|
|
321
|
+
* w/nonnullable var on left
|
|
322
|
+
*/
|
|
323
|
+
List *left_join_clauses;
|
|
255
324
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
325
|
+
/*
|
|
326
|
+
* list of OuterJoinClauseInfos for mergejoinable outer join clauses
|
|
327
|
+
* w/nonnullable var on right
|
|
328
|
+
*/
|
|
329
|
+
List *right_join_clauses;
|
|
259
330
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
331
|
+
/*
|
|
332
|
+
* list of OuterJoinClauseInfos for mergejoinable full join clauses
|
|
333
|
+
*/
|
|
334
|
+
List *full_join_clauses;
|
|
263
335
|
|
|
264
|
-
|
|
265
|
-
|
|
336
|
+
/* list of SpecialJoinInfos */
|
|
337
|
+
List *join_info_list;
|
|
266
338
|
|
|
267
|
-
|
|
339
|
+
/* counter for assigning RestrictInfo serial numbers */
|
|
340
|
+
int last_rinfo_serial;
|
|
268
341
|
|
|
269
342
|
/*
|
|
270
343
|
* all_result_relids is empty for SELECT, otherwise it contains at least
|
|
@@ -274,41 +347,99 @@ struct PlannerInfo
|
|
|
274
347
|
* included. leaf_result_relids is similar except that only actual result
|
|
275
348
|
* tables, not partitioned tables, are included in it.
|
|
276
349
|
*/
|
|
277
|
-
|
|
278
|
-
Relids
|
|
350
|
+
/* set of all result relids */
|
|
351
|
+
Relids all_result_relids;
|
|
352
|
+
/* set of all leaf relids */
|
|
353
|
+
Relids leaf_result_relids;
|
|
279
354
|
|
|
280
355
|
/*
|
|
356
|
+
* list of AppendRelInfos
|
|
357
|
+
*
|
|
281
358
|
* Note: for AppendRelInfos describing partitions of a partitioned table,
|
|
282
359
|
* we guarantee that partitions that come earlier in the partitioned
|
|
283
360
|
* table's PartitionDesc will appear earlier in append_rel_list.
|
|
284
361
|
*/
|
|
285
|
-
List *append_rel_list;
|
|
362
|
+
List *append_rel_list;
|
|
286
363
|
|
|
287
|
-
|
|
364
|
+
/* list of RowIdentityVarInfos */
|
|
365
|
+
List *row_identity_vars;
|
|
288
366
|
|
|
289
|
-
|
|
367
|
+
/* list of PlanRowMarks */
|
|
368
|
+
List *rowMarks;
|
|
290
369
|
|
|
291
|
-
|
|
370
|
+
/* list of PlaceHolderInfos */
|
|
371
|
+
List *placeholder_list;
|
|
292
372
|
|
|
293
|
-
|
|
373
|
+
/* array of PlaceHolderInfos indexed by phid */
|
|
374
|
+
struct PlaceHolderInfo **placeholder_array pg_node_attr(read_write_ignore, array_size(placeholder_array_size));
|
|
375
|
+
/* allocated size of array */
|
|
376
|
+
int placeholder_array_size pg_node_attr(read_write_ignore);
|
|
294
377
|
|
|
295
|
-
|
|
378
|
+
/* list of ForeignKeyOptInfos */
|
|
379
|
+
List *fkey_list;
|
|
380
|
+
|
|
381
|
+
/* desired pathkeys for query_planner() */
|
|
382
|
+
List *query_pathkeys;
|
|
383
|
+
|
|
384
|
+
/* groupClause pathkeys, if any */
|
|
385
|
+
List *group_pathkeys;
|
|
386
|
+
|
|
387
|
+
/*
|
|
388
|
+
* The number of elements in the group_pathkeys list which belong to the
|
|
389
|
+
* GROUP BY clause. Additional ones belong to ORDER BY / DISTINCT
|
|
390
|
+
* aggregates.
|
|
391
|
+
*/
|
|
392
|
+
int num_groupby_pathkeys;
|
|
296
393
|
|
|
297
|
-
|
|
298
|
-
List *window_pathkeys;
|
|
299
|
-
|
|
300
|
-
List *
|
|
394
|
+
/* pathkeys of bottom window, if any */
|
|
395
|
+
List *window_pathkeys;
|
|
396
|
+
/* distinctClause pathkeys, if any */
|
|
397
|
+
List *distinct_pathkeys;
|
|
398
|
+
/* sortClause pathkeys, if any */
|
|
399
|
+
List *sort_pathkeys;
|
|
301
400
|
|
|
302
|
-
|
|
303
|
-
|
|
401
|
+
/* Canonicalised partition schemes used in the query. */
|
|
402
|
+
List *part_schemes pg_node_attr(read_write_ignore);
|
|
304
403
|
|
|
305
|
-
|
|
404
|
+
/* RelOptInfos we are now trying to join */
|
|
405
|
+
List *initial_rels pg_node_attr(read_write_ignore);
|
|
306
406
|
|
|
307
|
-
/*
|
|
308
|
-
|
|
407
|
+
/*
|
|
408
|
+
* Upper-rel RelOptInfos. Use fetch_upper_rel() to get any particular
|
|
409
|
+
* upper rel.
|
|
410
|
+
*/
|
|
411
|
+
List *upper_rels[UPPERREL_FINAL + 1] pg_node_attr(read_write_ignore);
|
|
309
412
|
|
|
310
413
|
/* Result tlists chosen by grouping_planner for upper-stage processing */
|
|
311
|
-
struct PathTarget *upper_targets[UPPERREL_FINAL + 1];
|
|
414
|
+
struct PathTarget *upper_targets[UPPERREL_FINAL + 1] pg_node_attr(read_write_ignore);
|
|
415
|
+
|
|
416
|
+
/*
|
|
417
|
+
* The fully-processed groupClause is kept here. It differs from
|
|
418
|
+
* parse->groupClause in that we remove any items that we can prove
|
|
419
|
+
* redundant, so that only the columns named here actually need to be
|
|
420
|
+
* compared to determine grouping. Note that it's possible for *all* the
|
|
421
|
+
* items to be proven redundant, implying that there is only one group
|
|
422
|
+
* containing all the query's rows. Hence, if you want to check whether
|
|
423
|
+
* GROUP BY was specified, test for nonempty parse->groupClause, not for
|
|
424
|
+
* nonempty processed_groupClause.
|
|
425
|
+
*
|
|
426
|
+
* Currently, when grouping sets are specified we do not attempt to
|
|
427
|
+
* optimize the groupClause, so that processed_groupClause will be
|
|
428
|
+
* identical to parse->groupClause.
|
|
429
|
+
*/
|
|
430
|
+
List *processed_groupClause;
|
|
431
|
+
|
|
432
|
+
/*
|
|
433
|
+
* The fully-processed distinctClause is kept here. It differs from
|
|
434
|
+
* parse->distinctClause in that we remove any items that we can prove
|
|
435
|
+
* redundant, so that only the columns named here actually need to be
|
|
436
|
+
* compared to determine uniqueness. Note that it's possible for *all*
|
|
437
|
+
* the items to be proven redundant, implying that there should be only
|
|
438
|
+
* one output row. Hence, if you want to check whether DISTINCT was
|
|
439
|
+
* specified, test for nonempty parse->distinctClause, not for nonempty
|
|
440
|
+
* processed_distinctClause.
|
|
441
|
+
*/
|
|
442
|
+
List *processed_distinctClause;
|
|
312
443
|
|
|
313
444
|
/*
|
|
314
445
|
* The fully-processed targetlist is kept here. It differs from
|
|
@@ -329,52 +460,87 @@ struct PlannerInfo
|
|
|
329
460
|
*/
|
|
330
461
|
List *update_colnos;
|
|
331
462
|
|
|
332
|
-
/*
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
463
|
+
/*
|
|
464
|
+
* Fields filled during create_plan() for use in setrefs.c
|
|
465
|
+
*/
|
|
466
|
+
/* for GroupingFunc fixup (can't print: array length not known here) */
|
|
467
|
+
AttrNumber *grouping_map pg_node_attr(read_write_ignore);
|
|
468
|
+
/* List of MinMaxAggInfos */
|
|
469
|
+
List *minmax_aggs;
|
|
337
470
|
|
|
338
|
-
|
|
339
|
-
|
|
471
|
+
/* context holding PlannerInfo */
|
|
472
|
+
MemoryContext planner_cxt pg_node_attr(read_write_ignore);
|
|
340
473
|
|
|
341
|
-
|
|
342
|
-
Cardinality
|
|
474
|
+
/* # of pages in all non-dummy tables of query */
|
|
475
|
+
Cardinality total_table_pages;
|
|
343
476
|
|
|
344
|
-
|
|
345
|
-
|
|
477
|
+
/* tuple_fraction passed to query_planner */
|
|
478
|
+
Selectivity tuple_fraction;
|
|
479
|
+
/* limit_tuples passed to query_planner */
|
|
480
|
+
Cardinality limit_tuples;
|
|
346
481
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
482
|
+
/*
|
|
483
|
+
* Minimum security_level for quals. Note: qual_security_level is zero if
|
|
484
|
+
* there are no securityQuals.
|
|
485
|
+
*/
|
|
486
|
+
Index qual_security_level;
|
|
487
|
+
|
|
488
|
+
/* true if any RTEs are RTE_JOIN kind */
|
|
489
|
+
bool hasJoinRTEs;
|
|
490
|
+
/* true if any RTEs are marked LATERAL */
|
|
491
|
+
bool hasLateralRTEs;
|
|
492
|
+
/* true if havingQual was non-null */
|
|
493
|
+
bool hasHavingQual;
|
|
494
|
+
/* true if any RestrictInfo has pseudoconstant = true */
|
|
495
|
+
bool hasPseudoConstantQuals;
|
|
496
|
+
/* true if we've made any of those */
|
|
497
|
+
bool hasAlternativeSubPlans;
|
|
498
|
+
/* true once we're no longer allowed to add PlaceHolderInfos */
|
|
499
|
+
bool placeholdersFrozen;
|
|
500
|
+
/* true if planning a recursive WITH item */
|
|
501
|
+
bool hasRecursion;
|
|
354
502
|
|
|
355
503
|
/*
|
|
356
504
|
* Information about aggregates. Filled by preprocess_aggrefs().
|
|
357
505
|
*/
|
|
358
|
-
|
|
359
|
-
List *
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
506
|
+
/* AggInfo structs */
|
|
507
|
+
List *agginfos;
|
|
508
|
+
/* AggTransInfo structs */
|
|
509
|
+
List *aggtransinfos;
|
|
510
|
+
/* number of aggs with DISTINCT/ORDER BY/WITHIN GROUP */
|
|
511
|
+
int numOrderedAggs;
|
|
512
|
+
/* does any agg not support partial mode? */
|
|
513
|
+
bool hasNonPartialAggs;
|
|
514
|
+
/* is any partial agg non-serializable? */
|
|
515
|
+
bool hasNonSerialAggs;
|
|
363
516
|
|
|
364
|
-
/*
|
|
365
|
-
|
|
366
|
-
|
|
517
|
+
/*
|
|
518
|
+
* These fields are used only when hasRecursion is true:
|
|
519
|
+
*/
|
|
520
|
+
/* PARAM_EXEC ID for the work table */
|
|
521
|
+
int wt_param_id;
|
|
522
|
+
/* a path for non-recursive term */
|
|
523
|
+
struct Path *non_recursive_path;
|
|
367
524
|
|
|
368
|
-
/*
|
|
369
|
-
|
|
370
|
-
|
|
525
|
+
/*
|
|
526
|
+
* These fields are workspace for createplan.c
|
|
527
|
+
*/
|
|
528
|
+
/* outer rels above current node */
|
|
529
|
+
Relids curOuterRels;
|
|
530
|
+
/* not-yet-assigned NestLoopParams */
|
|
531
|
+
List *curOuterParams;
|
|
371
532
|
|
|
372
|
-
/*
|
|
373
|
-
|
|
374
|
-
|
|
533
|
+
/*
|
|
534
|
+
* These fields are workspace for setrefs.c. Each is an array
|
|
535
|
+
* corresponding to glob->subplans. (We could probably teach
|
|
536
|
+
* gen_node_support.pl how to determine the array length, but it doesn't
|
|
537
|
+
* seem worth the trouble, so just mark them read_write_ignore.)
|
|
538
|
+
*/
|
|
539
|
+
bool *isAltSubplan pg_node_attr(read_write_ignore);
|
|
540
|
+
bool *isUsedSubplan pg_node_attr(read_write_ignore);
|
|
375
541
|
|
|
376
542
|
/* optional private data for join_search_hook, e.g., GEQO */
|
|
377
|
-
void *join_search_private;
|
|
543
|
+
void *join_search_private pg_node_attr(read_write_ignore);
|
|
378
544
|
|
|
379
545
|
/* Does this query modify any partition key columns? */
|
|
380
546
|
bool partColsUpdated;
|
|
@@ -430,9 +596,10 @@ typedef struct PartitionSchemeData *PartitionScheme;
|
|
|
430
596
|
* or the output of a sub-SELECT or function that appears in the range table.
|
|
431
597
|
* In either case it is uniquely identified by an RT index. A "joinrel"
|
|
432
598
|
* is the joining of two or more base rels. A joinrel is identified by
|
|
433
|
-
* the set of RT indexes for its component baserels
|
|
434
|
-
*
|
|
435
|
-
*
|
|
599
|
+
* the set of RT indexes for its component baserels, along with RT indexes
|
|
600
|
+
* for any outer joins it has computed. We create RelOptInfo nodes for each
|
|
601
|
+
* baserel and joinrel, and store them in the PlannerInfo's simple_rel_array
|
|
602
|
+
* and join_rel_list respectively.
|
|
436
603
|
*
|
|
437
604
|
* Note that there is only one joinrel for any given set of component
|
|
438
605
|
* baserels, no matter what order we assemble them in; so an unordered
|
|
@@ -465,14 +632,13 @@ typedef struct PartitionSchemeData *PartitionScheme;
|
|
|
465
632
|
* Many of the fields in these RelOptInfos are meaningless, but their Path
|
|
466
633
|
* fields always hold Paths showing ways to do that processing step.
|
|
467
634
|
*
|
|
468
|
-
* Lastly, there is a RelOptKind for "dead" relations, which are base rels
|
|
469
|
-
* that we have proven we don't need to join after all.
|
|
470
|
-
*
|
|
471
635
|
* Parts of this data structure are specific to various scan and join
|
|
472
636
|
* mechanisms. It didn't seem worth creating new node types for them.
|
|
473
637
|
*
|
|
474
|
-
* relids - Set of
|
|
475
|
-
*
|
|
638
|
+
* relids - Set of relation identifiers (RT indexes). This is a base
|
|
639
|
+
* relation if there is just one, a join relation if more;
|
|
640
|
+
* in the join case, RT indexes of any outer joins formed
|
|
641
|
+
* at or below this join are included along with baserels
|
|
476
642
|
* rows - estimated number of tuples in the relation after restriction
|
|
477
643
|
* clauses have been applied (ie, output rows of a plan for it)
|
|
478
644
|
* consider_startup - true if there is any value in keeping plain paths for
|
|
@@ -514,12 +680,13 @@ typedef struct PartitionSchemeData *PartitionScheme;
|
|
|
514
680
|
* the attribute is needed as part of final targetlist
|
|
515
681
|
* attr_widths - cache space for per-attribute width estimates;
|
|
516
682
|
* zero means not computed yet
|
|
683
|
+
* nulling_relids - relids of outer joins that can null this rel
|
|
517
684
|
* lateral_vars - lateral cross-references of rel, if any (list of
|
|
518
685
|
* Vars and PlaceHolderVars)
|
|
519
686
|
* lateral_referencers - relids of rels that reference this one laterally
|
|
520
687
|
* (includes both direct and indirect lateral references)
|
|
521
688
|
* indexlist - list of IndexOptInfo nodes for relation's indexes
|
|
522
|
-
* (always NIL if it's not a table)
|
|
689
|
+
* (always NIL if it's not a table or partitioned table)
|
|
523
690
|
* pages - number of disk pages in relation (zero if not a table)
|
|
524
691
|
* tuples - number of tuples in relation (not considering restrictions)
|
|
525
692
|
* allvisfrac - fraction of disk pages that are marked all-visible
|
|
@@ -631,6 +798,9 @@ typedef struct PartitionSchemeData *PartitionScheme;
|
|
|
631
798
|
* Furthermore, FULL JOINs add extra nullable_partexprs expressions
|
|
632
799
|
* corresponding to COALESCE expressions of the left and right join columns,
|
|
633
800
|
* to simplify matching join clauses to those lists.
|
|
801
|
+
*
|
|
802
|
+
* Not all fields are printed. (In some cases, there is no print support for
|
|
803
|
+
* the field type.)
|
|
634
804
|
*----------
|
|
635
805
|
*/
|
|
636
806
|
|
|
@@ -644,8 +814,7 @@ typedef enum RelOptKind
|
|
|
644
814
|
RELOPT_OTHER_MEMBER_REL,
|
|
645
815
|
RELOPT_OTHER_JOINREL,
|
|
646
816
|
RELOPT_UPPER_REL,
|
|
647
|
-
RELOPT_OTHER_UPPER_REL
|
|
648
|
-
RELOPT_DEADREL
|
|
817
|
+
RELOPT_OTHER_UPPER_REL
|
|
649
818
|
} RelOptKind;
|
|
650
819
|
|
|
651
820
|
/*
|
|
@@ -674,25 +843,43 @@ typedef enum RelOptKind
|
|
|
674
843
|
|
|
675
844
|
typedef struct RelOptInfo
|
|
676
845
|
{
|
|
846
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
847
|
+
|
|
677
848
|
NodeTag type;
|
|
678
849
|
|
|
679
850
|
RelOptKind reloptkind;
|
|
680
851
|
|
|
681
|
-
/*
|
|
682
|
-
|
|
852
|
+
/*
|
|
853
|
+
* all relations included in this RelOptInfo; set of base + OJ relids
|
|
854
|
+
* (rangetable indexes)
|
|
855
|
+
*/
|
|
856
|
+
Relids relids;
|
|
683
857
|
|
|
684
|
-
/*
|
|
685
|
-
|
|
858
|
+
/*
|
|
859
|
+
* size estimates generated by planner
|
|
860
|
+
*/
|
|
861
|
+
/* estimated number of result tuples */
|
|
862
|
+
Cardinality rows;
|
|
686
863
|
|
|
687
|
-
/*
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
864
|
+
/*
|
|
865
|
+
* per-relation planner control flags
|
|
866
|
+
*/
|
|
867
|
+
/* keep cheap-startup-cost paths? */
|
|
868
|
+
bool consider_startup;
|
|
869
|
+
/* ditto, for parameterized paths? */
|
|
870
|
+
bool consider_param_startup;
|
|
871
|
+
/* consider parallel paths? */
|
|
872
|
+
bool consider_parallel;
|
|
691
873
|
|
|
692
|
-
/*
|
|
693
|
-
|
|
874
|
+
/*
|
|
875
|
+
* default result targetlist for Paths scanning this relation; list of
|
|
876
|
+
* Vars/Exprs, cost, width
|
|
877
|
+
*/
|
|
878
|
+
struct PathTarget *reltarget;
|
|
694
879
|
|
|
695
|
-
/*
|
|
880
|
+
/*
|
|
881
|
+
* materialization information
|
|
882
|
+
*/
|
|
696
883
|
List *pathlist; /* Path structures */
|
|
697
884
|
List *ppilist; /* ParamPathInfos used in pathlist */
|
|
698
885
|
List *partial_pathlist; /* partial Paths */
|
|
@@ -701,79 +888,146 @@ typedef struct RelOptInfo
|
|
|
701
888
|
struct Path *cheapest_unique_path;
|
|
702
889
|
List *cheapest_parameterized_paths;
|
|
703
890
|
|
|
704
|
-
/*
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
891
|
+
/*
|
|
892
|
+
* parameterization information needed for both base rels and join rels
|
|
893
|
+
* (see also lateral_vars and lateral_referencers)
|
|
894
|
+
*/
|
|
895
|
+
/* rels directly laterally referenced */
|
|
896
|
+
Relids direct_lateral_relids;
|
|
897
|
+
/* minimum parameterization of rel */
|
|
898
|
+
Relids lateral_relids;
|
|
708
899
|
|
|
709
|
-
/*
|
|
900
|
+
/*
|
|
901
|
+
* information about a base rel (not set for join rels!)
|
|
902
|
+
*/
|
|
710
903
|
Index relid;
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
904
|
+
/* containing tablespace */
|
|
905
|
+
Oid reltablespace;
|
|
906
|
+
/* RELATION, SUBQUERY, FUNCTION, etc */
|
|
907
|
+
RTEKind rtekind;
|
|
908
|
+
/* smallest attrno of rel (often <0) */
|
|
909
|
+
AttrNumber min_attr;
|
|
910
|
+
/* largest attrno of rel */
|
|
911
|
+
AttrNumber max_attr;
|
|
912
|
+
/* array indexed [min_attr .. max_attr] */
|
|
913
|
+
Relids *attr_needed pg_node_attr(read_write_ignore);
|
|
914
|
+
/* array indexed [min_attr .. max_attr] */
|
|
915
|
+
int32 *attr_widths pg_node_attr(read_write_ignore);
|
|
916
|
+
/* relids of outer joins that can null this baserel */
|
|
917
|
+
Relids nulling_relids;
|
|
918
|
+
/* LATERAL Vars and PHVs referenced by rel */
|
|
919
|
+
List *lateral_vars;
|
|
920
|
+
/* rels that reference this baserel laterally */
|
|
921
|
+
Relids lateral_referencers;
|
|
922
|
+
/* list of IndexOptInfo */
|
|
923
|
+
List *indexlist;
|
|
924
|
+
/* list of StatisticExtInfo */
|
|
925
|
+
List *statlist;
|
|
926
|
+
/* size estimates derived from pg_class */
|
|
927
|
+
BlockNumber pages;
|
|
722
928
|
Cardinality tuples;
|
|
723
929
|
double allvisfrac;
|
|
724
|
-
|
|
725
|
-
|
|
930
|
+
/* indexes in PlannerInfo's eq_classes list of ECs that mention this rel */
|
|
931
|
+
Bitmapset *eclass_indexes;
|
|
726
932
|
PlannerInfo *subroot; /* if subquery */
|
|
727
933
|
List *subplan_params; /* if subquery */
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
934
|
+
/* wanted number of parallel workers */
|
|
935
|
+
int rel_parallel_workers;
|
|
936
|
+
/* Bitmask of optional features supported by the table AM */
|
|
937
|
+
uint32 amflags;
|
|
938
|
+
|
|
939
|
+
/*
|
|
940
|
+
* Information about foreign tables and foreign joins
|
|
941
|
+
*/
|
|
942
|
+
/* identifies server for the table or join */
|
|
943
|
+
Oid serverid;
|
|
944
|
+
/* identifies user to check access as; 0 means to check as current user */
|
|
945
|
+
Oid userid;
|
|
946
|
+
/* join is only valid for current user */
|
|
947
|
+
bool useridiscurrent;
|
|
736
948
|
/* use "struct FdwRoutine" to avoid including fdwapi.h here */
|
|
737
|
-
struct FdwRoutine *fdwroutine;
|
|
738
|
-
void *fdw_private;
|
|
739
|
-
|
|
740
|
-
/*
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
/*
|
|
746
|
-
List *
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
bool
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
949
|
+
struct FdwRoutine *fdwroutine pg_node_attr(read_write_ignore);
|
|
950
|
+
void *fdw_private pg_node_attr(read_write_ignore);
|
|
951
|
+
|
|
952
|
+
/*
|
|
953
|
+
* cache space for remembering if we have proven this relation unique
|
|
954
|
+
*/
|
|
955
|
+
/* known unique for these other relid set(s) */
|
|
956
|
+
List *unique_for_rels;
|
|
957
|
+
/* known not unique for these set(s) */
|
|
958
|
+
List *non_unique_for_rels;
|
|
959
|
+
|
|
960
|
+
/*
|
|
961
|
+
* used by various scans and joins:
|
|
962
|
+
*/
|
|
963
|
+
/* RestrictInfo structures (if base rel) */
|
|
964
|
+
List *baserestrictinfo;
|
|
965
|
+
/* cost of evaluating the above */
|
|
966
|
+
QualCost baserestrictcost;
|
|
967
|
+
/* min security_level found in baserestrictinfo */
|
|
968
|
+
Index baserestrict_min_security;
|
|
969
|
+
/* RestrictInfo structures for join clauses involving this rel */
|
|
970
|
+
List *joininfo;
|
|
971
|
+
/* T means joininfo is incomplete */
|
|
972
|
+
bool has_eclass_joins;
|
|
973
|
+
|
|
974
|
+
/*
|
|
975
|
+
* used by partitionwise joins:
|
|
976
|
+
*/
|
|
977
|
+
/* consider partitionwise join paths? (if partitioned rel) */
|
|
978
|
+
bool consider_partitionwise_join;
|
|
979
|
+
|
|
980
|
+
/*
|
|
981
|
+
* inheritance links, if this is an otherrel (otherwise NULL):
|
|
982
|
+
*/
|
|
983
|
+
/* Immediate parent relation (dumping it would be too verbose) */
|
|
984
|
+
struct RelOptInfo *parent pg_node_attr(read_write_ignore);
|
|
985
|
+
/* Topmost parent relation (dumping it would be too verbose) */
|
|
986
|
+
struct RelOptInfo *top_parent pg_node_attr(read_write_ignore);
|
|
987
|
+
/* Relids of topmost parent (redundant, but handy) */
|
|
988
|
+
Relids top_parent_relids;
|
|
989
|
+
|
|
990
|
+
/*
|
|
991
|
+
* used for partitioned relations:
|
|
992
|
+
*/
|
|
993
|
+
/* Partitioning scheme */
|
|
994
|
+
PartitionScheme part_scheme pg_node_attr(read_write_ignore);
|
|
995
|
+
|
|
996
|
+
/*
|
|
997
|
+
* Number of partitions; -1 if not yet set; in case of a join relation 0
|
|
998
|
+
* means it's considered unpartitioned
|
|
999
|
+
*/
|
|
1000
|
+
int nparts;
|
|
1001
|
+
/* Partition bounds */
|
|
1002
|
+
struct PartitionBoundInfoData *boundinfo pg_node_attr(read_write_ignore);
|
|
1003
|
+
/* True if partition bounds were created by partition_bounds_merge() */
|
|
1004
|
+
bool partbounds_merged;
|
|
1005
|
+
/* Partition constraint, if not the root */
|
|
1006
|
+
List *partition_qual;
|
|
1007
|
+
|
|
1008
|
+
/*
|
|
1009
|
+
* Array of RelOptInfos of partitions, stored in the same order as bounds
|
|
1010
|
+
* (don't print, too bulky and duplicative)
|
|
1011
|
+
*/
|
|
1012
|
+
struct RelOptInfo **part_rels pg_node_attr(read_write_ignore);
|
|
1013
|
+
|
|
1014
|
+
/*
|
|
1015
|
+
* Bitmap with members acting as indexes into the part_rels[] array to
|
|
1016
|
+
* indicate which partitions survived partition pruning.
|
|
1017
|
+
*/
|
|
1018
|
+
Bitmapset *live_parts;
|
|
1019
|
+
/* Relids set of all partition relids */
|
|
1020
|
+
Relids all_partrels;
|
|
1021
|
+
|
|
1022
|
+
/*
|
|
1023
|
+
* These arrays are of length partkey->partnatts, which we don't have at
|
|
1024
|
+
* hand, so don't try to print
|
|
1025
|
+
*/
|
|
1026
|
+
|
|
1027
|
+
/* Non-nullable partition key expressions */
|
|
1028
|
+
List **partexprs pg_node_attr(read_write_ignore);
|
|
1029
|
+
/* Nullable partition key expressions */
|
|
1030
|
+
List **nullable_partexprs pg_node_attr(read_write_ignore);
|
|
777
1031
|
} RelOptInfo;
|
|
778
1032
|
|
|
779
1033
|
/*
|
|
@@ -834,60 +1088,104 @@ typedef struct IndexOptInfo IndexOptInfo;
|
|
|
834
1088
|
|
|
835
1089
|
struct IndexOptInfo
|
|
836
1090
|
{
|
|
1091
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
1092
|
+
|
|
837
1093
|
NodeTag type;
|
|
838
1094
|
|
|
839
|
-
|
|
840
|
-
Oid
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
/*
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
bool
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
bool
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1095
|
+
/* OID of the index relation */
|
|
1096
|
+
Oid indexoid;
|
|
1097
|
+
/* tablespace of index (not table) */
|
|
1098
|
+
Oid reltablespace;
|
|
1099
|
+
/* back-link to index's table; don't print, else infinite recursion */
|
|
1100
|
+
RelOptInfo *rel pg_node_attr(read_write_ignore);
|
|
1101
|
+
|
|
1102
|
+
/*
|
|
1103
|
+
* index-size statistics (from pg_class and elsewhere)
|
|
1104
|
+
*/
|
|
1105
|
+
/* number of disk pages in index */
|
|
1106
|
+
BlockNumber pages;
|
|
1107
|
+
/* number of index tuples in index */
|
|
1108
|
+
Cardinality tuples;
|
|
1109
|
+
/* index tree height, or -1 if unknown */
|
|
1110
|
+
int tree_height;
|
|
1111
|
+
|
|
1112
|
+
/*
|
|
1113
|
+
* index descriptor information
|
|
1114
|
+
*/
|
|
1115
|
+
/* number of columns in index */
|
|
1116
|
+
int ncolumns;
|
|
1117
|
+
/* number of key columns in index */
|
|
1118
|
+
int nkeycolumns;
|
|
1119
|
+
|
|
1120
|
+
/*
|
|
1121
|
+
* table column numbers of index's columns (both key and included
|
|
1122
|
+
* columns), or 0 for expression columns
|
|
1123
|
+
*/
|
|
1124
|
+
int *indexkeys pg_node_attr(array_size(ncolumns));
|
|
1125
|
+
/* OIDs of collations of index columns */
|
|
1126
|
+
Oid *indexcollations pg_node_attr(array_size(nkeycolumns));
|
|
1127
|
+
/* OIDs of operator families for columns */
|
|
1128
|
+
Oid *opfamily pg_node_attr(array_size(nkeycolumns));
|
|
1129
|
+
/* OIDs of opclass declared input data types */
|
|
1130
|
+
Oid *opcintype pg_node_attr(array_size(nkeycolumns));
|
|
1131
|
+
/* OIDs of btree opfamilies, if orderable. NULL if partitioned index */
|
|
1132
|
+
Oid *sortopfamily pg_node_attr(array_size(nkeycolumns));
|
|
1133
|
+
/* is sort order descending? or NULL if partitioned index */
|
|
1134
|
+
bool *reverse_sort pg_node_attr(array_size(nkeycolumns));
|
|
1135
|
+
/* do NULLs come first in the sort order? or NULL if partitioned index */
|
|
1136
|
+
bool *nulls_first pg_node_attr(array_size(nkeycolumns));
|
|
1137
|
+
/* opclass-specific options for columns */
|
|
1138
|
+
bytea **opclassoptions pg_node_attr(read_write_ignore);
|
|
1139
|
+
/* which index cols can be returned in an index-only scan? */
|
|
1140
|
+
bool *canreturn pg_node_attr(array_size(ncolumns));
|
|
1141
|
+
/* OID of the access method (in pg_am) */
|
|
1142
|
+
Oid relam;
|
|
1143
|
+
|
|
1144
|
+
/*
|
|
1145
|
+
* expressions for non-simple index columns; redundant to print since we
|
|
1146
|
+
* print indextlist
|
|
1147
|
+
*/
|
|
1148
|
+
List *indexprs pg_node_attr(read_write_ignore);
|
|
1149
|
+
/* predicate if a partial index, else NIL */
|
|
1150
|
+
List *indpred;
|
|
1151
|
+
|
|
1152
|
+
/* targetlist representing index columns */
|
|
1153
|
+
List *indextlist;
|
|
1154
|
+
|
|
1155
|
+
/*
|
|
1156
|
+
* parent relation's baserestrictinfo list, less any conditions implied by
|
|
1157
|
+
* the index's predicate (unless it's a target rel, see comments in
|
|
1158
|
+
* check_index_predicates())
|
|
1159
|
+
*/
|
|
1160
|
+
List *indrestrictinfo;
|
|
1161
|
+
|
|
1162
|
+
/* true if index predicate matches query */
|
|
1163
|
+
bool predOK;
|
|
1164
|
+
/* true if a unique index */
|
|
1165
|
+
bool unique;
|
|
1166
|
+
/* is uniqueness enforced immediately? */
|
|
1167
|
+
bool immediate;
|
|
1168
|
+
/* true if index doesn't really exist */
|
|
1169
|
+
bool hypothetical;
|
|
1170
|
+
|
|
1171
|
+
/*
|
|
1172
|
+
* Remaining fields are copied from the index AM's API struct
|
|
1173
|
+
* (IndexAmRoutine). These fields are not set for partitioned indexes.
|
|
1174
|
+
*/
|
|
1175
|
+
bool amcanorderbyop;
|
|
1176
|
+
bool amoptionalkey;
|
|
1177
|
+
bool amsearcharray;
|
|
1178
|
+
bool amsearchnulls;
|
|
1179
|
+
/* does AM have amgettuple interface? */
|
|
1180
|
+
bool amhasgettuple;
|
|
1181
|
+
/* does AM have amgetbitmap interface? */
|
|
1182
|
+
bool amhasgetbitmap;
|
|
1183
|
+
bool amcanparallel;
|
|
1184
|
+
/* does AM have ammarkpos interface? */
|
|
1185
|
+
bool amcanmarkpos;
|
|
1186
|
+
/* AM's cost estimator */
|
|
889
1187
|
/* Rather than include amapi.h here, we declare amcostestimate like this */
|
|
890
|
-
void (*amcostestimate) ();
|
|
1188
|
+
void (*amcostestimate) () pg_node_attr(read_write_ignore);
|
|
891
1189
|
};
|
|
892
1190
|
|
|
893
1191
|
/*
|
|
@@ -900,21 +1198,39 @@ struct IndexOptInfo
|
|
|
900
1198
|
*/
|
|
901
1199
|
typedef struct ForeignKeyOptInfo
|
|
902
1200
|
{
|
|
1201
|
+
pg_node_attr(custom_read_write, no_copy_equal, no_read, no_query_jumble)
|
|
1202
|
+
|
|
903
1203
|
NodeTag type;
|
|
904
1204
|
|
|
905
|
-
/*
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
/*
|
|
914
|
-
int
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
1205
|
+
/*
|
|
1206
|
+
* Basic data about the foreign key (fetched from catalogs):
|
|
1207
|
+
*/
|
|
1208
|
+
|
|
1209
|
+
/* RT index of the referencing table */
|
|
1210
|
+
Index con_relid;
|
|
1211
|
+
/* RT index of the referenced table */
|
|
1212
|
+
Index ref_relid;
|
|
1213
|
+
/* number of columns in the foreign key */
|
|
1214
|
+
int nkeys;
|
|
1215
|
+
/* cols in referencing table */
|
|
1216
|
+
AttrNumber conkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys));
|
|
1217
|
+
/* cols in referenced table */
|
|
1218
|
+
AttrNumber confkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys));
|
|
1219
|
+
/* PK = FK operator OIDs */
|
|
1220
|
+
Oid conpfeqop[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys));
|
|
1221
|
+
|
|
1222
|
+
/*
|
|
1223
|
+
* Derived info about whether FK's equality conditions match the query:
|
|
1224
|
+
*/
|
|
1225
|
+
|
|
1226
|
+
/* # of FK cols matched by ECs */
|
|
1227
|
+
int nmatched_ec;
|
|
1228
|
+
/* # of these ECs that are ec_has_const */
|
|
1229
|
+
int nconst_ec;
|
|
1230
|
+
/* # of FK cols matched by non-EC rinfos */
|
|
1231
|
+
int nmatched_rcols;
|
|
1232
|
+
/* total # of non-EC rinfos matched to FK */
|
|
1233
|
+
int nmatched_ri;
|
|
918
1234
|
/* Pointer to eclass matching each column's condition, if there is one */
|
|
919
1235
|
struct EquivalenceClass *eclass[INDEX_MAX_KEYS];
|
|
920
1236
|
/* Pointer to eclass member for the referencing Var, if there is one */
|
|
@@ -932,21 +1248,69 @@ typedef struct ForeignKeyOptInfo
|
|
|
932
1248
|
*/
|
|
933
1249
|
typedef struct StatisticExtInfo
|
|
934
1250
|
{
|
|
1251
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
1252
|
+
|
|
935
1253
|
NodeTag type;
|
|
936
1254
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1255
|
+
/* OID of the statistics row */
|
|
1256
|
+
Oid statOid;
|
|
1257
|
+
|
|
1258
|
+
/* includes child relations */
|
|
1259
|
+
bool inherit;
|
|
1260
|
+
|
|
1261
|
+
/* back-link to statistic's table; don't print, else infinite recursion */
|
|
1262
|
+
RelOptInfo *rel pg_node_attr(read_write_ignore);
|
|
1263
|
+
|
|
1264
|
+
/* statistics kind of this entry */
|
|
1265
|
+
char kind;
|
|
1266
|
+
|
|
1267
|
+
/* attnums of the columns covered */
|
|
1268
|
+
Bitmapset *keys;
|
|
1269
|
+
|
|
1270
|
+
/* expressions */
|
|
1271
|
+
List *exprs;
|
|
943
1272
|
} StatisticExtInfo;
|
|
944
1273
|
|
|
1274
|
+
/*
|
|
1275
|
+
* JoinDomains
|
|
1276
|
+
*
|
|
1277
|
+
* A "join domain" defines the scope of applicability of deductions made via
|
|
1278
|
+
* the EquivalenceClass mechanism. Roughly speaking, a join domain is a set
|
|
1279
|
+
* of base+OJ relations that are inner-joined together. More precisely, it is
|
|
1280
|
+
* the set of relations at which equalities deduced from an EquivalenceClass
|
|
1281
|
+
* can be enforced or should be expected to hold. The topmost JoinDomain
|
|
1282
|
+
* covers the whole query (so its jd_relids should equal all_query_rels).
|
|
1283
|
+
* An outer join creates a new JoinDomain that includes all base+OJ relids
|
|
1284
|
+
* within its nullable side, but (by convention) not the OJ's own relid.
|
|
1285
|
+
* A FULL join creates two new JoinDomains, one for each side.
|
|
1286
|
+
*
|
|
1287
|
+
* Notice that a rel that is below outer join(s) will thus appear to belong
|
|
1288
|
+
* to multiple join domains. However, any of its Vars that appear in
|
|
1289
|
+
* EquivalenceClasses belonging to higher join domains will have nullingrel
|
|
1290
|
+
* bits preventing them from being evaluated at the rel's scan level, so that
|
|
1291
|
+
* we will not be able to derive enforceable-at-the-rel-scan-level clauses
|
|
1292
|
+
* from such ECs. We define the join domain relid sets this way so that
|
|
1293
|
+
* domains can be said to be "higher" or "lower" when one domain relid set
|
|
1294
|
+
* includes another.
|
|
1295
|
+
*
|
|
1296
|
+
* The JoinDomains for a query are computed in deconstruct_jointree.
|
|
1297
|
+
* We do not copy JoinDomain structs once made, so they can be compared
|
|
1298
|
+
* for equality by simple pointer equality.
|
|
1299
|
+
*/
|
|
1300
|
+
typedef struct JoinDomain
|
|
1301
|
+
{
|
|
1302
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
1303
|
+
|
|
1304
|
+
NodeTag type;
|
|
1305
|
+
|
|
1306
|
+
Relids jd_relids; /* all relids contained within the domain */
|
|
1307
|
+
} JoinDomain;
|
|
1308
|
+
|
|
945
1309
|
/*
|
|
946
1310
|
* EquivalenceClasses
|
|
947
1311
|
*
|
|
948
|
-
* Whenever we
|
|
949
|
-
* not
|
|
1312
|
+
* Whenever we identify a mergejoinable equality clause A = B that is
|
|
1313
|
+
* not an outer-join clause, we create an EquivalenceClass containing
|
|
950
1314
|
* the expressions A and B to record this knowledge. If we later find another
|
|
951
1315
|
* equivalence B = C, we add C to the existing EquivalenceClass; this may
|
|
952
1316
|
* require merging two existing EquivalenceClasses. At the end of the qual
|
|
@@ -960,6 +1324,18 @@ typedef struct StatisticExtInfo
|
|
|
960
1324
|
* that all or none of the input datatypes are collatable, so that a single
|
|
961
1325
|
* collation value is sufficient.)
|
|
962
1326
|
*
|
|
1327
|
+
* Strictly speaking, deductions from an EquivalenceClass hold only within
|
|
1328
|
+
* a "join domain", that is a set of relations that are innerjoined together
|
|
1329
|
+
* (see JoinDomain above). For the most part we don't need to account for
|
|
1330
|
+
* this explicitly, because equality clauses from different join domains
|
|
1331
|
+
* will contain Vars that are not equal() because they have different
|
|
1332
|
+
* nullingrel sets, and thus we will never falsely merge ECs from different
|
|
1333
|
+
* join domains. But Var-free (pseudoconstant) expressions lack that safety
|
|
1334
|
+
* feature. We handle that by marking "const" EC members with the JoinDomain
|
|
1335
|
+
* of the clause they came from; two nominally-equal const members will be
|
|
1336
|
+
* considered different if they came from different JoinDomains. This ensures
|
|
1337
|
+
* no false EquivalenceClass merges will occur.
|
|
1338
|
+
*
|
|
963
1339
|
* We also use EquivalenceClasses as the base structure for PathKeys, letting
|
|
964
1340
|
* us represent knowledge about different sort orderings being equivalent.
|
|
965
1341
|
* Since every PathKey must reference an EquivalenceClass, we will end up
|
|
@@ -974,16 +1350,19 @@ typedef struct StatisticExtInfo
|
|
|
974
1350
|
* entry: consider SELECT random() AS a, random() AS b ... ORDER BY b,a.
|
|
975
1351
|
* So we record the SortGroupRef of the originating sort clause.
|
|
976
1352
|
*
|
|
977
|
-
* We allow equality clauses appearing below the nullable side of an outer join
|
|
978
|
-
* to form EquivalenceClasses, but these have a slightly different meaning:
|
|
979
|
-
* the included values might be all NULL rather than all the same non-null
|
|
980
|
-
* values. See src/backend/optimizer/README for more on that point.
|
|
981
|
-
*
|
|
982
1353
|
* NB: if ec_merged isn't NULL, this class has been merged into another, and
|
|
983
1354
|
* should be ignored in favor of using the pointed-to class.
|
|
1355
|
+
*
|
|
1356
|
+
* NB: EquivalenceClasses are never copied after creation. Therefore,
|
|
1357
|
+
* copyObject() copies pointers to them as pointers, and equal() compares
|
|
1358
|
+
* pointers to EquivalenceClasses via pointer equality. This is implemented
|
|
1359
|
+
* by putting copy_as_scalar and equal_as_scalar attributes on fields that
|
|
1360
|
+
* are pointers to EquivalenceClasses. The same goes for EquivalenceMembers.
|
|
984
1361
|
*/
|
|
985
1362
|
typedef struct EquivalenceClass
|
|
986
1363
|
{
|
|
1364
|
+
pg_node_attr(custom_read_write, no_copy_equal, no_read, no_query_jumble)
|
|
1365
|
+
|
|
987
1366
|
NodeTag type;
|
|
988
1367
|
|
|
989
1368
|
List *ec_opfamilies; /* btree operator family OIDs */
|
|
@@ -995,7 +1374,6 @@ typedef struct EquivalenceClass
|
|
|
995
1374
|
* for child members (see below) */
|
|
996
1375
|
bool ec_has_const; /* any pseudoconstants in ec_members? */
|
|
997
1376
|
bool ec_has_volatile; /* the (sole) member is a volatile expr */
|
|
998
|
-
bool ec_below_outer_join; /* equivalence applies below an OJ */
|
|
999
1377
|
bool ec_broken; /* failed to generate needed clauses? */
|
|
1000
1378
|
Index ec_sortref; /* originating sortclause label, or 0 */
|
|
1001
1379
|
Index ec_min_security; /* minimum security_level in ec_sources */
|
|
@@ -1004,11 +1382,11 @@ typedef struct EquivalenceClass
|
|
|
1004
1382
|
} EquivalenceClass;
|
|
1005
1383
|
|
|
1006
1384
|
/*
|
|
1007
|
-
* If an EC contains a
|
|
1008
|
-
*
|
|
1385
|
+
* If an EC contains a constant, any PathKey depending on it must be
|
|
1386
|
+
* redundant, since there's only one possible value of the key.
|
|
1009
1387
|
*/
|
|
1010
1388
|
#define EC_MUST_BE_REDUNDANT(eclass) \
|
|
1011
|
-
((eclass)->ec_has_const
|
|
1389
|
+
((eclass)->ec_has_const)
|
|
1012
1390
|
|
|
1013
1391
|
/*
|
|
1014
1392
|
* EquivalenceMember - one member expression of an EquivalenceClass
|
|
@@ -1034,14 +1412,18 @@ typedef struct EquivalenceClass
|
|
|
1034
1412
|
*/
|
|
1035
1413
|
typedef struct EquivalenceMember
|
|
1036
1414
|
{
|
|
1415
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
1416
|
+
|
|
1037
1417
|
NodeTag type;
|
|
1038
1418
|
|
|
1039
1419
|
Expr *em_expr; /* the expression represented */
|
|
1040
1420
|
Relids em_relids; /* all relids appearing in em_expr */
|
|
1041
|
-
Relids em_nullable_relids; /* nullable by lower outer joins */
|
|
1042
1421
|
bool em_is_const; /* expression is pseudoconstant? */
|
|
1043
1422
|
bool em_is_child; /* derived version for a child relation? */
|
|
1044
1423
|
Oid em_datatype; /* the "nominal type" used by the opfamily */
|
|
1424
|
+
JoinDomain *em_jdomain; /* join domain containing the source clause */
|
|
1425
|
+
/* if em_is_child is true, this links to corresponding EM for top parent */
|
|
1426
|
+
struct EquivalenceMember *em_parent pg_node_attr(read_write_ignore);
|
|
1045
1427
|
} EquivalenceMember;
|
|
1046
1428
|
|
|
1047
1429
|
/*
|
|
@@ -1063,9 +1445,12 @@ typedef struct EquivalenceMember
|
|
|
1063
1445
|
*/
|
|
1064
1446
|
typedef struct PathKey
|
|
1065
1447
|
{
|
|
1448
|
+
pg_node_attr(no_read, no_query_jumble)
|
|
1449
|
+
|
|
1066
1450
|
NodeTag type;
|
|
1067
1451
|
|
|
1068
|
-
|
|
1452
|
+
/* the value that is ordered */
|
|
1453
|
+
EquivalenceClass *pk_eclass pg_node_attr(copy_as_scalar, equal_as_scalar);
|
|
1069
1454
|
Oid pk_opfamily; /* btree opfamily defining the ordering */
|
|
1070
1455
|
int pk_strategy; /* sort direction (ASC or DESC) */
|
|
1071
1456
|
bool pk_nulls_first; /* do NULLs come before normal values? */
|
|
@@ -1108,13 +1493,24 @@ typedef enum VolatileFunctionStatus
|
|
|
1108
1493
|
*/
|
|
1109
1494
|
typedef struct PathTarget
|
|
1110
1495
|
{
|
|
1496
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
1497
|
+
|
|
1111
1498
|
NodeTag type;
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1499
|
+
|
|
1500
|
+
/* list of expressions to be computed */
|
|
1501
|
+
List *exprs;
|
|
1502
|
+
|
|
1503
|
+
/* corresponding sort/group refnos, or 0 */
|
|
1504
|
+
Index *sortgrouprefs pg_node_attr(array_size(exprs));
|
|
1505
|
+
|
|
1506
|
+
/* cost of evaluating the expressions */
|
|
1507
|
+
QualCost cost;
|
|
1508
|
+
|
|
1509
|
+
/* estimated avg width of result tuples */
|
|
1510
|
+
int width;
|
|
1511
|
+
|
|
1512
|
+
/* indicates if exprs contain any volatile functions */
|
|
1513
|
+
VolatileFunctionStatus has_volatile_expr;
|
|
1118
1514
|
} PathTarget;
|
|
1119
1515
|
|
|
1120
1516
|
/* Convenience macro to get a sort/group refno from a PathTarget */
|
|
@@ -1134,15 +1530,24 @@ typedef struct PathTarget
|
|
|
1134
1530
|
* Note: ppi_clauses is only used in ParamPathInfos for base relation paths;
|
|
1135
1531
|
* in join cases it's NIL because the set of relevant clauses varies depending
|
|
1136
1532
|
* on how the join is formed. The relevant clauses will appear in each
|
|
1137
|
-
* parameterized join path's joinrestrictinfo list, instead.
|
|
1533
|
+
* parameterized join path's joinrestrictinfo list, instead. ParamPathInfos
|
|
1534
|
+
* for append relations don't bother with this, either.
|
|
1535
|
+
*
|
|
1536
|
+
* ppi_serials is the set of rinfo_serial numbers for quals that are enforced
|
|
1537
|
+
* by this path. As with ppi_clauses, it's only maintained for baserels.
|
|
1538
|
+
* (We could construct it on-the-fly from ppi_clauses, but it seems better
|
|
1539
|
+
* to materialize a copy.)
|
|
1138
1540
|
*/
|
|
1139
1541
|
typedef struct ParamPathInfo
|
|
1140
1542
|
{
|
|
1543
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
1544
|
+
|
|
1141
1545
|
NodeTag type;
|
|
1142
1546
|
|
|
1143
1547
|
Relids ppi_req_outer; /* rels supplying parameters used by path */
|
|
1144
1548
|
Cardinality ppi_rows; /* estimated number of result tuples */
|
|
1145
1549
|
List *ppi_clauses; /* join clauses available from outer rels */
|
|
1550
|
+
Bitmapset *ppi_serials; /* set of rinfo_serial for enforced quals */
|
|
1146
1551
|
} ParamPathInfo;
|
|
1147
1552
|
|
|
1148
1553
|
|
|
@@ -1174,29 +1579,58 @@ typedef struct ParamPathInfo
|
|
|
1174
1579
|
*
|
|
1175
1580
|
* "pathkeys" is a List of PathKey nodes (see above), describing the sort
|
|
1176
1581
|
* ordering of the path's output rows.
|
|
1582
|
+
*
|
|
1583
|
+
* We do not support copying Path trees, mainly because the circular linkages
|
|
1584
|
+
* between RelOptInfo and Path nodes can't be handled easily in a simple
|
|
1585
|
+
* depth-first traversal. We also don't have read support at the moment.
|
|
1177
1586
|
*/
|
|
1178
1587
|
typedef struct Path
|
|
1179
1588
|
{
|
|
1589
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
1590
|
+
|
|
1180
1591
|
NodeTag type;
|
|
1181
1592
|
|
|
1182
|
-
|
|
1593
|
+
/* tag identifying scan/join method */
|
|
1594
|
+
NodeTag pathtype;
|
|
1595
|
+
|
|
1596
|
+
/*
|
|
1597
|
+
* the relation this path can build
|
|
1598
|
+
*
|
|
1599
|
+
* We do NOT print the parent, else we'd be in infinite recursion. We can
|
|
1600
|
+
* print the parent's relids for identification purposes, though.
|
|
1601
|
+
*/
|
|
1602
|
+
RelOptInfo *parent pg_node_attr(write_only_relids);
|
|
1183
1603
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1604
|
+
/*
|
|
1605
|
+
* list of Vars/Exprs, cost, width
|
|
1606
|
+
*
|
|
1607
|
+
* We print the pathtarget only if it's not the default one for the rel.
|
|
1608
|
+
*/
|
|
1609
|
+
PathTarget *pathtarget pg_node_attr(write_only_nondefault_pathtarget);
|
|
1186
1610
|
|
|
1187
|
-
|
|
1611
|
+
/*
|
|
1612
|
+
* parameterization info, or NULL if none
|
|
1613
|
+
*
|
|
1614
|
+
* We do not print the whole of param_info, since it's printed via
|
|
1615
|
+
* RelOptInfo; it's sufficient and less cluttering to print just the
|
|
1616
|
+
* required outer relids.
|
|
1617
|
+
*/
|
|
1618
|
+
ParamPathInfo *param_info pg_node_attr(write_only_req_outer);
|
|
1188
1619
|
|
|
1189
|
-
|
|
1190
|
-
bool
|
|
1191
|
-
|
|
1620
|
+
/* engage parallel-aware logic? */
|
|
1621
|
+
bool parallel_aware;
|
|
1622
|
+
/* OK to use as part of parallel plan? */
|
|
1623
|
+
bool parallel_safe;
|
|
1624
|
+
/* desired # of workers; 0 = not parallel */
|
|
1625
|
+
int parallel_workers;
|
|
1192
1626
|
|
|
1193
1627
|
/* estimated size/costs for path (see costsize.c for more info) */
|
|
1194
1628
|
Cardinality rows; /* estimated number of result tuples */
|
|
1195
1629
|
Cost startup_cost; /* cost expended before fetching any tuples */
|
|
1196
1630
|
Cost total_cost; /* total cost (assuming all tuples fetched) */
|
|
1197
1631
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1632
|
+
/* sort ordering of path's output; a List of PathKey nodes; see above */
|
|
1633
|
+
List *pathkeys;
|
|
1200
1634
|
} Path;
|
|
1201
1635
|
|
|
1202
1636
|
/* Macro for extracting a path's parameterization relids; beware double eval */
|
|
@@ -1228,12 +1662,9 @@ typedef struct Path
|
|
|
1228
1662
|
* on which index column each ORDER BY can be used with.)
|
|
1229
1663
|
*
|
|
1230
1664
|
* 'indexscandir' is one of:
|
|
1231
|
-
* ForwardScanDirection: forward scan of an
|
|
1665
|
+
* ForwardScanDirection: forward scan of an index
|
|
1232
1666
|
* BackwardScanDirection: backward scan of an ordered index
|
|
1233
|
-
*
|
|
1234
|
-
* (The executor doesn't care whether it gets ForwardScanDirection or
|
|
1235
|
-
* NoMovementScanDirection for an indexscan, but the planner wants to
|
|
1236
|
-
* distinguish ordered from unordered indexes for building pathkeys.)
|
|
1667
|
+
* Unordered indexes will always have an indexscandir of ForwardScanDirection.
|
|
1237
1668
|
*
|
|
1238
1669
|
* 'indextotalcost' and 'indexselectivity' are saved in the IndexPath so that
|
|
1239
1670
|
* we need not recompute them when considering using the same index in a
|
|
@@ -1289,6 +1720,8 @@ typedef struct IndexPath
|
|
|
1289
1720
|
*/
|
|
1290
1721
|
typedef struct IndexClause
|
|
1291
1722
|
{
|
|
1723
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
1724
|
+
|
|
1292
1725
|
NodeTag type;
|
|
1293
1726
|
struct RestrictInfo *rinfo; /* original restriction or join clause */
|
|
1294
1727
|
List *indexquals; /* indexqual(s) derived from it */
|
|
@@ -1403,15 +1836,18 @@ typedef struct ForeignPath
|
|
|
1403
1836
|
} ForeignPath;
|
|
1404
1837
|
|
|
1405
1838
|
/*
|
|
1406
|
-
* CustomPath represents a table scan done by some out-of-core
|
|
1839
|
+
* CustomPath represents a table scan or a table join done by some out-of-core
|
|
1840
|
+
* extension.
|
|
1407
1841
|
*
|
|
1408
1842
|
* We provide a set of hooks here - which the provider must take care to set
|
|
1409
1843
|
* up correctly - to allow extensions to supply their own methods of scanning
|
|
1410
|
-
* a relation. For example, a provider might provide GPU
|
|
1411
|
-
* cache-based scan, or some other kind of logic we haven't
|
|
1844
|
+
* a relation or joing relations. For example, a provider might provide GPU
|
|
1845
|
+
* acceleration, a cache-based scan, or some other kind of logic we haven't
|
|
1846
|
+
* dreamed up yet.
|
|
1412
1847
|
*
|
|
1413
|
-
* CustomPaths can be injected into the planning process for a
|
|
1414
|
-
* set_rel_pathlist_hook functions
|
|
1848
|
+
* CustomPaths can be injected into the planning process for a base or join
|
|
1849
|
+
* relation by set_rel_pathlist_hook or set_join_pathlist_hook functions,
|
|
1850
|
+
* respectively.
|
|
1415
1851
|
*
|
|
1416
1852
|
* Core code must avoid assuming that the CustomPath is only as large as
|
|
1417
1853
|
* the structure declared here; providers are allowed to make it the first
|
|
@@ -1513,8 +1949,8 @@ typedef struct MemoizePath
|
|
|
1513
1949
|
{
|
|
1514
1950
|
Path path;
|
|
1515
1951
|
Path *subpath; /* outerpath to cache tuples from */
|
|
1516
|
-
List *hash_operators; /* hash
|
|
1517
|
-
List *param_exprs; /* cache keys */
|
|
1952
|
+
List *hash_operators; /* OIDs of hash equality ops for cache keys */
|
|
1953
|
+
List *param_exprs; /* expressions that are cache keys */
|
|
1518
1954
|
bool singlerow; /* true if the cache entry is to be marked as
|
|
1519
1955
|
* complete after caching the first record. */
|
|
1520
1956
|
bool binary_mode; /* true when cache key should be compared bit
|
|
@@ -1584,6 +2020,8 @@ typedef struct GatherMergePath
|
|
|
1584
2020
|
|
|
1585
2021
|
typedef struct JoinPath
|
|
1586
2022
|
{
|
|
2023
|
+
pg_node_attr(abstract)
|
|
2024
|
+
|
|
1587
2025
|
Path path;
|
|
1588
2026
|
|
|
1589
2027
|
JoinType jointype;
|
|
@@ -1786,6 +2224,8 @@ typedef struct AggPath
|
|
|
1786
2224
|
|
|
1787
2225
|
typedef struct GroupingSetData
|
|
1788
2226
|
{
|
|
2227
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
2228
|
+
|
|
1789
2229
|
NodeTag type;
|
|
1790
2230
|
List *set; /* grouping set as list of sortgrouprefs */
|
|
1791
2231
|
Cardinality numGroups; /* est. number of result groups */
|
|
@@ -1793,6 +2233,8 @@ typedef struct GroupingSetData
|
|
|
1793
2233
|
|
|
1794
2234
|
typedef struct RollupData
|
|
1795
2235
|
{
|
|
2236
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
2237
|
+
|
|
1796
2238
|
NodeTag type;
|
|
1797
2239
|
List *groupClause; /* applicable subset of parse->groupClause */
|
|
1798
2240
|
List *gsets; /* lists of integer indexes into groupClause */
|
|
@@ -1892,7 +2334,7 @@ typedef struct ModifyTablePath
|
|
|
1892
2334
|
CmdType operation; /* INSERT, UPDATE, DELETE, or MERGE */
|
|
1893
2335
|
bool canSetTag; /* do we set the command tag/es_processed? */
|
|
1894
2336
|
Index nominalRelation; /* Parent RT index for use of EXPLAIN */
|
|
1895
|
-
Index rootRelation; /* Root RT index, if
|
|
2337
|
+
Index rootRelation; /* Root RT index, if partitioned/inherited */
|
|
1896
2338
|
bool partColsUpdated; /* some part key in hierarchy updated? */
|
|
1897
2339
|
List *resultRelations; /* integer list of RT indexes */
|
|
1898
2340
|
List *updateColnosLists; /* per-target-table update_colnos lists */
|
|
@@ -1930,17 +2372,17 @@ typedef struct LimitPath
|
|
|
1930
2372
|
* If a restriction clause references a single base relation, it will appear
|
|
1931
2373
|
* in the baserestrictinfo list of the RelOptInfo for that base rel.
|
|
1932
2374
|
*
|
|
1933
|
-
* If a restriction clause references more than one base
|
|
2375
|
+
* If a restriction clause references more than one base+OJ relation, it will
|
|
1934
2376
|
* appear in the joininfo list of every RelOptInfo that describes a strict
|
|
1935
|
-
* subset of the
|
|
2377
|
+
* subset of the relations mentioned in the clause. The joininfo lists are
|
|
1936
2378
|
* used to drive join tree building by selecting plausible join candidates.
|
|
1937
2379
|
* The clause cannot actually be applied until we have built a join rel
|
|
1938
|
-
* containing all the
|
|
2380
|
+
* containing all the relations it references, however.
|
|
1939
2381
|
*
|
|
1940
|
-
* When we construct a join rel that includes all the
|
|
2382
|
+
* When we construct a join rel that includes all the relations referenced
|
|
1941
2383
|
* in a multi-relation restriction clause, we place that clause into the
|
|
1942
2384
|
* joinrestrictinfo lists of paths for the join rel, if neither left nor
|
|
1943
|
-
* right sub-path includes all
|
|
2385
|
+
* right sub-path includes all relations referenced in the clause. The clause
|
|
1944
2386
|
* will be applied at that join level, and will not propagate any further up
|
|
1945
2387
|
* the join tree. (Note: the "predicate migration" code was once intended to
|
|
1946
2388
|
* push restriction clauses up and down the plan tree based on evaluation
|
|
@@ -1961,12 +2403,14 @@ typedef struct LimitPath
|
|
|
1961
2403
|
* or join to enforce that all members of each EquivalenceClass are in fact
|
|
1962
2404
|
* equal in all rows emitted by the scan or join.
|
|
1963
2405
|
*
|
|
1964
|
-
*
|
|
1965
|
-
*
|
|
1966
|
-
*
|
|
1967
|
-
*
|
|
1968
|
-
*
|
|
1969
|
-
*
|
|
2406
|
+
* The clause_relids field lists the base plus outer-join RT indexes that
|
|
2407
|
+
* actually appear in the clause. required_relids lists the minimum set of
|
|
2408
|
+
* relids needed to evaluate the clause; while this is often equal to
|
|
2409
|
+
* clause_relids, it can be more. We will add relids to required_relids when
|
|
2410
|
+
* we need to force an outer join ON clause to be evaluated exactly at the
|
|
2411
|
+
* level of the outer join, which is true except when it is a "degenerate"
|
|
2412
|
+
* condition that references only Vars from the nullable side of the join.
|
|
2413
|
+
*
|
|
1970
2414
|
* RestrictInfo nodes contain a flag to indicate whether a qual has been
|
|
1971
2415
|
* pushed down to a lower level than its original syntactic placement in the
|
|
1972
2416
|
* join tree would suggest. If an outer join prevents us from pushing a qual
|
|
@@ -1989,10 +2433,14 @@ typedef struct LimitPath
|
|
|
1989
2433
|
* conditions. Possibly we should rename it to reflect that meaning? But
|
|
1990
2434
|
* see also the comments for RINFO_IS_PUSHED_DOWN, below.)
|
|
1991
2435
|
*
|
|
1992
|
-
*
|
|
1993
|
-
*
|
|
1994
|
-
*
|
|
1995
|
-
*
|
|
2436
|
+
* There is also an incompatible_relids field, which is a set of outer-join
|
|
2437
|
+
* relids above which we cannot evaluate the clause (because they might null
|
|
2438
|
+
* Vars it uses that should not be nulled yet). In principle this could be
|
|
2439
|
+
* filled in any RestrictInfo as the set of OJ relids that appear above the
|
|
2440
|
+
* clause and null Vars that it uses. In practice we only bother to populate
|
|
2441
|
+
* it for "clone" clauses, as it's currently only needed to prevent multiple
|
|
2442
|
+
* clones of the same clause from being accepted for evaluation at the same
|
|
2443
|
+
* join level.
|
|
1996
2444
|
*
|
|
1997
2445
|
* There is also an outer_relids field, which is NULL except for outer join
|
|
1998
2446
|
* clauses; for those, it is the set of relids on the outer side of the
|
|
@@ -2000,15 +2448,6 @@ typedef struct LimitPath
|
|
|
2000
2448
|
* in parameterized scans, since pushing it into the join's outer side would
|
|
2001
2449
|
* lead to wrong answers.)
|
|
2002
2450
|
*
|
|
2003
|
-
* There is also a nullable_relids field, which is the set of rels the clause
|
|
2004
|
-
* references that can be forced null by some outer join below the clause.
|
|
2005
|
-
*
|
|
2006
|
-
* outerjoin_delayed = true is subtly different from nullable_relids != NULL:
|
|
2007
|
-
* a clause might reference some nullable rels and yet not be
|
|
2008
|
-
* outerjoin_delayed because it also references all the other rels of the
|
|
2009
|
-
* outer join(s). A clause that is not outerjoin_delayed can be enforced
|
|
2010
|
-
* anywhere it is computable.
|
|
2011
|
-
*
|
|
2012
2451
|
* To handle security-barrier conditions efficiently, we mark RestrictInfo
|
|
2013
2452
|
* nodes with a security_level field, in which higher values identify clauses
|
|
2014
2453
|
* coming from less-trusted sources. The exact semantics are that a clause
|
|
@@ -2051,89 +2490,174 @@ typedef struct LimitPath
|
|
|
2051
2490
|
* or merge or hash join clause, so it's of no interest to large parts of
|
|
2052
2491
|
* the planner.
|
|
2053
2492
|
*
|
|
2493
|
+
* When we generate multiple versions of a clause so as to have versions
|
|
2494
|
+
* that will work after commuting some left joins per outer join identity 3,
|
|
2495
|
+
* we mark the one with the fewest nullingrels bits with has_clone = true,
|
|
2496
|
+
* and the rest with is_clone = true. This allows proper filtering of
|
|
2497
|
+
* these redundant clauses, so that we apply only one version of them.
|
|
2498
|
+
*
|
|
2054
2499
|
* When join clauses are generated from EquivalenceClasses, there may be
|
|
2055
2500
|
* several equally valid ways to enforce join equivalence, of which we need
|
|
2056
2501
|
* apply only one. We mark clauses of this kind by setting parent_ec to
|
|
2057
2502
|
* point to the generating EquivalenceClass. Multiple clauses with the same
|
|
2058
2503
|
* parent_ec in the same join are redundant.
|
|
2504
|
+
*
|
|
2505
|
+
* Most fields are ignored for equality, since they may not be set yet, and
|
|
2506
|
+
* should be derivable from the clause anyway.
|
|
2507
|
+
*
|
|
2508
|
+
* parent_ec, left_ec, right_ec are not printed, lest it lead to infinite
|
|
2509
|
+
* recursion in plan tree dump.
|
|
2059
2510
|
*/
|
|
2060
2511
|
|
|
2061
2512
|
typedef struct RestrictInfo
|
|
2062
2513
|
{
|
|
2514
|
+
pg_node_attr(no_read, no_query_jumble)
|
|
2515
|
+
|
|
2063
2516
|
NodeTag type;
|
|
2064
2517
|
|
|
2065
|
-
|
|
2518
|
+
/* the represented clause of WHERE or JOIN */
|
|
2519
|
+
Expr *clause;
|
|
2066
2520
|
|
|
2067
|
-
|
|
2521
|
+
/* true if clause was pushed down in level */
|
|
2522
|
+
bool is_pushed_down;
|
|
2068
2523
|
|
|
2069
|
-
|
|
2524
|
+
/* see comment above */
|
|
2525
|
+
bool can_join pg_node_attr(equal_ignore);
|
|
2070
2526
|
|
|
2071
|
-
|
|
2527
|
+
/* see comment above */
|
|
2528
|
+
bool pseudoconstant pg_node_attr(equal_ignore);
|
|
2072
2529
|
|
|
2073
|
-
|
|
2530
|
+
/* see comment above */
|
|
2531
|
+
bool has_clone;
|
|
2532
|
+
bool is_clone;
|
|
2074
2533
|
|
|
2075
|
-
|
|
2534
|
+
/* true if known to contain no leaked Vars */
|
|
2535
|
+
bool leakproof pg_node_attr(equal_ignore);
|
|
2076
2536
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2537
|
+
/* indicates if clause contains any volatile functions */
|
|
2538
|
+
VolatileFunctionStatus has_volatile pg_node_attr(equal_ignore);
|
|
2079
2539
|
|
|
2080
|
-
|
|
2540
|
+
/* see comment above */
|
|
2541
|
+
Index security_level;
|
|
2081
2542
|
|
|
2082
|
-
/*
|
|
2083
|
-
|
|
2543
|
+
/* number of base rels in clause_relids */
|
|
2544
|
+
int num_base_rels pg_node_attr(equal_ignore);
|
|
2545
|
+
|
|
2546
|
+
/* The relids (varnos+varnullingrels) actually referenced in the clause: */
|
|
2547
|
+
Relids clause_relids pg_node_attr(equal_ignore);
|
|
2084
2548
|
|
|
2085
2549
|
/* The set of relids required to evaluate the clause: */
|
|
2086
2550
|
Relids required_relids;
|
|
2087
2551
|
|
|
2552
|
+
/* Relids above which we cannot evaluate the clause (see comment above) */
|
|
2553
|
+
Relids incompatible_relids;
|
|
2554
|
+
|
|
2088
2555
|
/* If an outer-join clause, the outer-side relations, else NULL: */
|
|
2089
2556
|
Relids outer_relids;
|
|
2090
2557
|
|
|
2091
|
-
/*
|
|
2092
|
-
|
|
2558
|
+
/*
|
|
2559
|
+
* Relids in the left/right side of the clause. These fields are set for
|
|
2560
|
+
* any binary opclause.
|
|
2561
|
+
*/
|
|
2562
|
+
Relids left_relids pg_node_attr(equal_ignore);
|
|
2563
|
+
Relids right_relids pg_node_attr(equal_ignore);
|
|
2564
|
+
|
|
2565
|
+
/*
|
|
2566
|
+
* Modified clause with RestrictInfos. This field is NULL unless clause
|
|
2567
|
+
* is an OR clause.
|
|
2568
|
+
*/
|
|
2569
|
+
Expr *orclause pg_node_attr(equal_ignore);
|
|
2570
|
+
|
|
2571
|
+
/*----------
|
|
2572
|
+
* Serial number of this RestrictInfo. This is unique within the current
|
|
2573
|
+
* PlannerInfo context, with a few critical exceptions:
|
|
2574
|
+
* 1. When we generate multiple clones of the same qual condition to
|
|
2575
|
+
* cope with outer join identity 3, all the clones get the same serial
|
|
2576
|
+
* number. This reflects that we only want to apply one of them in any
|
|
2577
|
+
* given plan.
|
|
2578
|
+
* 2. If we manufacture a commuted version of a qual to use as an index
|
|
2579
|
+
* condition, it copies the original's rinfo_serial, since it is in
|
|
2580
|
+
* practice the same condition.
|
|
2581
|
+
* 3. RestrictInfos made for a child relation copy their parent's
|
|
2582
|
+
* rinfo_serial. Likewise, when an EquivalenceClass makes a derived
|
|
2583
|
+
* equality clause for a child relation, it copies the rinfo_serial of
|
|
2584
|
+
* the matching equality clause for the parent. This allows detection
|
|
2585
|
+
* of redundant pushed-down equality clauses.
|
|
2586
|
+
*----------
|
|
2587
|
+
*/
|
|
2588
|
+
int rinfo_serial;
|
|
2589
|
+
|
|
2590
|
+
/*
|
|
2591
|
+
* Generating EquivalenceClass. This field is NULL unless clause is
|
|
2592
|
+
* potentially redundant.
|
|
2593
|
+
*/
|
|
2594
|
+
EquivalenceClass *parent_ec pg_node_attr(copy_as_scalar, equal_ignore, read_write_ignore);
|
|
2595
|
+
|
|
2596
|
+
/*
|
|
2597
|
+
* cache space for cost and selectivity
|
|
2598
|
+
*/
|
|
2093
2599
|
|
|
2094
|
-
/*
|
|
2095
|
-
|
|
2096
|
-
Relids right_relids; /* relids in right side of clause */
|
|
2600
|
+
/* eval cost of clause; -1 if not yet set */
|
|
2601
|
+
QualCost eval_cost pg_node_attr(equal_ignore);
|
|
2097
2602
|
|
|
2098
|
-
/*
|
|
2099
|
-
|
|
2603
|
+
/* selectivity for "normal" (JOIN_INNER) semantics; -1 if not yet set */
|
|
2604
|
+
Selectivity norm_selec pg_node_attr(equal_ignore);
|
|
2605
|
+
/* selectivity for outer join semantics; -1 if not yet set */
|
|
2606
|
+
Selectivity outer_selec pg_node_attr(equal_ignore);
|
|
2100
2607
|
|
|
2101
|
-
/*
|
|
2102
|
-
|
|
2608
|
+
/*
|
|
2609
|
+
* opfamilies containing clause operator; valid if clause is
|
|
2610
|
+
* mergejoinable, else NIL
|
|
2611
|
+
*/
|
|
2612
|
+
List *mergeopfamilies pg_node_attr(equal_ignore);
|
|
2103
2613
|
|
|
2104
|
-
/*
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
* semantics; -1 if not yet set; >1 means a
|
|
2108
|
-
* redundant clause */
|
|
2109
|
-
Selectivity outer_selec; /* selectivity for outer join semantics; -1 if
|
|
2110
|
-
* not yet set */
|
|
2614
|
+
/*
|
|
2615
|
+
* cache space for mergeclause processing; NULL if not yet set
|
|
2616
|
+
*/
|
|
2111
2617
|
|
|
2112
|
-
/*
|
|
2113
|
-
|
|
2618
|
+
/* EquivalenceClass containing lefthand */
|
|
2619
|
+
EquivalenceClass *left_ec pg_node_attr(copy_as_scalar, equal_ignore, read_write_ignore);
|
|
2620
|
+
/* EquivalenceClass containing righthand */
|
|
2621
|
+
EquivalenceClass *right_ec pg_node_attr(copy_as_scalar, equal_ignore, read_write_ignore);
|
|
2622
|
+
/* EquivalenceMember for lefthand */
|
|
2623
|
+
EquivalenceMember *left_em pg_node_attr(copy_as_scalar, equal_ignore);
|
|
2624
|
+
/* EquivalenceMember for righthand */
|
|
2625
|
+
EquivalenceMember *right_em pg_node_attr(copy_as_scalar, equal_ignore);
|
|
2114
2626
|
|
|
2115
|
-
/*
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
List *scansel_cache
|
|
2627
|
+
/*
|
|
2628
|
+
* List of MergeScanSelCache structs. Those aren't Nodes, so hard to
|
|
2629
|
+
* copy; instead replace with NIL. That has the effect that copying will
|
|
2630
|
+
* just reset the cache. Likewise, can't compare or print them.
|
|
2631
|
+
*/
|
|
2632
|
+
List *scansel_cache pg_node_attr(copy_as(NIL), equal_ignore, read_write_ignore);
|
|
2121
2633
|
|
|
2122
|
-
/*
|
|
2123
|
-
|
|
2634
|
+
/*
|
|
2635
|
+
* transient workspace for use while considering a specific join path; T =
|
|
2636
|
+
* outer var on left, F = on right
|
|
2637
|
+
*/
|
|
2638
|
+
bool outer_is_left pg_node_attr(equal_ignore);
|
|
2124
2639
|
|
|
2125
|
-
/*
|
|
2126
|
-
|
|
2640
|
+
/*
|
|
2641
|
+
* copy of clause operator; valid if clause is hashjoinable, else
|
|
2642
|
+
* InvalidOid
|
|
2643
|
+
*/
|
|
2644
|
+
Oid hashjoinoperator pg_node_attr(equal_ignore);
|
|
2127
2645
|
|
|
2128
|
-
/*
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
Selectivity
|
|
2646
|
+
/*
|
|
2647
|
+
* cache space for hashclause processing; -1 if not yet set
|
|
2648
|
+
*/
|
|
2649
|
+
/* avg bucketsize of left side */
|
|
2650
|
+
Selectivity left_bucketsize pg_node_attr(equal_ignore);
|
|
2651
|
+
/* avg bucketsize of right side */
|
|
2652
|
+
Selectivity right_bucketsize pg_node_attr(equal_ignore);
|
|
2653
|
+
/* left side's most common val's freq */
|
|
2654
|
+
Selectivity left_mcvfreq pg_node_attr(equal_ignore);
|
|
2655
|
+
/* right side's most common val's freq */
|
|
2656
|
+
Selectivity right_mcvfreq pg_node_attr(equal_ignore);
|
|
2133
2657
|
|
|
2134
2658
|
/* hash equality operators used for memoize nodes, else InvalidOid */
|
|
2135
|
-
Oid left_hasheqoperator;
|
|
2136
|
-
Oid right_hasheqoperator;
|
|
2659
|
+
Oid left_hasheqoperator pg_node_attr(equal_ignore);
|
|
2660
|
+
Oid right_hasheqoperator pg_node_attr(equal_ignore);
|
|
2137
2661
|
} RestrictInfo;
|
|
2138
2662
|
|
|
2139
2663
|
/*
|
|
@@ -2176,22 +2700,53 @@ typedef struct MergeScanSelCache
|
|
|
2176
2700
|
* of a plan tree. This is used during planning to represent the contained
|
|
2177
2701
|
* expression. At the end of the planning process it is replaced by either
|
|
2178
2702
|
* the contained expression or a Var referring to a lower-level evaluation of
|
|
2179
|
-
* the contained expression.
|
|
2703
|
+
* the contained expression. Generally the evaluation occurs below an outer
|
|
2180
2704
|
* join, and Var references above the outer join might thereby yield NULL
|
|
2181
2705
|
* instead of the expression value.
|
|
2182
2706
|
*
|
|
2707
|
+
* phrels and phlevelsup correspond to the varno/varlevelsup fields of a
|
|
2708
|
+
* plain Var, except that phrels has to be a relid set since the evaluation
|
|
2709
|
+
* level of a PlaceHolderVar might be a join rather than a base relation.
|
|
2710
|
+
* Likewise, phnullingrels corresponds to varnullingrels.
|
|
2711
|
+
*
|
|
2183
2712
|
* Although the planner treats this as an expression node type, it is not
|
|
2184
2713
|
* recognized by the parser or executor, so we declare it here rather than
|
|
2185
2714
|
* in primnodes.h.
|
|
2715
|
+
*
|
|
2716
|
+
* We intentionally do not compare phexpr. Two PlaceHolderVars with the
|
|
2717
|
+
* same ID and levelsup should be considered equal even if the contained
|
|
2718
|
+
* expressions have managed to mutate to different states. This will
|
|
2719
|
+
* happen during final plan construction when there are nested PHVs, since
|
|
2720
|
+
* the inner PHV will get replaced by a Param in some copies of the outer
|
|
2721
|
+
* PHV. Another way in which it can happen is that initplan sublinks
|
|
2722
|
+
* could get replaced by differently-numbered Params when sublink folding
|
|
2723
|
+
* is done. (The end result of such a situation would be some
|
|
2724
|
+
* unreferenced initplans, which is annoying but not really a problem.)
|
|
2725
|
+
* On the same reasoning, there is no need to examine phrels. But we do
|
|
2726
|
+
* need to compare phnullingrels, as that represents effects that are
|
|
2727
|
+
* external to the original value of the PHV.
|
|
2186
2728
|
*/
|
|
2187
2729
|
|
|
2188
2730
|
typedef struct PlaceHolderVar
|
|
2189
2731
|
{
|
|
2732
|
+
pg_node_attr(no_query_jumble)
|
|
2733
|
+
|
|
2190
2734
|
Expr xpr;
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2735
|
+
|
|
2736
|
+
/* the represented expression */
|
|
2737
|
+
Expr *phexpr pg_node_attr(equal_ignore);
|
|
2738
|
+
|
|
2739
|
+
/* base+OJ relids syntactically within expr src */
|
|
2740
|
+
Relids phrels pg_node_attr(equal_ignore);
|
|
2741
|
+
|
|
2742
|
+
/* RT indexes of outer joins that can null PHV's value */
|
|
2743
|
+
Relids phnullingrels;
|
|
2744
|
+
|
|
2745
|
+
/* ID for PHV (unique within planner run) */
|
|
2746
|
+
Index phid;
|
|
2747
|
+
|
|
2748
|
+
/* > 0 if PHV belongs to outer query */
|
|
2749
|
+
Index phlevelsup;
|
|
2195
2750
|
} PlaceHolderVar;
|
|
2196
2751
|
|
|
2197
2752
|
/*
|
|
@@ -2210,25 +2765,53 @@ typedef struct PlaceHolderVar
|
|
|
2210
2765
|
* We make SpecialJoinInfos for FULL JOINs even though there is no flexibility
|
|
2211
2766
|
* of planning for them, because this simplifies make_join_rel()'s API.
|
|
2212
2767
|
*
|
|
2213
|
-
* min_lefthand and min_righthand are the sets of base relids that must be
|
|
2214
|
-
* available on each side when performing the special join.
|
|
2215
|
-
* true if the special join's condition cannot succeed when the LHS variables
|
|
2216
|
-
* are all NULL (this means that an outer join can commute with upper-level
|
|
2217
|
-
* outer joins even if it appears in their RHS). We don't bother to set
|
|
2218
|
-
* lhs_strict for FULL JOINs, however.
|
|
2219
|
-
*
|
|
2768
|
+
* min_lefthand and min_righthand are the sets of base+OJ relids that must be
|
|
2769
|
+
* available on each side when performing the special join.
|
|
2220
2770
|
* It is not valid for either min_lefthand or min_righthand to be empty sets;
|
|
2221
2771
|
* if they were, this would break the logic that enforces join order.
|
|
2222
2772
|
*
|
|
2223
|
-
* syn_lefthand and syn_righthand are the sets of base relids that are
|
|
2773
|
+
* syn_lefthand and syn_righthand are the sets of base+OJ relids that are
|
|
2224
2774
|
* syntactically below this special join. (These are needed to help compute
|
|
2225
2775
|
* min_lefthand and min_righthand for higher joins.)
|
|
2226
2776
|
*
|
|
2227
|
-
*
|
|
2228
|
-
*
|
|
2229
|
-
*
|
|
2230
|
-
*
|
|
2231
|
-
*
|
|
2777
|
+
* jointype is never JOIN_RIGHT; a RIGHT JOIN is handled by switching
|
|
2778
|
+
* the inputs to make it a LEFT JOIN. It's never JOIN_RIGHT_ANTI either.
|
|
2779
|
+
* So the allowed values of jointype in a join_info_list member are only
|
|
2780
|
+
* LEFT, FULL, SEMI, or ANTI.
|
|
2781
|
+
*
|
|
2782
|
+
* ojrelid is the RT index of the join RTE representing this outer join,
|
|
2783
|
+
* if there is one. It is zero when jointype is INNER or SEMI, and can be
|
|
2784
|
+
* zero for jointype ANTI (if the join was transformed from a SEMI join).
|
|
2785
|
+
* One use for this field is that when constructing the output targetlist of a
|
|
2786
|
+
* join relation that implements this OJ, we add ojrelid to the varnullingrels
|
|
2787
|
+
* and phnullingrels fields of nullable (RHS) output columns, so that the
|
|
2788
|
+
* output Vars and PlaceHolderVars correctly reflect the nulling that has
|
|
2789
|
+
* potentially happened to them.
|
|
2790
|
+
*
|
|
2791
|
+
* commute_above_l is filled with the relids of syntactically-higher outer
|
|
2792
|
+
* joins that have been found to commute with this one per outer join identity
|
|
2793
|
+
* 3 (see optimizer/README), when this join is in the LHS of the upper join
|
|
2794
|
+
* (so, this is the lower join in the first form of the identity).
|
|
2795
|
+
*
|
|
2796
|
+
* commute_above_r is filled with the relids of syntactically-higher outer
|
|
2797
|
+
* joins that have been found to commute with this one per outer join identity
|
|
2798
|
+
* 3, when this join is in the RHS of the upper join (so, this is the lower
|
|
2799
|
+
* join in the second form of the identity).
|
|
2800
|
+
*
|
|
2801
|
+
* commute_below_l is filled with the relids of syntactically-lower outer
|
|
2802
|
+
* joins that have been found to commute with this one per outer join identity
|
|
2803
|
+
* 3 and are in the LHS of this join (so, this is the upper join in the first
|
|
2804
|
+
* form of the identity).
|
|
2805
|
+
*
|
|
2806
|
+
* commute_below_r is filled with the relids of syntactically-lower outer
|
|
2807
|
+
* joins that have been found to commute with this one per outer join identity
|
|
2808
|
+
* 3 and are in the RHS of this join (so, this is the upper join in the second
|
|
2809
|
+
* form of the identity).
|
|
2810
|
+
*
|
|
2811
|
+
* lhs_strict is true if the special join's condition cannot succeed when the
|
|
2812
|
+
* LHS variables are all NULL (this means that an outer join can commute with
|
|
2813
|
+
* upper-level outer joins even if it appears in their RHS). We don't bother
|
|
2814
|
+
* to set lhs_strict for FULL JOINs, however.
|
|
2232
2815
|
*
|
|
2233
2816
|
* For a semijoin, we also extract the join operators and their RHS arguments
|
|
2234
2817
|
* and set semi_operators, semi_rhs_exprs, semi_can_btree, and semi_can_hash.
|
|
@@ -2238,18 +2821,14 @@ typedef struct PlaceHolderVar
|
|
|
2238
2821
|
* join planning; but it's helpful to have it available during planning of
|
|
2239
2822
|
* parameterized table scans, so we store it in the SpecialJoinInfo structs.)
|
|
2240
2823
|
*
|
|
2241
|
-
* jointype is never JOIN_RIGHT; a RIGHT JOIN is handled by switching
|
|
2242
|
-
* the inputs to make it a LEFT JOIN. So the allowed values of jointype
|
|
2243
|
-
* in a join_info_list member are only LEFT, FULL, SEMI, or ANTI.
|
|
2244
|
-
*
|
|
2245
2824
|
* For purposes of join selectivity estimation, we create transient
|
|
2246
2825
|
* SpecialJoinInfo structures for regular inner joins; so it is possible
|
|
2247
2826
|
* to have jointype == JOIN_INNER in such a structure, even though this is
|
|
2248
2827
|
* not allowed within join_info_list. We also create transient
|
|
2249
2828
|
* SpecialJoinInfos with jointype == JOIN_INNER for outer joins, since for
|
|
2250
2829
|
* cost estimation purposes it is sometimes useful to know the join size under
|
|
2251
|
-
* plain innerjoin semantics. Note that lhs_strict
|
|
2252
|
-
*
|
|
2830
|
+
* plain innerjoin semantics. Note that lhs_strict and the semi_xxx fields
|
|
2831
|
+
* are not set meaningfully within such structs.
|
|
2253
2832
|
*/
|
|
2254
2833
|
#ifndef HAVE_SPECIALJOININFO_TYPEDEF
|
|
2255
2834
|
typedef struct SpecialJoinInfo SpecialJoinInfo;
|
|
@@ -2258,14 +2837,20 @@ typedef struct SpecialJoinInfo SpecialJoinInfo;
|
|
|
2258
2837
|
|
|
2259
2838
|
struct SpecialJoinInfo
|
|
2260
2839
|
{
|
|
2840
|
+
pg_node_attr(no_read, no_query_jumble)
|
|
2841
|
+
|
|
2261
2842
|
NodeTag type;
|
|
2262
|
-
Relids min_lefthand; /* base relids in minimum LHS for join */
|
|
2263
|
-
Relids min_righthand; /* base relids in minimum RHS for join */
|
|
2264
|
-
Relids syn_lefthand; /* base relids syntactically within LHS */
|
|
2265
|
-
Relids syn_righthand; /* base relids syntactically within RHS */
|
|
2843
|
+
Relids min_lefthand; /* base+OJ relids in minimum LHS for join */
|
|
2844
|
+
Relids min_righthand; /* base+OJ relids in minimum RHS for join */
|
|
2845
|
+
Relids syn_lefthand; /* base+OJ relids syntactically within LHS */
|
|
2846
|
+
Relids syn_righthand; /* base+OJ relids syntactically within RHS */
|
|
2266
2847
|
JoinType jointype; /* always INNER, LEFT, FULL, SEMI, or ANTI */
|
|
2848
|
+
Index ojrelid; /* outer join's RT index; 0 if none */
|
|
2849
|
+
Relids commute_above_l; /* commuting OJs above this one, if LHS */
|
|
2850
|
+
Relids commute_above_r; /* commuting OJs above this one, if RHS */
|
|
2851
|
+
Relids commute_below_l; /* commuting OJs in this one's LHS */
|
|
2852
|
+
Relids commute_below_r; /* commuting OJs in this one's RHS */
|
|
2267
2853
|
bool lhs_strict; /* joinclause is strict for some LHS rel */
|
|
2268
|
-
bool delay_upper_joins; /* can't commute with upper RHS */
|
|
2269
2854
|
/* Remaining fields are set only for JOIN_SEMI jointype: */
|
|
2270
2855
|
bool semi_can_btree; /* true if semi_operators are all btree */
|
|
2271
2856
|
bool semi_can_hash; /* true if semi_operators are all hash */
|
|
@@ -2273,6 +2858,21 @@ struct SpecialJoinInfo
|
|
|
2273
2858
|
List *semi_rhs_exprs; /* righthand-side expressions of these ops */
|
|
2274
2859
|
};
|
|
2275
2860
|
|
|
2861
|
+
/*
|
|
2862
|
+
* Transient outer-join clause info.
|
|
2863
|
+
*
|
|
2864
|
+
* We set aside every outer join ON clause that looks mergejoinable,
|
|
2865
|
+
* and process it specially at the end of qual distribution.
|
|
2866
|
+
*/
|
|
2867
|
+
typedef struct OuterJoinClauseInfo
|
|
2868
|
+
{
|
|
2869
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
2870
|
+
|
|
2871
|
+
NodeTag type;
|
|
2872
|
+
RestrictInfo *rinfo; /* a mergejoinable outer-join clause */
|
|
2873
|
+
SpecialJoinInfo *sjinfo; /* the outer join's SpecialJoinInfo */
|
|
2874
|
+
} OuterJoinClauseInfo;
|
|
2875
|
+
|
|
2276
2876
|
/*
|
|
2277
2877
|
* Append-relation info.
|
|
2278
2878
|
*
|
|
@@ -2305,6 +2905,8 @@ struct SpecialJoinInfo
|
|
|
2305
2905
|
|
|
2306
2906
|
typedef struct AppendRelInfo
|
|
2307
2907
|
{
|
|
2908
|
+
pg_node_attr(no_query_jumble)
|
|
2909
|
+
|
|
2308
2910
|
NodeTag type;
|
|
2309
2911
|
|
|
2310
2912
|
/*
|
|
@@ -2350,7 +2952,7 @@ typedef struct AppendRelInfo
|
|
|
2350
2952
|
* child column is dropped or doesn't exist in the parent.
|
|
2351
2953
|
*/
|
|
2352
2954
|
int num_child_cols; /* length of array */
|
|
2353
|
-
AttrNumber *parent_colnos;
|
|
2955
|
+
AttrNumber *parent_colnos pg_node_attr(array_size(num_child_cols));
|
|
2354
2956
|
|
|
2355
2957
|
/*
|
|
2356
2958
|
* We store the parent table's OID here for inheritance, or InvalidOid for
|
|
@@ -2380,6 +2982,8 @@ typedef struct AppendRelInfo
|
|
|
2380
2982
|
*/
|
|
2381
2983
|
typedef struct RowIdentityVarInfo
|
|
2382
2984
|
{
|
|
2985
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
2986
|
+
|
|
2383
2987
|
NodeTag type;
|
|
2384
2988
|
|
|
2385
2989
|
Var *rowidvar; /* Var to be evaluated (but varno=ROWID_VAR) */
|
|
@@ -2416,14 +3020,30 @@ typedef struct RowIdentityVarInfo
|
|
|
2416
3020
|
|
|
2417
3021
|
typedef struct PlaceHolderInfo
|
|
2418
3022
|
{
|
|
3023
|
+
pg_node_attr(no_read, no_query_jumble)
|
|
3024
|
+
|
|
2419
3025
|
NodeTag type;
|
|
2420
3026
|
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
3027
|
+
/* ID for PH (unique within planner run) */
|
|
3028
|
+
Index phid;
|
|
3029
|
+
|
|
3030
|
+
/*
|
|
3031
|
+
* copy of PlaceHolderVar tree (should be redundant for comparison, could
|
|
3032
|
+
* be ignored)
|
|
3033
|
+
*/
|
|
3034
|
+
PlaceHolderVar *ph_var;
|
|
3035
|
+
|
|
3036
|
+
/* lowest level we can evaluate value at */
|
|
3037
|
+
Relids ph_eval_at;
|
|
3038
|
+
|
|
3039
|
+
/* relids of contained lateral refs, if any */
|
|
3040
|
+
Relids ph_lateral;
|
|
3041
|
+
|
|
3042
|
+
/* highest level the value is needed at */
|
|
3043
|
+
Relids ph_needed;
|
|
3044
|
+
|
|
3045
|
+
/* estimated attribute width */
|
|
3046
|
+
int32 ph_width;
|
|
2427
3047
|
} PlaceHolderInfo;
|
|
2428
3048
|
|
|
2429
3049
|
/*
|
|
@@ -2433,15 +3053,33 @@ typedef struct PlaceHolderInfo
|
|
|
2433
3053
|
*/
|
|
2434
3054
|
typedef struct MinMaxAggInfo
|
|
2435
3055
|
{
|
|
3056
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
3057
|
+
|
|
2436
3058
|
NodeTag type;
|
|
2437
3059
|
|
|
2438
|
-
|
|
2439
|
-
Oid
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
3060
|
+
/* pg_proc Oid of the aggregate */
|
|
3061
|
+
Oid aggfnoid;
|
|
3062
|
+
|
|
3063
|
+
/* Oid of its sort operator */
|
|
3064
|
+
Oid aggsortop;
|
|
3065
|
+
|
|
3066
|
+
/* expression we are aggregating on */
|
|
3067
|
+
Expr *target;
|
|
3068
|
+
|
|
3069
|
+
/*
|
|
3070
|
+
* modified "root" for planning the subquery; not printed, too large, not
|
|
3071
|
+
* interesting enough
|
|
3072
|
+
*/
|
|
3073
|
+
PlannerInfo *subroot pg_node_attr(read_write_ignore);
|
|
3074
|
+
|
|
3075
|
+
/* access path for subquery */
|
|
3076
|
+
Path *path;
|
|
3077
|
+
|
|
3078
|
+
/* estimated cost to fetch first row */
|
|
3079
|
+
Cost pathcost;
|
|
3080
|
+
|
|
3081
|
+
/* param for subplan's output */
|
|
3082
|
+
Param *param;
|
|
2445
3083
|
} MinMaxAggInfo;
|
|
2446
3084
|
|
|
2447
3085
|
/*
|
|
@@ -2493,6 +3131,8 @@ typedef struct MinMaxAggInfo
|
|
|
2493
3131
|
*/
|
|
2494
3132
|
typedef struct PlannerParamItem
|
|
2495
3133
|
{
|
|
3134
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
3135
|
+
|
|
2496
3136
|
NodeTag type;
|
|
2497
3137
|
|
|
2498
3138
|
Node *item; /* the Var, PlaceHolderVar, or Aggref */
|
|
@@ -2671,14 +3311,19 @@ typedef struct JoinCostWorkspace
|
|
|
2671
3311
|
*/
|
|
2672
3312
|
typedef struct AggInfo
|
|
2673
3313
|
{
|
|
3314
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
3315
|
+
|
|
3316
|
+
NodeTag type;
|
|
3317
|
+
|
|
2674
3318
|
/*
|
|
2675
|
-
*
|
|
3319
|
+
* List of Aggref exprs that this state value is for.
|
|
2676
3320
|
*
|
|
2677
|
-
* There
|
|
2678
|
-
*
|
|
3321
|
+
* There will always be at least one, but there can be multiple identical
|
|
3322
|
+
* Aggref's sharing the same per-agg.
|
|
2679
3323
|
*/
|
|
2680
|
-
|
|
3324
|
+
List *aggrefs;
|
|
2681
3325
|
|
|
3326
|
+
/* Transition state number for this aggregate */
|
|
2682
3327
|
int transno;
|
|
2683
3328
|
|
|
2684
3329
|
/*
|
|
@@ -2687,9 +3332,8 @@ typedef struct AggInfo
|
|
|
2687
3332
|
*/
|
|
2688
3333
|
bool shareable;
|
|
2689
3334
|
|
|
2690
|
-
/* Oid of the final function or InvalidOid */
|
|
3335
|
+
/* Oid of the final function, or InvalidOid if none */
|
|
2691
3336
|
Oid finalfn_oid;
|
|
2692
|
-
|
|
2693
3337
|
} AggInfo;
|
|
2694
3338
|
|
|
2695
3339
|
/*
|
|
@@ -2701,34 +3345,40 @@ typedef struct AggInfo
|
|
|
2701
3345
|
*/
|
|
2702
3346
|
typedef struct AggTransInfo
|
|
2703
3347
|
{
|
|
3348
|
+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
|
|
3349
|
+
|
|
3350
|
+
NodeTag type;
|
|
3351
|
+
|
|
3352
|
+
/* Inputs for this transition state */
|
|
2704
3353
|
List *args;
|
|
2705
3354
|
Expr *aggfilter;
|
|
2706
3355
|
|
|
2707
3356
|
/* Oid of the state transition function */
|
|
2708
3357
|
Oid transfn_oid;
|
|
2709
3358
|
|
|
2710
|
-
/* Oid of the serialization function or InvalidOid */
|
|
3359
|
+
/* Oid of the serialization function, or InvalidOid if none */
|
|
2711
3360
|
Oid serialfn_oid;
|
|
2712
3361
|
|
|
2713
|
-
/* Oid of the deserialization function or InvalidOid */
|
|
3362
|
+
/* Oid of the deserialization function, or InvalidOid if none */
|
|
2714
3363
|
Oid deserialfn_oid;
|
|
2715
3364
|
|
|
2716
|
-
/* Oid of the combine function or InvalidOid */
|
|
3365
|
+
/* Oid of the combine function, or InvalidOid if none */
|
|
2717
3366
|
Oid combinefn_oid;
|
|
2718
3367
|
|
|
2719
3368
|
/* Oid of state value's datatype */
|
|
2720
3369
|
Oid aggtranstype;
|
|
3370
|
+
|
|
3371
|
+
/* Additional data about transtype */
|
|
2721
3372
|
int32 aggtranstypmod;
|
|
2722
3373
|
int transtypeLen;
|
|
2723
3374
|
bool transtypeByVal;
|
|
3375
|
+
|
|
3376
|
+
/* Space-consumption estimate */
|
|
2724
3377
|
int32 aggtransspace;
|
|
2725
3378
|
|
|
2726
|
-
/*
|
|
2727
|
-
|
|
2728
|
-
*/
|
|
2729
|
-
Datum initValue;
|
|
3379
|
+
/* Initial value from pg_aggregate entry */
|
|
3380
|
+
Datum initValue pg_node_attr(read_write_ignore);
|
|
2730
3381
|
bool initValueIsNull;
|
|
2731
|
-
|
|
2732
3382
|
} AggTransInfo;
|
|
2733
3383
|
|
|
2734
3384
|
#endif /* PATHNODES_H */
|