pg_query 2.1.0 → 4.2.1
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 +104 -0
- data/README.md +59 -31
- data/Rakefile +2 -2
- data/ext/pg_query/extconf.rb +8 -2
- data/ext/pg_query/include/access/amapi.h +45 -1
- data/ext/pg_query/include/access/attmap.h +1 -1
- data/ext/pg_query/include/access/attnum.h +2 -2
- data/ext/pg_query/include/access/clog.h +4 -2
- data/ext/pg_query/include/access/commit_ts.h +6 -9
- data/ext/pg_query/include/access/detoast.h +1 -11
- data/ext/pg_query/include/access/genam.h +15 -12
- data/ext/pg_query/include/access/gin.h +2 -2
- data/ext/pg_query/include/access/htup.h +1 -1
- data/ext/pg_query/include/access/htup_details.h +75 -87
- data/ext/pg_query/include/access/itup.h +7 -1
- data/ext/pg_query/include/access/parallel.h +2 -2
- data/ext/pg_query/include/access/printtup.h +1 -1
- data/ext/pg_query/include/access/relation.h +1 -1
- data/ext/pg_query/include/access/relscan.h +17 -2
- data/ext/pg_query/include/access/rmgr.h +30 -3
- data/ext/pg_query/include/access/rmgrlist.h +23 -23
- data/ext/pg_query/include/access/sdir.h +1 -1
- data/ext/pg_query/include/access/skey.h +1 -1
- data/ext/pg_query/include/access/stratnum.h +4 -2
- data/ext/pg_query/include/access/sysattr.h +1 -1
- data/ext/pg_query/include/access/table.h +2 -1
- data/ext/pg_query/include/access/tableam.h +272 -20
- data/ext/pg_query/include/access/toast_compression.h +73 -0
- data/ext/pg_query/include/access/transam.h +123 -13
- data/ext/pg_query/include/access/tupconvert.h +1 -1
- data/ext/pg_query/include/access/tupdesc.h +1 -1
- data/ext/pg_query/include/access/tupmacs.h +3 -3
- data/ext/pg_query/include/access/twophase.h +5 -1
- data/ext/pg_query/include/access/xact.h +79 -19
- data/ext/pg_query/include/access/xlog.h +60 -155
- data/ext/pg_query/include/access/xlog_internal.h +50 -14
- data/ext/pg_query/include/access/xlogdefs.h +8 -16
- data/ext/pg_query/include/access/xlogprefetcher.h +55 -0
- data/ext/pg_query/include/access/xlogreader.h +148 -32
- data/ext/pg_query/include/access/xlogrecord.h +18 -9
- data/ext/pg_query/include/access/xlogrecovery.h +157 -0
- data/ext/pg_query/include/c.h +101 -44
- data/ext/pg_query/include/catalog/catalog.h +3 -1
- data/ext/pg_query/include/catalog/catversion.h +2 -2
- data/ext/pg_query/include/catalog/dependency.h +10 -16
- data/ext/pg_query/include/catalog/genbki.h +83 -5
- data/ext/pg_query/include/catalog/index.h +18 -3
- data/ext/pg_query/include/catalog/indexing.h +12 -324
- data/ext/pg_query/include/catalog/namespace.h +4 -2
- data/ext/pg_query/include/catalog/objectaccess.h +70 -2
- data/ext/pg_query/include/catalog/objectaddress.h +11 -6
- data/ext/pg_query/include/catalog/pg_aggregate.h +14 -10
- data/ext/pg_query/include/catalog/pg_aggregate_d.h +2 -1
- data/ext/pg_query/include/catalog/pg_am.h +4 -1
- data/ext/pg_query/include/catalog/pg_am_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_attribute.h +27 -10
- data/ext/pg_query/include/catalog/pg_attribute_d.h +21 -18
- data/ext/pg_query/include/catalog/pg_authid.h +7 -2
- data/ext/pg_query/include/catalog/pg_authid_d.h +17 -9
- data/ext/pg_query/include/catalog/pg_class.h +45 -15
- data/ext/pg_query/include/catalog/pg_class_d.h +31 -2
- data/ext/pg_query/include/catalog/pg_collation.h +33 -8
- data/ext/pg_query/include/catalog/pg_collation_d.h +20 -3
- data/ext/pg_query/include/catalog/pg_constraint.h +38 -12
- data/ext/pg_query/include/catalog/pg_constraint_d.h +10 -4
- data/ext/pg_query/include/catalog/pg_control.h +5 -5
- data/ext/pg_query/include/catalog/pg_conversion.h +7 -4
- data/ext/pg_query/include/catalog/pg_conversion_d.h +4 -1
- data/ext/pg_query/include/catalog/pg_depend.h +11 -7
- data/ext/pg_query/include/catalog/pg_depend_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_event_trigger.h +9 -3
- data/ext/pg_query/include/catalog/pg_event_trigger_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_index.h +17 -7
- data/ext/pg_query/include/catalog/pg_index_d.h +20 -17
- data/ext/pg_query/include/catalog/pg_language.h +10 -5
- data/ext/pg_query/include/catalog/pg_language_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_namespace.h +7 -2
- data/ext/pg_query/include/catalog/pg_namespace_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_opclass.h +8 -5
- data/ext/pg_query/include/catalog/pg_opclass_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_operator.h +21 -16
- data/ext/pg_query/include/catalog/pg_operator_d.h +37 -1
- data/ext/pg_query/include/catalog/pg_opfamily.h +6 -3
- data/ext/pg_query/include/catalog/pg_opfamily_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_parameter_acl.h +60 -0
- data/ext/pg_query/include/catalog/pg_parameter_acl_d.h +34 -0
- data/ext/pg_query/include/catalog/pg_partitioned_table.h +20 -9
- data/ext/pg_query/include/catalog/pg_partitioned_table_d.h +2 -1
- data/ext/pg_query/include/catalog/pg_proc.h +20 -11
- data/ext/pg_query/include/catalog/pg_proc_d.h +10 -8
- data/ext/pg_query/include/catalog/pg_publication.h +50 -4
- data/ext/pg_query/include/catalog/pg_publication_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_replication_origin.h +6 -1
- data/ext/pg_query/include/catalog/pg_replication_origin_d.h +5 -1
- data/ext/pg_query/include/catalog/pg_statistic.h +19 -12
- data/ext/pg_query/include/catalog/pg_statistic_d.h +2 -1
- data/ext/pg_query/include/catalog/pg_statistic_ext.h +19 -5
- data/ext/pg_query/include/catalog/pg_statistic_ext_d.h +7 -2
- data/ext/pg_query/include/catalog/pg_transform.h +8 -5
- data/ext/pg_query/include/catalog/pg_transform_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_trigger.h +24 -8
- data/ext/pg_query/include/catalog/pg_trigger_d.h +4 -1
- data/ext/pg_query/include/catalog/pg_ts_config.h +6 -3
- data/ext/pg_query/include/catalog/pg_ts_config_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_ts_dict.h +8 -3
- data/ext/pg_query/include/catalog/pg_ts_dict_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_ts_parser.h +6 -3
- data/ext/pg_query/include/catalog/pg_ts_parser_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_ts_template.h +6 -3
- data/ext/pg_query/include/catalog/pg_ts_template_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_type.h +56 -24
- data/ext/pg_query/include/catalog/pg_type_d.h +70 -31
- data/ext/pg_query/include/catalog/storage.h +5 -3
- data/ext/pg_query/include/commands/async.h +4 -5
- data/ext/pg_query/include/commands/dbcommands.h +2 -1
- data/ext/pg_query/include/commands/defrem.h +11 -24
- data/ext/pg_query/include/commands/event_trigger.h +2 -2
- data/ext/pg_query/include/commands/explain.h +1 -1
- data/ext/pg_query/include/commands/prepare.h +1 -1
- data/ext/pg_query/include/commands/tablespace.h +3 -1
- data/ext/pg_query/include/commands/trigger.h +27 -17
- data/ext/pg_query/include/commands/user.h +2 -2
- data/ext/pg_query/include/commands/vacuum.h +88 -41
- data/ext/pg_query/include/commands/variable.h +1 -1
- data/ext/pg_query/include/common/file_perm.h +4 -4
- data/ext/pg_query/include/common/hashfn.h +1 -1
- data/ext/pg_query/include/common/ip.h +1 -7
- data/ext/pg_query/include/common/keywords.h +2 -6
- data/ext/pg_query/include/common/kwlookup.h +1 -1
- data/ext/pg_query/include/common/pg_prng.h +60 -0
- data/ext/pg_query/include/common/relpath.h +2 -2
- data/ext/pg_query/include/common/string.h +24 -1
- data/ext/pg_query/include/common/unicode_combining_table.h +114 -2
- data/ext/pg_query/include/common/unicode_east_asian_fw_table.h +125 -0
- data/ext/pg_query/include/datatype/timestamp.h +40 -1
- data/ext/pg_query/include/executor/execdesc.h +1 -1
- data/ext/pg_query/include/executor/executor.h +65 -22
- data/ext/pg_query/include/executor/functions.h +17 -3
- data/ext/pg_query/include/executor/instrument.h +33 -16
- data/ext/pg_query/include/executor/spi.h +41 -3
- data/ext/pg_query/include/executor/tablefunc.h +1 -1
- data/ext/pg_query/include/executor/tuptable.h +1 -1
- data/ext/pg_query/include/fmgr.h +13 -7
- data/ext/pg_query/include/funcapi.h +16 -4
- data/ext/pg_query/include/getaddrinfo.h +1 -1
- data/ext/pg_query/include/jit/jit.h +11 -11
- data/ext/pg_query/include/kwlist_d.h +517 -494
- data/ext/pg_query/include/lib/dshash.h +112 -0
- data/ext/pg_query/include/lib/ilist.h +20 -1
- data/ext/pg_query/include/lib/pairingheap.h +1 -1
- data/ext/pg_query/include/lib/simplehash.h +150 -25
- data/ext/pg_query/include/lib/sort_template.h +432 -0
- data/ext/pg_query/include/lib/stringinfo.h +1 -1
- data/ext/pg_query/include/libpq/auth.h +6 -4
- data/ext/pg_query/include/libpq/crypt.h +5 -4
- data/ext/pg_query/include/libpq/hba.h +43 -4
- data/ext/pg_query/include/libpq/libpq-be.h +23 -6
- data/ext/pg_query/include/libpq/libpq.h +31 -20
- data/ext/pg_query/include/libpq/pqcomm.h +17 -31
- data/ext/pg_query/include/libpq/pqformat.h +1 -1
- data/ext/pg_query/include/libpq/pqsignal.h +4 -4
- data/ext/pg_query/include/mb/pg_wchar.h +106 -23
- data/ext/pg_query/include/mb/stringinfo_mb.h +1 -1
- data/ext/pg_query/include/miscadmin.h +71 -52
- data/ext/pg_query/include/nodes/bitmapset.h +1 -1
- data/ext/pg_query/include/nodes/execnodes.h +272 -80
- data/ext/pg_query/include/nodes/extensible.h +4 -2
- data/ext/pg_query/include/nodes/lockoptions.h +1 -1
- data/ext/pg_query/include/nodes/makefuncs.h +7 -6
- data/ext/pg_query/include/nodes/memnodes.h +5 -3
- data/ext/pg_query/include/nodes/nodeFuncs.h +1 -1
- data/ext/pg_query/include/nodes/nodes.h +30 -11
- data/ext/pg_query/include/nodes/params.h +1 -1
- data/ext/pg_query/include/nodes/parsenodes.h +327 -94
- data/ext/pg_query/include/nodes/pathnodes.h +245 -67
- data/ext/pg_query/include/nodes/pg_list.h +75 -68
- data/ext/pg_query/include/nodes/plannodes.h +128 -30
- data/ext/pg_query/include/nodes/primnodes.h +99 -47
- data/ext/pg_query/include/nodes/print.h +1 -1
- data/ext/pg_query/include/nodes/tidbitmap.h +1 -1
- data/ext/pg_query/include/nodes/value.h +58 -39
- data/ext/pg_query/include/optimizer/cost.h +9 -2
- data/ext/pg_query/include/optimizer/geqo.h +9 -7
- data/ext/pg_query/include/optimizer/geqo_gene.h +1 -1
- data/ext/pg_query/include/optimizer/optimizer.h +25 -22
- data/ext/pg_query/include/optimizer/paths.h +6 -6
- data/ext/pg_query/include/optimizer/planmain.h +15 -14
- data/ext/pg_query/include/parser/analyze.h +19 -5
- data/ext/pg_query/include/parser/gram.h +947 -913
- data/ext/pg_query/include/parser/gramparse.h +1 -1
- data/ext/pg_query/include/parser/kwlist.h +463 -453
- data/ext/pg_query/include/parser/parse_agg.h +2 -7
- data/ext/pg_query/include/parser/parse_coerce.h +4 -1
- data/ext/pg_query/include/parser/parse_expr.h +2 -3
- data/ext/pg_query/include/parser/parse_func.h +2 -1
- data/ext/pg_query/include/parser/parse_node.h +21 -9
- data/ext/pg_query/include/parser/parse_oper.h +1 -3
- data/ext/pg_query/include/parser/parse_relation.h +5 -4
- data/ext/pg_query/include/parser/parse_type.h +1 -1
- data/ext/pg_query/include/parser/parser.h +31 -4
- data/ext/pg_query/include/parser/parsetree.h +1 -1
- data/ext/pg_query/include/parser/scanner.h +1 -1
- data/ext/pg_query/include/parser/scansup.h +2 -5
- data/ext/pg_query/include/partitioning/partdefs.h +1 -1
- data/ext/pg_query/include/pg_config.h +94 -46
- data/ext/pg_query/include/pg_config_manual.h +74 -21
- data/ext/pg_query/include/pg_getopt.h +6 -6
- data/ext/pg_query/include/pg_query.h +5 -4
- data/ext/pg_query/include/pg_query_enum_defs.c +358 -241
- data/ext/pg_query/include/pg_query_fingerprint_conds.c +44 -7
- data/ext/pg_query/include/pg_query_fingerprint_defs.c +1220 -422
- data/ext/pg_query/include/pg_query_outfuncs_conds.c +43 -13
- data/ext/pg_query/include/pg_query_outfuncs_defs.c +152 -26
- data/ext/pg_query/include/pg_query_readfuncs_conds.c +11 -2
- data/ext/pg_query/include/pg_query_readfuncs_defs.c +174 -30
- data/ext/pg_query/include/pg_trace.h +1 -1
- data/ext/pg_query/include/pgstat.h +449 -1237
- data/ext/pg_query/include/pgtime.h +14 -4
- data/ext/pg_query/include/pl_gram.h +126 -128
- data/ext/pg_query/include/pl_reserved_kwlist.h +1 -1
- data/ext/pg_query/include/pl_reserved_kwlist_d.h +10 -10
- data/ext/pg_query/include/pl_unreserved_kwlist.h +2 -3
- data/ext/pg_query/include/pl_unreserved_kwlist_d.h +54 -56
- data/ext/pg_query/include/plerrcodes.h +9 -1
- data/ext/pg_query/include/plpgsql.h +52 -54
- data/ext/pg_query/include/port/atomics/arch-arm.h +7 -1
- data/ext/pg_query/include/port/atomics/arch-ppc.h +1 -1
- data/ext/pg_query/include/port/atomics/arch-x86.h +1 -1
- data/ext/pg_query/include/port/atomics/fallback.h +1 -1
- data/ext/pg_query/include/port/atomics/generic-gcc.h +3 -3
- data/ext/pg_query/include/port/atomics/generic.h +1 -1
- data/ext/pg_query/include/port/atomics.h +1 -1
- data/ext/pg_query/include/port/pg_bitutils.h +88 -12
- data/ext/pg_query/include/port/pg_bswap.h +1 -1
- data/ext/pg_query/include/port/pg_crc32c.h +1 -1
- data/ext/pg_query/include/port.h +72 -43
- data/ext/pg_query/include/portability/instr_time.h +1 -1
- data/ext/pg_query/include/postgres.h +60 -16
- data/ext/pg_query/include/postmaster/autovacuum.h +17 -17
- data/ext/pg_query/include/postmaster/auxprocess.h +20 -0
- data/ext/pg_query/include/postmaster/bgworker.h +2 -1
- data/ext/pg_query/include/postmaster/bgworker_internals.h +2 -2
- data/ext/pg_query/include/postmaster/bgwriter.h +5 -5
- data/ext/pg_query/include/postmaster/fork_process.h +1 -1
- data/ext/pg_query/include/postmaster/interrupt.h +1 -1
- data/ext/pg_query/include/postmaster/pgarch.h +42 -8
- data/ext/pg_query/include/postmaster/postmaster.h +18 -17
- data/ext/pg_query/include/postmaster/startup.h +39 -0
- data/ext/pg_query/include/postmaster/syslogger.h +15 -10
- data/ext/pg_query/include/postmaster/walwriter.h +3 -3
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +1422 -916
- data/ext/pg_query/include/protobuf/pg_query.pb.h +43678 -32769
- data/ext/pg_query/include/regex/regex.h +18 -16
- data/ext/pg_query/include/replication/logicallauncher.h +3 -5
- data/ext/pg_query/include/replication/logicalproto.h +161 -17
- data/ext/pg_query/include/replication/logicalworker.h +1 -1
- data/ext/pg_query/include/replication/origin.h +7 -7
- data/ext/pg_query/include/replication/reorderbuffer.h +262 -44
- data/ext/pg_query/include/replication/slot.h +23 -12
- data/ext/pg_query/include/replication/syncrep.h +5 -5
- data/ext/pg_query/include/replication/walreceiver.h +145 -13
- data/ext/pg_query/include/replication/walsender.h +8 -8
- data/ext/pg_query/include/rewrite/prs2lock.h +1 -1
- data/ext/pg_query/include/rewrite/rewriteHandler.h +1 -3
- data/ext/pg_query/include/rewrite/rewriteManip.h +1 -1
- data/ext/pg_query/include/rewrite/rewriteSupport.h +1 -1
- data/ext/pg_query/include/storage/backendid.h +3 -3
- data/ext/pg_query/include/storage/block.h +4 -10
- data/ext/pg_query/include/storage/buf.h +1 -1
- data/ext/pg_query/include/storage/bufmgr.h +19 -14
- data/ext/pg_query/include/storage/bufpage.h +6 -8
- data/ext/pg_query/include/storage/condition_variable.h +13 -2
- data/ext/pg_query/include/storage/dsm.h +4 -1
- data/ext/pg_query/include/storage/dsm_impl.h +3 -2
- data/ext/pg_query/include/storage/fd.h +33 -3
- data/ext/pg_query/include/storage/fileset.h +40 -0
- data/ext/pg_query/include/storage/ipc.h +4 -1
- data/ext/pg_query/include/storage/item.h +1 -1
- data/ext/pg_query/include/storage/itemid.h +1 -1
- data/ext/pg_query/include/storage/itemptr.h +3 -1
- data/ext/pg_query/include/storage/large_object.h +2 -2
- data/ext/pg_query/include/storage/latch.h +9 -13
- data/ext/pg_query/include/storage/lmgr.h +2 -1
- data/ext/pg_query/include/storage/lock.h +17 -13
- data/ext/pg_query/include/storage/lockdefs.h +2 -2
- data/ext/pg_query/include/storage/lwlock.h +6 -32
- data/ext/pg_query/include/storage/lwlocknames.h +0 -1
- data/ext/pg_query/include/storage/off.h +1 -1
- data/ext/pg_query/include/storage/pg_sema.h +1 -1
- data/ext/pg_query/include/storage/pg_shmem.h +9 -7
- data/ext/pg_query/include/storage/pmsignal.h +15 -4
- data/ext/pg_query/include/storage/predicate.h +4 -4
- data/ext/pg_query/include/storage/proc.h +183 -55
- data/ext/pg_query/include/storage/procarray.h +98 -0
- data/ext/pg_query/include/storage/proclist_types.h +1 -1
- data/ext/pg_query/include/storage/procsignal.h +3 -7
- data/ext/pg_query/include/storage/relfilenode.h +1 -1
- data/ext/pg_query/include/storage/s_lock.h +67 -4
- data/ext/pg_query/include/storage/sharedfileset.h +3 -11
- data/ext/pg_query/include/storage/shm_mq.h +5 -4
- data/ext/pg_query/include/storage/shm_toc.h +1 -1
- data/ext/pg_query/include/storage/shmem.h +1 -1
- data/ext/pg_query/include/storage/sinval.h +3 -3
- data/ext/pg_query/include/storage/sinvaladt.h +1 -1
- data/ext/pg_query/include/storage/smgr.h +10 -8
- data/ext/pg_query/include/storage/spin.h +2 -2
- data/ext/pg_query/include/storage/standby.h +13 -6
- data/ext/pg_query/include/storage/standbydefs.h +2 -2
- data/ext/pg_query/include/storage/sync.h +7 -3
- data/ext/pg_query/include/tcop/cmdtag.h +1 -1
- data/ext/pg_query/include/tcop/cmdtaglist.h +3 -2
- data/ext/pg_query/include/tcop/deparse_utility.h +1 -1
- data/ext/pg_query/include/tcop/dest.h +1 -1
- data/ext/pg_query/include/tcop/fastpath.h +1 -2
- data/ext/pg_query/include/tcop/pquery.h +7 -1
- data/ext/pg_query/include/tcop/tcopprot.h +19 -11
- data/ext/pg_query/include/tcop/utility.h +7 -3
- data/ext/pg_query/include/tsearch/ts_cache.h +2 -2
- data/ext/pg_query/include/utils/acl.h +24 -3
- data/ext/pg_query/include/utils/aclchk_internal.h +1 -1
- data/ext/pg_query/include/utils/array.h +7 -2
- data/ext/pg_query/include/utils/backend_progress.h +44 -0
- data/ext/pg_query/include/utils/backend_status.h +321 -0
- data/ext/pg_query/include/utils/builtins.h +11 -11
- data/ext/pg_query/include/utils/bytea.h +3 -2
- data/ext/pg_query/include/utils/catcache.h +1 -1
- data/ext/pg_query/include/utils/date.h +1 -1
- data/ext/pg_query/include/utils/datetime.h +8 -7
- data/ext/pg_query/include/utils/datum.h +9 -1
- data/ext/pg_query/include/utils/dsa.h +1 -1
- data/ext/pg_query/include/utils/dynahash.h +4 -3
- data/ext/pg_query/include/utils/elog.h +52 -21
- data/ext/pg_query/include/utils/errcodes.h +2 -0
- data/ext/pg_query/include/utils/expandeddatum.h +1 -1
- data/ext/pg_query/include/utils/expandedrecord.h +1 -1
- data/ext/pg_query/include/utils/float.h +7 -7
- data/ext/pg_query/include/utils/fmgroids.h +1300 -696
- data/ext/pg_query/include/utils/fmgrprotos.h +199 -16
- data/ext/pg_query/include/utils/fmgrtab.h +6 -5
- data/ext/pg_query/include/utils/guc.h +69 -43
- data/ext/pg_query/include/utils/guc_tables.h +23 -19
- data/ext/pg_query/include/utils/hsearch.h +15 -11
- data/ext/pg_query/include/utils/inval.h +5 -1
- data/ext/pg_query/include/utils/lsyscache.h +11 -1
- data/ext/pg_query/include/utils/memdebug.h +1 -1
- data/ext/pg_query/include/utils/memutils.h +8 -3
- data/ext/pg_query/include/utils/numeric.h +19 -5
- data/ext/pg_query/include/utils/palloc.h +25 -3
- data/ext/pg_query/include/utils/partcache.h +1 -1
- data/ext/pg_query/include/utils/pg_locale.h +17 -9
- data/ext/pg_query/include/utils/pg_lsn.h +1 -1
- data/ext/pg_query/include/utils/pgstat_internal.h +784 -0
- data/ext/pg_query/include/utils/pidfile.h +1 -1
- data/ext/pg_query/include/utils/plancache.h +6 -5
- data/ext/pg_query/include/utils/portal.h +12 -1
- data/ext/pg_query/include/utils/ps_status.h +1 -1
- data/ext/pg_query/include/utils/queryenvironment.h +1 -1
- data/ext/pg_query/include/utils/queryjumble.h +88 -0
- data/ext/pg_query/include/utils/regproc.h +14 -3
- data/ext/pg_query/include/utils/rel.h +71 -20
- data/ext/pg_query/include/utils/relcache.h +9 -7
- data/ext/pg_query/include/utils/reltrigger.h +1 -1
- data/ext/pg_query/include/utils/resowner.h +1 -1
- data/ext/pg_query/include/utils/rls.h +2 -2
- data/ext/pg_query/include/utils/ruleutils.h +4 -1
- data/ext/pg_query/include/utils/sharedtuplestore.h +1 -1
- data/ext/pg_query/include/utils/snapmgr.h +35 -14
- data/ext/pg_query/include/utils/snapshot.h +14 -1
- data/ext/pg_query/include/utils/sortsupport.h +117 -2
- data/ext/pg_query/include/utils/syscache.h +6 -1
- data/ext/pg_query/include/utils/timeout.h +11 -4
- data/ext/pg_query/include/utils/timestamp.h +6 -5
- data/ext/pg_query/include/utils/tuplesort.h +25 -11
- data/ext/pg_query/include/utils/tuplestore.h +2 -2
- data/ext/pg_query/include/utils/typcache.h +24 -17
- data/ext/pg_query/include/utils/tzparser.h +1 -1
- data/ext/pg_query/include/utils/varlena.h +5 -3
- data/ext/pg_query/include/utils/wait_event.h +289 -0
- data/ext/pg_query/include/utils/xml.h +4 -4
- data/ext/pg_query/pg_query.pb-c.c +4318 -2307
- data/ext/pg_query/pg_query_deparse.c +1114 -381
- data/ext/pg_query/pg_query_fingerprint.c +46 -10
- data/ext/pg_query/pg_query_fingerprint.h +3 -1
- data/ext/pg_query/pg_query_json_plpgsql.c +55 -12
- data/ext/pg_query/pg_query_normalize.c +163 -20
- data/ext/pg_query/pg_query_outfuncs.h +1 -0
- data/ext/pg_query/pg_query_outfuncs_json.c +65 -16
- data/ext/pg_query/pg_query_outfuncs_protobuf.c +70 -10
- data/ext/pg_query/pg_query_parse.c +1 -1
- data/ext/pg_query/pg_query_parse_plpgsql.c +79 -16
- data/ext/pg_query/pg_query_readfuncs_protobuf.c +42 -8
- data/ext/pg_query/pg_query_ruby.c +1 -1
- data/ext/pg_query/pg_query_scan.c +2 -1
- data/ext/pg_query/pg_query_split.c +3 -2
- data/ext/pg_query/src_backend_catalog_namespace.c +21 -9
- data/ext/pg_query/src_backend_catalog_pg_proc.c +4 -1
- data/ext/pg_query/src_backend_commands_define.c +11 -1
- data/ext/pg_query/src_backend_nodes_bitmapset.c +3 -1
- data/ext/pg_query/src_backend_nodes_copyfuncs.c +424 -109
- data/ext/pg_query/src_backend_nodes_equalfuncs.c +291 -46
- data/ext/pg_query/src_backend_nodes_extensible.c +1 -1
- data/ext/pg_query/src_backend_nodes_list.c +86 -11
- data/ext/pg_query/src_backend_nodes_makefuncs.c +5 -4
- data/ext/pg_query/src_backend_nodes_nodeFuncs.c +55 -12
- data/ext/pg_query/src_backend_nodes_value.c +28 -19
- data/ext/pg_query/src_backend_parser_gram.c +33890 -31262
- data/ext/pg_query/src_backend_parser_parser.c +26 -7
- data/ext/pg_query/src_backend_parser_scan.c +644 -441
- data/ext/pg_query/src_backend_parser_scansup.c +4 -28
- data/ext/pg_query/src_backend_postmaster_postmaster.c +77 -106
- data/ext/pg_query/src_backend_storage_ipc_ipc.c +13 -4
- data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +5 -4
- data/ext/pg_query/src_backend_tcop_postgres.c +73 -24
- data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +140 -0
- data/ext/pg_query/src_backend_utils_adt_datum.c +13 -1
- data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_format_type.c +6 -2
- data/ext/pg_query/src_backend_utils_adt_ruleutils.c +109 -15
- data/ext/pg_query/src_backend_utils_error_assert.c +16 -14
- data/ext/pg_query/src_backend_utils_error_elog.c +172 -99
- data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +12 -17
- data/ext/pg_query/src_backend_utils_hash_dynahash.c +40 -10
- data/ext/pg_query/src_backend_utils_init_globals.c +5 -5
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +55 -66
- data/ext/pg_query/src_backend_utils_misc_guc.c +207 -45
- data/ext/pg_query/src_backend_utils_mmgr_aset.c +7 -5
- data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +123 -35
- data/ext/pg_query/src_common_encnames.c +1 -1
- data/ext/pg_query/src_common_hashfn.c +3 -3
- data/ext/pg_query/src_common_keywords.c +15 -2
- data/ext/pg_query/src_common_kwlist_d.h +517 -494
- data/ext/pg_query/src_common_kwlookup.c +1 -1
- data/ext/pg_query/src_common_pg_prng.c +152 -0
- data/ext/pg_query/src_common_psprintf.c +1 -1
- data/ext/pg_query/src_common_string.c +7 -1
- data/ext/pg_query/src_common_stringinfo.c +1 -1
- data/ext/pg_query/src_common_wchar.c +712 -109
- data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +49 -22
- data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +1 -18
- data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1235 -1261
- 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 +10 -10
- data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +2 -2
- data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +54 -56
- data/ext/pg_query/src_port_pg_bitutils.c +41 -52
- data/ext/pg_query/src_port_pgsleep.c +1 -1
- data/ext/pg_query/src_port_pgstrcasecmp.c +1 -1
- data/ext/pg_query/src_port_qsort.c +12 -224
- data/ext/pg_query/src_port_snprintf.c +46 -20
- data/ext/pg_query/src_port_strerror.c +9 -19
- data/ext/pg_query/src_port_strnlen.c +1 -1
- data/lib/pg_query/deparse.rb +7 -1
- data/lib/pg_query/filter_columns.rb +6 -4
- data/lib/pg_query/fingerprint.rb +18 -3
- data/lib/pg_query/node.rb +2 -2
- data/lib/pg_query/param_refs.rb +1 -1
- data/lib/pg_query/parse.rb +87 -51
- data/lib/pg_query/pg_query_pb.rb +1109 -942
- data/lib/pg_query/treewalker.rb +6 -0
- data/lib/pg_query/truncate.rb +54 -8
- data/lib/pg_query/version.rb +1 -1
- metadata +29 -18
- data/ext/pg_query/include/access/xloginsert.h +0 -64
- data/ext/pg_query/include/bootstrap/bootstrap.h +0 -62
- data/ext/pg_query/include/parser/parse_clause.h +0 -54
- data/ext/pg_query/include/parser/parse_collate.h +0 -27
- data/ext/pg_query/include/parser/parse_target.h +0 -46
- data/ext/pg_query/src_backend_libpq_pqcomm.c +0 -651
- data/ext/pg_query/src_backend_parser_parse_expr.c +0 -313
- data/ext/pg_query/src_port_erand48.c +0 -127
- data/ext/pg_query/src_port_random.c +0 -31
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Definitions for planner's internal data structures, especially Paths.
|
|
5
5
|
*
|
|
6
6
|
*
|
|
7
|
-
* Portions Copyright (c) 1996-
|
|
7
|
+
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
|
|
8
8
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
9
9
|
*
|
|
10
10
|
* src/include/nodes/pathnodes.h
|
|
@@ -55,10 +55,6 @@ typedef struct QualCost
|
|
|
55
55
|
*/
|
|
56
56
|
typedef struct AggClauseCosts
|
|
57
57
|
{
|
|
58
|
-
int numAggs; /* total number of aggregate functions */
|
|
59
|
-
int numOrderedAggs; /* number w/ DISTINCT/ORDER BY/WITHIN GROUP */
|
|
60
|
-
bool hasNonPartial; /* does any agg not support partial mode? */
|
|
61
|
-
bool hasNonSerial; /* is any partial agg non-serializable? */
|
|
62
58
|
QualCost transCost; /* total per-input-row execution costs */
|
|
63
59
|
QualCost finalCost; /* total per-aggregated-row costs */
|
|
64
60
|
Size transitionSpace; /* space for pass-by-ref transition data */
|
|
@@ -75,24 +71,13 @@ typedef enum UpperRelationKind
|
|
|
75
71
|
* any */
|
|
76
72
|
UPPERREL_GROUP_AGG, /* result of grouping/aggregation, if any */
|
|
77
73
|
UPPERREL_WINDOW, /* result of window functions, if any */
|
|
74
|
+
UPPERREL_PARTIAL_DISTINCT, /* result of partial "SELECT DISTINCT", if any */
|
|
78
75
|
UPPERREL_DISTINCT, /* result of "SELECT DISTINCT", if any */
|
|
79
76
|
UPPERREL_ORDERED, /* result of ORDER BY, if any */
|
|
80
77
|
UPPERREL_FINAL /* result of any remaining top-level actions */
|
|
81
78
|
/* NB: UPPERREL_FINAL must be last enum entry; it's used to size arrays */
|
|
82
79
|
} UpperRelationKind;
|
|
83
80
|
|
|
84
|
-
/*
|
|
85
|
-
* This enum identifies which type of relation is being planned through the
|
|
86
|
-
* inheritance planner. INHKIND_NONE indicates the inheritance planner
|
|
87
|
-
* was not used.
|
|
88
|
-
*/
|
|
89
|
-
typedef enum InheritanceKind
|
|
90
|
-
{
|
|
91
|
-
INHKIND_NONE,
|
|
92
|
-
INHKIND_INHERITED,
|
|
93
|
-
INHKIND_PARTITIONED
|
|
94
|
-
} InheritanceKind;
|
|
95
|
-
|
|
96
81
|
/*----------
|
|
97
82
|
* PlannerGlobal
|
|
98
83
|
* Global information for planning/optimization
|
|
@@ -120,8 +105,6 @@ typedef struct PlannerGlobal
|
|
|
120
105
|
|
|
121
106
|
List *resultRelations; /* "flat" list of integer RT indexes */
|
|
122
107
|
|
|
123
|
-
List *rootResultRelations; /* "flat" list of integer RT indexes */
|
|
124
|
-
|
|
125
108
|
List *appendRelations; /* "flat" list of AppendRelInfos */
|
|
126
109
|
|
|
127
110
|
List *relationOids; /* OIDs of relations the plan depends on */
|
|
@@ -258,7 +241,8 @@ struct PlannerInfo
|
|
|
258
241
|
|
|
259
242
|
List *init_plans; /* init SubPlans for query */
|
|
260
243
|
|
|
261
|
-
List *cte_plan_ids; /* per-CTE-item list of subplan IDs
|
|
244
|
+
List *cte_plan_ids; /* per-CTE-item list of subplan IDs (or -1 if
|
|
245
|
+
* no subplan was made for that CTE) */
|
|
262
246
|
|
|
263
247
|
List *multiexpr_params; /* List of Lists of Params for MULTIEXPR
|
|
264
248
|
* subquery outputs */
|
|
@@ -282,6 +266,17 @@ struct PlannerInfo
|
|
|
282
266
|
|
|
283
267
|
List *join_info_list; /* list of SpecialJoinInfos */
|
|
284
268
|
|
|
269
|
+
/*
|
|
270
|
+
* all_result_relids is empty for SELECT, otherwise it contains at least
|
|
271
|
+
* parse->resultRelation. For UPDATE/DELETE/MERGE across an inheritance
|
|
272
|
+
* or partitioning tree, the result rel's child relids are added. When
|
|
273
|
+
* using multi-level partitioning, intermediate partitioned rels are
|
|
274
|
+
* included. leaf_result_relids is similar except that only actual result
|
|
275
|
+
* tables, not partitioned tables, are included in it.
|
|
276
|
+
*/
|
|
277
|
+
Relids all_result_relids; /* set of all result relids */
|
|
278
|
+
Relids leaf_result_relids; /* set of all leaf relids */
|
|
279
|
+
|
|
285
280
|
/*
|
|
286
281
|
* Note: for AppendRelInfos describing partitions of a partitioned table,
|
|
287
282
|
* we guarantee that partitions that come earlier in the partitioned
|
|
@@ -289,6 +284,8 @@ struct PlannerInfo
|
|
|
289
284
|
*/
|
|
290
285
|
List *append_rel_list; /* list of AppendRelInfos */
|
|
291
286
|
|
|
287
|
+
List *row_identity_vars; /* list of RowIdentityVarInfos */
|
|
288
|
+
|
|
292
289
|
List *rowMarks; /* list of PlanRowMarks */
|
|
293
290
|
|
|
294
291
|
List *placeholder_list; /* list of PlaceHolderInfos */
|
|
@@ -315,40 +312,55 @@ struct PlannerInfo
|
|
|
315
312
|
|
|
316
313
|
/*
|
|
317
314
|
* The fully-processed targetlist is kept here. It differs from
|
|
318
|
-
* parse->targetList in that (for INSERT
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
315
|
+
* parse->targetList in that (for INSERT) it's been reordered to match the
|
|
316
|
+
* target table, and defaults have been filled in. Also, additional
|
|
317
|
+
* resjunk targets may be present. preprocess_targetlist() does most of
|
|
318
|
+
* that work, but note that more resjunk targets can get added during
|
|
319
|
+
* appendrel expansion. (Hence, upper_targets mustn't get set up till
|
|
320
|
+
* after that.)
|
|
324
321
|
*/
|
|
325
322
|
List *processed_tlist;
|
|
326
323
|
|
|
324
|
+
/*
|
|
325
|
+
* For UPDATE, this list contains the target table's attribute numbers to
|
|
326
|
+
* which the first N entries of processed_tlist are to be assigned. (Any
|
|
327
|
+
* additional entries in processed_tlist must be resjunk.) DO NOT use the
|
|
328
|
+
* resnos in processed_tlist to identify the UPDATE target columns.
|
|
329
|
+
*/
|
|
330
|
+
List *update_colnos;
|
|
331
|
+
|
|
327
332
|
/* Fields filled during create_plan() for use in setrefs.c */
|
|
328
333
|
AttrNumber *grouping_map; /* for GroupingFunc fixup */
|
|
329
334
|
List *minmax_aggs; /* List of MinMaxAggInfos */
|
|
330
335
|
|
|
331
336
|
MemoryContext planner_cxt; /* context holding PlannerInfo */
|
|
332
337
|
|
|
333
|
-
|
|
338
|
+
Cardinality total_table_pages; /* # of pages in all non-dummy tables of
|
|
334
339
|
* query */
|
|
335
340
|
|
|
336
|
-
|
|
337
|
-
|
|
341
|
+
Selectivity tuple_fraction; /* tuple_fraction passed to query_planner */
|
|
342
|
+
Cardinality limit_tuples; /* limit_tuples passed to query_planner */
|
|
338
343
|
|
|
339
344
|
Index qual_security_level; /* minimum security_level for quals */
|
|
340
345
|
/* Note: qual_security_level is zero if there are no securityQuals */
|
|
341
346
|
|
|
342
|
-
InheritanceKind inhTargetKind; /* indicates if the target relation is an
|
|
343
|
-
* inheritance child or partition or a
|
|
344
|
-
* partitioned table */
|
|
345
347
|
bool hasJoinRTEs; /* true if any RTEs are RTE_JOIN kind */
|
|
346
348
|
bool hasLateralRTEs; /* true if any RTEs are marked LATERAL */
|
|
347
349
|
bool hasHavingQual; /* true if havingQual was non-null */
|
|
348
350
|
bool hasPseudoConstantQuals; /* true if any RestrictInfo has
|
|
349
351
|
* pseudoconstant = true */
|
|
352
|
+
bool hasAlternativeSubPlans; /* true if we've made any of those */
|
|
350
353
|
bool hasRecursion; /* true if planning a recursive WITH item */
|
|
351
354
|
|
|
355
|
+
/*
|
|
356
|
+
* Information about aggregates. Filled by preprocess_aggrefs().
|
|
357
|
+
*/
|
|
358
|
+
List *agginfos; /* AggInfo structs */
|
|
359
|
+
List *aggtransinfos; /* AggTransInfo structs */
|
|
360
|
+
int numOrderedAggs; /* number w/ DISTINCT/ORDER BY/WITHIN GROUP */
|
|
361
|
+
bool hasNonPartialAggs; /* does any agg not support partial mode? */
|
|
362
|
+
bool hasNonSerialAggs; /* is any partial agg non-serializable? */
|
|
363
|
+
|
|
352
364
|
/* These fields are used only when hasRecursion is true: */
|
|
353
365
|
int wt_param_id; /* PARAM_EXEC ID for the work table */
|
|
354
366
|
struct Path *non_recursive_path; /* a path for non-recursive term */
|
|
@@ -357,6 +369,10 @@ struct PlannerInfo
|
|
|
357
369
|
Relids curOuterRels; /* outer rels above current node */
|
|
358
370
|
List *curOuterParams; /* not-yet-assigned NestLoopParams */
|
|
359
371
|
|
|
372
|
+
/* These fields are workspace for setrefs.c */
|
|
373
|
+
bool *isAltSubplan; /* array corresponding to glob->subplans */
|
|
374
|
+
bool *isUsedSubplan; /* array corresponding to glob->subplans */
|
|
375
|
+
|
|
360
376
|
/* optional private data for join_search_hook, e.g., GEQO */
|
|
361
377
|
void *join_search_private;
|
|
362
378
|
|
|
@@ -602,9 +618,6 @@ typedef struct PartitionSchemeData *PartitionScheme;
|
|
|
602
618
|
* part_rels - RelOptInfos for each partition
|
|
603
619
|
* all_partrels - Relids set of all partition relids
|
|
604
620
|
* partexprs, nullable_partexprs - Partition key expressions
|
|
605
|
-
* partitioned_child_rels - RT indexes of unpruned partitions of
|
|
606
|
-
* this relation that are partitioned tables
|
|
607
|
-
* themselves, in hierarchical order
|
|
608
621
|
*
|
|
609
622
|
* The partexprs and nullable_partexprs arrays each contain
|
|
610
623
|
* part_scheme->partnatts elements. Each of the elements is a list of
|
|
@@ -620,6 +633,10 @@ typedef struct PartitionSchemeData *PartitionScheme;
|
|
|
620
633
|
* to simplify matching join clauses to those lists.
|
|
621
634
|
*----------
|
|
622
635
|
*/
|
|
636
|
+
|
|
637
|
+
/* Bitmask of flags supported by table AMs */
|
|
638
|
+
#define AMFLAG_HAS_TID_RANGE (1 << 0)
|
|
639
|
+
|
|
623
640
|
typedef enum RelOptKind
|
|
624
641
|
{
|
|
625
642
|
RELOPT_BASEREL,
|
|
@@ -665,7 +682,7 @@ typedef struct RelOptInfo
|
|
|
665
682
|
Relids relids; /* set of base relids (rangetable indexes) */
|
|
666
683
|
|
|
667
684
|
/* size estimates generated by planner */
|
|
668
|
-
|
|
685
|
+
Cardinality rows; /* estimated number of result tuples */
|
|
669
686
|
|
|
670
687
|
/* per-relation planner control flags */
|
|
671
688
|
bool consider_startup; /* keep cheap-startup-cost paths? */
|
|
@@ -702,13 +719,15 @@ typedef struct RelOptInfo
|
|
|
702
719
|
List *indexlist; /* list of IndexOptInfo */
|
|
703
720
|
List *statlist; /* list of StatisticExtInfo */
|
|
704
721
|
BlockNumber pages; /* size estimates derived from pg_class */
|
|
705
|
-
|
|
722
|
+
Cardinality tuples;
|
|
706
723
|
double allvisfrac;
|
|
707
724
|
Bitmapset *eclass_indexes; /* Indexes in PlannerInfo's eq_classes list of
|
|
708
725
|
* ECs that mention this rel */
|
|
709
726
|
PlannerInfo *subroot; /* if subquery */
|
|
710
727
|
List *subplan_params; /* if subquery */
|
|
711
728
|
int rel_parallel_workers; /* wanted number of parallel workers */
|
|
729
|
+
uint32 amflags; /* Bitmask of optional features supported by
|
|
730
|
+
* the table AM */
|
|
712
731
|
|
|
713
732
|
/* Information about foreign tables and foreign joins */
|
|
714
733
|
Oid serverid; /* identifies server for the table or join */
|
|
@@ -749,10 +768,12 @@ typedef struct RelOptInfo
|
|
|
749
768
|
List *partition_qual; /* Partition constraint, if not the root */
|
|
750
769
|
struct RelOptInfo **part_rels; /* Array of RelOptInfos of partitions,
|
|
751
770
|
* stored in the same order as bounds */
|
|
771
|
+
Bitmapset *live_parts; /* Bitmap with members acting as indexes into
|
|
772
|
+
* the part_rels[] array to indicate which
|
|
773
|
+
* partitions survived partition pruning. */
|
|
752
774
|
Relids all_partrels; /* Relids set of all partition relids */
|
|
753
775
|
List **partexprs; /* Non-nullable partition key expressions */
|
|
754
776
|
List **nullable_partexprs; /* Nullable partition key expressions */
|
|
755
|
-
List *partitioned_child_rels; /* List of RT indexes */
|
|
756
777
|
} RelOptInfo;
|
|
757
778
|
|
|
758
779
|
/*
|
|
@@ -821,7 +842,7 @@ struct IndexOptInfo
|
|
|
821
842
|
|
|
822
843
|
/* index-size statistics (from pg_class and elsewhere) */
|
|
823
844
|
BlockNumber pages; /* number of disk pages in index */
|
|
824
|
-
|
|
845
|
+
Cardinality tuples; /* number of index tuples in index */
|
|
825
846
|
int tree_height; /* index tree height, or -1 if unknown */
|
|
826
847
|
|
|
827
848
|
/* index descriptor information */
|
|
@@ -891,10 +912,13 @@ typedef struct ForeignKeyOptInfo
|
|
|
891
912
|
|
|
892
913
|
/* Derived info about whether FK's equality conditions match the query: */
|
|
893
914
|
int nmatched_ec; /* # of FK cols matched by ECs */
|
|
915
|
+
int nconst_ec; /* # of these ECs that are ec_has_const */
|
|
894
916
|
int nmatched_rcols; /* # of FK cols matched by non-EC rinfos */
|
|
895
917
|
int nmatched_ri; /* total # of non-EC rinfos matched to FK */
|
|
896
918
|
/* Pointer to eclass matching each column's condition, if there is one */
|
|
897
919
|
struct EquivalenceClass *eclass[INDEX_MAX_KEYS];
|
|
920
|
+
/* Pointer to eclass member for the referencing Var, if there is one */
|
|
921
|
+
struct EquivalenceMember *fk_eclass_member[INDEX_MAX_KEYS];
|
|
898
922
|
/* List of non-EC RestrictInfos matching each column's condition */
|
|
899
923
|
List *rinfos[INDEX_MAX_KEYS];
|
|
900
924
|
} ForeignKeyOptInfo;
|
|
@@ -911,9 +935,11 @@ typedef struct StatisticExtInfo
|
|
|
911
935
|
NodeTag type;
|
|
912
936
|
|
|
913
937
|
Oid statOid; /* OID of the statistics row */
|
|
938
|
+
bool inherit; /* includes child relations */
|
|
914
939
|
RelOptInfo *rel; /* back-link to statistic's table */
|
|
915
940
|
char kind; /* statistics kind of this entry */
|
|
916
941
|
Bitmapset *keys; /* attnums of the columns covered */
|
|
942
|
+
List *exprs; /* expressions */
|
|
917
943
|
} StatisticExtInfo;
|
|
918
944
|
|
|
919
945
|
/*
|
|
@@ -1045,6 +1071,17 @@ typedef struct PathKey
|
|
|
1045
1071
|
bool pk_nulls_first; /* do NULLs come before normal values? */
|
|
1046
1072
|
} PathKey;
|
|
1047
1073
|
|
|
1074
|
+
/*
|
|
1075
|
+
* VolatileFunctionStatus -- allows nodes to cache their
|
|
1076
|
+
* contain_volatile_functions properties. VOLATILITY_UNKNOWN means not yet
|
|
1077
|
+
* determined.
|
|
1078
|
+
*/
|
|
1079
|
+
typedef enum VolatileFunctionStatus
|
|
1080
|
+
{
|
|
1081
|
+
VOLATILITY_UNKNOWN = 0,
|
|
1082
|
+
VOLATILITY_VOLATILE,
|
|
1083
|
+
VOLATILITY_NOVOLATILE
|
|
1084
|
+
} VolatileFunctionStatus;
|
|
1048
1085
|
|
|
1049
1086
|
/*
|
|
1050
1087
|
* PathTarget
|
|
@@ -1076,6 +1113,8 @@ typedef struct PathTarget
|
|
|
1076
1113
|
Index *sortgrouprefs; /* corresponding sort/group refnos, or 0 */
|
|
1077
1114
|
QualCost cost; /* cost of evaluating the expressions */
|
|
1078
1115
|
int width; /* estimated avg width of result tuples */
|
|
1116
|
+
VolatileFunctionStatus has_volatile_expr; /* indicates if exprs contain
|
|
1117
|
+
* any volatile functions. */
|
|
1079
1118
|
} PathTarget;
|
|
1080
1119
|
|
|
1081
1120
|
/* Convenience macro to get a sort/group refno from a PathTarget */
|
|
@@ -1102,7 +1141,7 @@ typedef struct ParamPathInfo
|
|
|
1102
1141
|
NodeTag type;
|
|
1103
1142
|
|
|
1104
1143
|
Relids ppi_req_outer; /* rels supplying parameters used by path */
|
|
1105
|
-
|
|
1144
|
+
Cardinality ppi_rows; /* estimated number of result tuples */
|
|
1106
1145
|
List *ppi_clauses; /* join clauses available from outer rels */
|
|
1107
1146
|
} ParamPathInfo;
|
|
1108
1147
|
|
|
@@ -1152,7 +1191,7 @@ typedef struct Path
|
|
|
1152
1191
|
int parallel_workers; /* desired # of workers; 0 = not parallel */
|
|
1153
1192
|
|
|
1154
1193
|
/* estimated size/costs for path (see costsize.c for more info) */
|
|
1155
|
-
|
|
1194
|
+
Cardinality rows; /* estimated number of result tuples */
|
|
1156
1195
|
Cost startup_cost; /* cost expended before fetching any tuples */
|
|
1157
1196
|
Cost total_cost; /* total cost (assuming all tuples fetched) */
|
|
1158
1197
|
|
|
@@ -1320,6 +1359,18 @@ typedef struct TidPath
|
|
|
1320
1359
|
List *tidquals; /* qual(s) involving CTID = something */
|
|
1321
1360
|
} TidPath;
|
|
1322
1361
|
|
|
1362
|
+
/*
|
|
1363
|
+
* TidRangePath represents a scan by a contiguous range of TIDs
|
|
1364
|
+
*
|
|
1365
|
+
* tidrangequals is an implicitly AND'ed list of qual expressions of the form
|
|
1366
|
+
* "CTID relop pseudoconstant", where relop is one of >,>=,<,<=.
|
|
1367
|
+
*/
|
|
1368
|
+
typedef struct TidRangePath
|
|
1369
|
+
{
|
|
1370
|
+
Path path;
|
|
1371
|
+
List *tidrangequals;
|
|
1372
|
+
} TidRangePath;
|
|
1373
|
+
|
|
1323
1374
|
/*
|
|
1324
1375
|
* SubqueryScanPath represents a scan of an unflattened subquery-in-FROM
|
|
1325
1376
|
*
|
|
@@ -1400,12 +1451,10 @@ typedef struct CustomPath
|
|
|
1400
1451
|
typedef struct AppendPath
|
|
1401
1452
|
{
|
|
1402
1453
|
Path path;
|
|
1403
|
-
/* RT indexes of non-leaf tables in a partition tree */
|
|
1404
|
-
List *partitioned_rels;
|
|
1405
1454
|
List *subpaths; /* list of component Paths */
|
|
1406
1455
|
/* Index of first partial path in subpaths; list_length(subpaths) if none */
|
|
1407
1456
|
int first_partial_path;
|
|
1408
|
-
|
|
1457
|
+
Cardinality limit_tuples; /* hard limit on output tuples, or -1 */
|
|
1409
1458
|
} AppendPath;
|
|
1410
1459
|
|
|
1411
1460
|
#define IS_DUMMY_APPEND(p) \
|
|
@@ -1426,10 +1475,8 @@ extern bool is_dummy_rel(RelOptInfo *rel);
|
|
|
1426
1475
|
typedef struct MergeAppendPath
|
|
1427
1476
|
{
|
|
1428
1477
|
Path path;
|
|
1429
|
-
/* RT indexes of non-leaf tables in a partition tree */
|
|
1430
|
-
List *partitioned_rels;
|
|
1431
1478
|
List *subpaths; /* list of component Paths */
|
|
1432
|
-
|
|
1479
|
+
Cardinality limit_tuples; /* hard limit on output tuples, or -1 */
|
|
1433
1480
|
} MergeAppendPath;
|
|
1434
1481
|
|
|
1435
1482
|
/*
|
|
@@ -1457,6 +1504,27 @@ typedef struct MaterialPath
|
|
|
1457
1504
|
Path *subpath;
|
|
1458
1505
|
} MaterialPath;
|
|
1459
1506
|
|
|
1507
|
+
/*
|
|
1508
|
+
* MemoizePath represents a Memoize plan node, i.e., a cache that caches
|
|
1509
|
+
* tuples from parameterized paths to save the underlying node from having to
|
|
1510
|
+
* be rescanned for parameter values which are already cached.
|
|
1511
|
+
*/
|
|
1512
|
+
typedef struct MemoizePath
|
|
1513
|
+
{
|
|
1514
|
+
Path path;
|
|
1515
|
+
Path *subpath; /* outerpath to cache tuples from */
|
|
1516
|
+
List *hash_operators; /* hash operators for each key */
|
|
1517
|
+
List *param_exprs; /* cache keys */
|
|
1518
|
+
bool singlerow; /* true if the cache entry is to be marked as
|
|
1519
|
+
* complete after caching the first record. */
|
|
1520
|
+
bool binary_mode; /* true when cache key should be compared bit
|
|
1521
|
+
* by bit, false when using hash equality ops */
|
|
1522
|
+
Cardinality calls; /* expected number of rescans */
|
|
1523
|
+
uint32 est_entries; /* The maximum number of entries that the
|
|
1524
|
+
* planner expects will fit in the cache, or 0
|
|
1525
|
+
* if unknown */
|
|
1526
|
+
} MemoizePath;
|
|
1527
|
+
|
|
1460
1528
|
/*
|
|
1461
1529
|
* UniquePath represents elimination of distinct rows from the output of
|
|
1462
1530
|
* its subpath.
|
|
@@ -1469,7 +1537,7 @@ typedef struct MaterialPath
|
|
|
1469
1537
|
* it's convenient to have a UniquePath in the path tree to signal upper-level
|
|
1470
1538
|
* routines that the input is known distinct.)
|
|
1471
1539
|
*/
|
|
1472
|
-
typedef enum
|
|
1540
|
+
typedef enum UniquePathMethod
|
|
1473
1541
|
{
|
|
1474
1542
|
UNIQUE_PATH_NOOP, /* input is known unique already */
|
|
1475
1543
|
UNIQUE_PATH_HASH, /* use hashing */
|
|
@@ -1539,7 +1607,10 @@ typedef struct JoinPath
|
|
|
1539
1607
|
* A nested-loop path needs no special fields.
|
|
1540
1608
|
*/
|
|
1541
1609
|
|
|
1542
|
-
typedef
|
|
1610
|
+
typedef struct NestPath
|
|
1611
|
+
{
|
|
1612
|
+
JoinPath jpath;
|
|
1613
|
+
} NestPath;
|
|
1543
1614
|
|
|
1544
1615
|
/*
|
|
1545
1616
|
* A mergejoin path has these fields.
|
|
@@ -1600,7 +1671,7 @@ typedef struct HashPath
|
|
|
1600
1671
|
JoinPath jpath;
|
|
1601
1672
|
List *path_hashclauses; /* join clauses used for hashing */
|
|
1602
1673
|
int num_batches; /* number of batches expected */
|
|
1603
|
-
|
|
1674
|
+
Cardinality inner_rows_total; /* total inner rows expected */
|
|
1604
1675
|
} HashPath;
|
|
1605
1676
|
|
|
1606
1677
|
/*
|
|
@@ -1703,7 +1774,7 @@ typedef struct AggPath
|
|
|
1703
1774
|
Path *subpath; /* path representing input source */
|
|
1704
1775
|
AggStrategy aggstrategy; /* basic strategy, see nodes.h */
|
|
1705
1776
|
AggSplit aggsplit; /* agg-splitting mode, see nodes.h */
|
|
1706
|
-
|
|
1777
|
+
Cardinality numGroups; /* estimated number of groups in input */
|
|
1707
1778
|
uint64 transitionSpace; /* for pass-by-ref transition data */
|
|
1708
1779
|
List *groupClause; /* a list of SortGroupClause's */
|
|
1709
1780
|
List *qual; /* quals (HAVING quals), if any */
|
|
@@ -1717,7 +1788,7 @@ typedef struct GroupingSetData
|
|
|
1717
1788
|
{
|
|
1718
1789
|
NodeTag type;
|
|
1719
1790
|
List *set; /* grouping set as list of sortgrouprefs */
|
|
1720
|
-
|
|
1791
|
+
Cardinality numGroups; /* est. number of result groups */
|
|
1721
1792
|
} GroupingSetData;
|
|
1722
1793
|
|
|
1723
1794
|
typedef struct RollupData
|
|
@@ -1726,7 +1797,7 @@ typedef struct RollupData
|
|
|
1726
1797
|
List *groupClause; /* applicable subset of parse->groupClause */
|
|
1727
1798
|
List *gsets; /* lists of integer indexes into groupClause */
|
|
1728
1799
|
List *gsets_data; /* list of GroupingSetData */
|
|
1729
|
-
|
|
1800
|
+
Cardinality numGroups; /* est. number of result groups */
|
|
1730
1801
|
bool hashable; /* can be hashed */
|
|
1731
1802
|
bool is_hashed; /* to be implemented as a hashagg */
|
|
1732
1803
|
} RollupData;
|
|
@@ -1763,6 +1834,9 @@ typedef struct WindowAggPath
|
|
|
1763
1834
|
Path path;
|
|
1764
1835
|
Path *subpath; /* path representing input source */
|
|
1765
1836
|
WindowClause *winclause; /* WindowClause we'll be using */
|
|
1837
|
+
List *qual; /* lower-level WindowAgg runconditions */
|
|
1838
|
+
bool topwindow; /* false for all apart from the WindowAgg
|
|
1839
|
+
* that's closest to the root of the plan */
|
|
1766
1840
|
} WindowAggPath;
|
|
1767
1841
|
|
|
1768
1842
|
/*
|
|
@@ -1777,7 +1851,7 @@ typedef struct SetOpPath
|
|
|
1777
1851
|
List *distinctList; /* SortGroupClauses identifying target cols */
|
|
1778
1852
|
AttrNumber flagColIdx; /* where is the flag column, if any */
|
|
1779
1853
|
int firstFlag; /* flag value for first input relation */
|
|
1780
|
-
|
|
1854
|
+
Cardinality numGroups; /* estimated number of groups in input */
|
|
1781
1855
|
} SetOpPath;
|
|
1782
1856
|
|
|
1783
1857
|
/*
|
|
@@ -1790,7 +1864,7 @@ typedef struct RecursiveUnionPath
|
|
|
1790
1864
|
Path *rightpath;
|
|
1791
1865
|
List *distinctList; /* SortGroupClauses identifying target cols */
|
|
1792
1866
|
int wtParam; /* ID of Param representing work table */
|
|
1793
|
-
|
|
1867
|
+
Cardinality numGroups; /* estimated number of groups in input */
|
|
1794
1868
|
} RecursiveUnionPath;
|
|
1795
1869
|
|
|
1796
1870
|
/*
|
|
@@ -1805,28 +1879,30 @@ typedef struct LockRowsPath
|
|
|
1805
1879
|
} LockRowsPath;
|
|
1806
1880
|
|
|
1807
1881
|
/*
|
|
1808
|
-
* ModifyTablePath represents performing INSERT/UPDATE/DELETE
|
|
1882
|
+
* ModifyTablePath represents performing INSERT/UPDATE/DELETE/MERGE
|
|
1809
1883
|
*
|
|
1810
1884
|
* We represent most things that will be in the ModifyTable plan node
|
|
1811
|
-
* literally, except we have child Path
|
|
1885
|
+
* literally, except we have a child Path not Plan. But analysis of the
|
|
1812
1886
|
* OnConflictExpr is deferred to createplan.c, as is collection of FDW data.
|
|
1813
1887
|
*/
|
|
1814
1888
|
typedef struct ModifyTablePath
|
|
1815
1889
|
{
|
|
1816
1890
|
Path path;
|
|
1817
|
-
|
|
1891
|
+
Path *subpath; /* Path producing source data */
|
|
1892
|
+
CmdType operation; /* INSERT, UPDATE, DELETE, or MERGE */
|
|
1818
1893
|
bool canSetTag; /* do we set the command tag/es_processed? */
|
|
1819
1894
|
Index nominalRelation; /* Parent RT index for use of EXPLAIN */
|
|
1820
1895
|
Index rootRelation; /* Root RT index, if target is partitioned */
|
|
1821
|
-
bool partColsUpdated; /* some part key in hierarchy updated */
|
|
1896
|
+
bool partColsUpdated; /* some part key in hierarchy updated? */
|
|
1822
1897
|
List *resultRelations; /* integer list of RT indexes */
|
|
1823
|
-
List *
|
|
1824
|
-
List *subroots; /* per-target-table PlannerInfos */
|
|
1898
|
+
List *updateColnosLists; /* per-target-table update_colnos lists */
|
|
1825
1899
|
List *withCheckOptionLists; /* per-target-table WCO lists */
|
|
1826
1900
|
List *returningLists; /* per-target-table RETURNING tlists */
|
|
1827
1901
|
List *rowMarks; /* PlanRowMarks (non-locking only) */
|
|
1828
1902
|
OnConflictExpr *onconflict; /* ON CONFLICT clause, or NULL */
|
|
1829
1903
|
int epqParam; /* ID of Param for EvalPlanQual re-eval */
|
|
1904
|
+
List *mergeActionLists; /* per-target-table lists of actions for
|
|
1905
|
+
* MERGE */
|
|
1830
1906
|
} ModifyTablePath;
|
|
1831
1907
|
|
|
1832
1908
|
/*
|
|
@@ -1998,6 +2074,9 @@ typedef struct RestrictInfo
|
|
|
1998
2074
|
|
|
1999
2075
|
bool leakproof; /* true if known to contain no leaked Vars */
|
|
2000
2076
|
|
|
2077
|
+
VolatileFunctionStatus has_volatile; /* to indicate if clause contains
|
|
2078
|
+
* any volatile functions. */
|
|
2079
|
+
|
|
2001
2080
|
Index security_level; /* see comment above */
|
|
2002
2081
|
|
|
2003
2082
|
/* The set of relids (varnos) actually referenced in the clause: */
|
|
@@ -2051,6 +2130,10 @@ typedef struct RestrictInfo
|
|
|
2051
2130
|
Selectivity right_bucketsize; /* avg bucketsize of right side */
|
|
2052
2131
|
Selectivity left_mcvfreq; /* left side's most common val's freq */
|
|
2053
2132
|
Selectivity right_mcvfreq; /* right side's most common val's freq */
|
|
2133
|
+
|
|
2134
|
+
/* hash equality operators used for memoize nodes, else InvalidOid */
|
|
2135
|
+
Oid left_hasheqoperator;
|
|
2136
|
+
Oid right_hasheqoperator;
|
|
2054
2137
|
} RestrictInfo;
|
|
2055
2138
|
|
|
2056
2139
|
/*
|
|
@@ -2277,6 +2360,34 @@ typedef struct AppendRelInfo
|
|
|
2277
2360
|
Oid parent_reloid; /* OID of parent relation */
|
|
2278
2361
|
} AppendRelInfo;
|
|
2279
2362
|
|
|
2363
|
+
/*
|
|
2364
|
+
* Information about a row-identity "resjunk" column in UPDATE/DELETE/MERGE.
|
|
2365
|
+
*
|
|
2366
|
+
* In partitioned UPDATE/DELETE/MERGE it's important for child partitions to
|
|
2367
|
+
* share row-identity columns whenever possible, so as not to chew up too many
|
|
2368
|
+
* targetlist columns. We use these structs to track which identity columns
|
|
2369
|
+
* have been requested. In the finished plan, each of these will give rise
|
|
2370
|
+
* to one resjunk entry in the targetlist of the ModifyTable's subplan node.
|
|
2371
|
+
*
|
|
2372
|
+
* All the Vars stored in RowIdentityVarInfos must have varno ROWID_VAR, for
|
|
2373
|
+
* convenience of detecting duplicate requests. We'll replace that, in the
|
|
2374
|
+
* final plan, with the varno of the generating rel.
|
|
2375
|
+
*
|
|
2376
|
+
* Outside this list, a Var with varno ROWID_VAR and varattno k is a reference
|
|
2377
|
+
* to the k-th element of the row_identity_vars list (k counting from 1).
|
|
2378
|
+
* We add such a reference to root->processed_tlist when creating the entry,
|
|
2379
|
+
* and it propagates into the plan tree from there.
|
|
2380
|
+
*/
|
|
2381
|
+
typedef struct RowIdentityVarInfo
|
|
2382
|
+
{
|
|
2383
|
+
NodeTag type;
|
|
2384
|
+
|
|
2385
|
+
Var *rowidvar; /* Var to be evaluated (but varno=ROWID_VAR) */
|
|
2386
|
+
int32 rowidwidth; /* estimated average width */
|
|
2387
|
+
char *rowidname; /* name of the resjunk column */
|
|
2388
|
+
Relids rowidrels; /* RTE indexes of target rels using this */
|
|
2389
|
+
} RowIdentityVarInfo;
|
|
2390
|
+
|
|
2280
2391
|
/*
|
|
2281
2392
|
* For each distinct placeholder expression generated during planning, we
|
|
2282
2393
|
* store a PlaceHolderInfo node in the PlannerInfo node's placeholder_list.
|
|
@@ -2511,7 +2622,7 @@ typedef struct
|
|
|
2511
2622
|
typedef struct
|
|
2512
2623
|
{
|
|
2513
2624
|
bool limit_needed;
|
|
2514
|
-
|
|
2625
|
+
Cardinality limit_tuples;
|
|
2515
2626
|
int64 count_est;
|
|
2516
2627
|
int64 offset_est;
|
|
2517
2628
|
} FinalPathExtraData;
|
|
@@ -2542,15 +2653,82 @@ typedef struct JoinCostWorkspace
|
|
|
2542
2653
|
Cost inner_rescan_run_cost;
|
|
2543
2654
|
|
|
2544
2655
|
/* private for cost_mergejoin code */
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2656
|
+
Cardinality outer_rows;
|
|
2657
|
+
Cardinality inner_rows;
|
|
2658
|
+
Cardinality outer_skip_rows;
|
|
2659
|
+
Cardinality inner_skip_rows;
|
|
2549
2660
|
|
|
2550
2661
|
/* private for cost_hashjoin code */
|
|
2551
2662
|
int numbuckets;
|
|
2552
2663
|
int numbatches;
|
|
2553
|
-
|
|
2664
|
+
Cardinality inner_rows_total;
|
|
2554
2665
|
} JoinCostWorkspace;
|
|
2555
2666
|
|
|
2667
|
+
/*
|
|
2668
|
+
* AggInfo holds information about an aggregate that needs to be computed.
|
|
2669
|
+
* Multiple Aggrefs in a query can refer to the same AggInfo by having the
|
|
2670
|
+
* same 'aggno' value, so that the aggregate is computed only once.
|
|
2671
|
+
*/
|
|
2672
|
+
typedef struct AggInfo
|
|
2673
|
+
{
|
|
2674
|
+
/*
|
|
2675
|
+
* Link to an Aggref expr this state value is for.
|
|
2676
|
+
*
|
|
2677
|
+
* There can be multiple identical Aggref's sharing the same per-agg. This
|
|
2678
|
+
* points to the first one of them.
|
|
2679
|
+
*/
|
|
2680
|
+
Aggref *representative_aggref;
|
|
2681
|
+
|
|
2682
|
+
int transno;
|
|
2683
|
+
|
|
2684
|
+
/*
|
|
2685
|
+
* "shareable" is false if this agg cannot share state values with other
|
|
2686
|
+
* aggregates because the final function is read-write.
|
|
2687
|
+
*/
|
|
2688
|
+
bool shareable;
|
|
2689
|
+
|
|
2690
|
+
/* Oid of the final function or InvalidOid */
|
|
2691
|
+
Oid finalfn_oid;
|
|
2692
|
+
|
|
2693
|
+
} AggInfo;
|
|
2694
|
+
|
|
2695
|
+
/*
|
|
2696
|
+
* AggTransInfo holds information about transition state that is used by one
|
|
2697
|
+
* or more aggregates in the query. Multiple aggregates can share the same
|
|
2698
|
+
* transition state, if they have the same inputs and the same transition
|
|
2699
|
+
* function. Aggrefs that share the same transition info have the same
|
|
2700
|
+
* 'aggtransno' value.
|
|
2701
|
+
*/
|
|
2702
|
+
typedef struct AggTransInfo
|
|
2703
|
+
{
|
|
2704
|
+
List *args;
|
|
2705
|
+
Expr *aggfilter;
|
|
2706
|
+
|
|
2707
|
+
/* Oid of the state transition function */
|
|
2708
|
+
Oid transfn_oid;
|
|
2709
|
+
|
|
2710
|
+
/* Oid of the serialization function or InvalidOid */
|
|
2711
|
+
Oid serialfn_oid;
|
|
2712
|
+
|
|
2713
|
+
/* Oid of the deserialization function or InvalidOid */
|
|
2714
|
+
Oid deserialfn_oid;
|
|
2715
|
+
|
|
2716
|
+
/* Oid of the combine function or InvalidOid */
|
|
2717
|
+
Oid combinefn_oid;
|
|
2718
|
+
|
|
2719
|
+
/* Oid of state value's datatype */
|
|
2720
|
+
Oid aggtranstype;
|
|
2721
|
+
int32 aggtranstypmod;
|
|
2722
|
+
int transtypeLen;
|
|
2723
|
+
bool transtypeByVal;
|
|
2724
|
+
int32 aggtransspace;
|
|
2725
|
+
|
|
2726
|
+
/*
|
|
2727
|
+
* initial value from pg_aggregate entry
|
|
2728
|
+
*/
|
|
2729
|
+
Datum initValue;
|
|
2730
|
+
bool initValueIsNull;
|
|
2731
|
+
|
|
2732
|
+
} AggTransInfo;
|
|
2733
|
+
|
|
2556
2734
|
#endif /* PATHNODES_H */
|