pg_query 2.2.1 → 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 +21 -1
- data/README.md +29 -33
- data/Rakefile +2 -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 +3 -1
- data/ext/pg_query/include/access/xact.h +73 -19
- data/ext/pg_query/include/access/xlog.h +60 -155
- data/ext/pg_query/include/access/xlog_internal.h +40 -13
- 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 +145 -39
- 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 +8 -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 +44 -14
- data/ext/pg_query/include/catalog/pg_class_d.h +30 -1
- 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 +3 -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 +18 -15
- 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 -7
- 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 +55 -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 +3 -4
- 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 +2 -2
- data/ext/pg_query/include/commands/trigger.h +18 -16
- 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 +140 -15
- 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 +30 -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 +105 -23
- data/ext/pg_query/include/mb/stringinfo_mb.h +1 -1
- data/ext/pg_query/include/miscadmin.h +47 -41
- data/ext/pg_query/include/nodes/bitmapset.h +1 -1
- data/ext/pg_query/include/nodes/execnodes.h +270 -78
- 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 +322 -90
- data/ext/pg_query/include/nodes/pathnodes.h +243 -66
- data/ext/pg_query/include/nodes/pg_list.h +75 -69
- data/ext/pg_query/include/nodes/plannodes.h +111 -28
- 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 -17
- 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 +3 -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 +83 -41
- 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 +939 -113
- data/ext/pg_query/include/pg_query_outfuncs_conds.c +43 -13
- data/ext/pg_query/include/pg_query_outfuncs_defs.c +151 -26
- data/ext/pg_query/include/pg_query_readfuncs_conds.c +11 -2
- data/ext/pg_query/include/pg_query_readfuncs_defs.c +173 -30
- data/ext/pg_query/include/pg_trace.h +1 -1
- data/ext/pg_query/include/pgstat.h +449 -1238
- 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 +40 -10
- 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 +71 -46
- 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 +1419 -914
- 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 +259 -42
- data/ext/pg_query/include/replication/slot.h +22 -11
- 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 +11 -8
- data/ext/pg_query/include/storage/lockdefs.h +2 -2
- data/ext/pg_query/include/storage/lwlock.h +5 -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 +173 -59
- 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 +60 -21
- 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 +1 -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 +10 -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 +4 -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 +10 -12
- 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 -19
- data/ext/pg_query/include/utils/relcache.h +8 -5
- 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 +34 -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 +4302 -2304
- data/ext/pg_query/pg_query_deparse.c +1106 -373
- data/ext/pg_query/pg_query_fingerprint.c +30 -10
- data/ext/pg_query/pg_query_json_plpgsql.c +0 -25
- data/ext/pg_query/pg_query_normalize.c +1 -1
- data/ext/pg_query/pg_query_outfuncs_json.c +54 -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_readfuncs_protobuf.c +42 -8
- 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 +20 -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 +401 -76
- data/ext/pg_query/src_backend_nodes_equalfuncs.c +290 -46
- data/ext/pg_query/src_backend_nodes_extensible.c +1 -1
- data/ext/pg_query/src_backend_nodes_list.c +74 -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 +33874 -31261
- data/ext/pg_query/src_backend_parser_parser.c +26 -7
- data/ext/pg_query/src_backend_parser_scan.c +172 -209
- 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 +62 -23
- 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 +71 -5
- 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 +206 -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 +701 -109
- data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +45 -20
- data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +1 -18
- data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1233 -1259
- 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 -31
- 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 +37 -13
- data/ext/pg_query/src_port_strerror.c +9 -19
- data/ext/pg_query/src_port_strnlen.c +1 -1
- data/lib/pg_query/filter_columns.rb +1 -1
- data/lib/pg_query/fingerprint.rb +5 -1
- data/lib/pg_query/node.rb +2 -2
- data/lib/pg_query/param_refs.rb +1 -1
- data/lib/pg_query/parse.rb +18 -8
- data/lib/pg_query/pg_query_pb.rb +1108 -942
- data/lib/pg_query/truncate.rb +1 -1
- data/lib/pg_query/version.rb +1 -1
- metadata +28 -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/pg_query_ruby_freebsd.sym +0 -2
- data/ext/pg_query/src_backend_libpq_pqcomm.c +0 -659
- 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
@@ -12,7 +12,7 @@
|
|
12
12
|
* identifying statement boundaries in multi-statement source strings.
|
13
13
|
*
|
14
14
|
*
|
15
|
-
* Portions Copyright (c) 1996-
|
15
|
+
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
|
16
16
|
* Portions Copyright (c) 1994, Regents of the University of California
|
17
17
|
*
|
18
18
|
* src/include/nodes/parsenodes.h
|
@@ -62,6 +62,14 @@ typedef enum SortByNulls
|
|
62
62
|
SORTBY_NULLS_LAST
|
63
63
|
} SortByNulls;
|
64
64
|
|
65
|
+
/* Options for [ ALL | DISTINCT ] */
|
66
|
+
typedef enum SetQuantifier
|
67
|
+
{
|
68
|
+
SET_QUANTIFIER_DEFAULT,
|
69
|
+
SET_QUANTIFIER_ALL,
|
70
|
+
SET_QUANTIFIER_DISTINCT
|
71
|
+
} SetQuantifier;
|
72
|
+
|
65
73
|
/*
|
66
74
|
* Grantable rights are encoded so that we can OR them together in a bitmask.
|
67
75
|
* The present representation of AclItem limits us to 16 distinct rights,
|
@@ -84,7 +92,9 @@ typedef uint32 AclMode; /* a bitmask of privilege bits */
|
|
84
92
|
#define ACL_CREATE (1<<9) /* for namespaces and databases */
|
85
93
|
#define ACL_CREATE_TEMP (1<<10) /* for databases */
|
86
94
|
#define ACL_CONNECT (1<<11) /* for databases */
|
87
|
-
#define
|
95
|
+
#define ACL_SET (1<<12) /* for configuration parameters */
|
96
|
+
#define ACL_ALTER_SYSTEM (1<<13) /* for configuration parameters */
|
97
|
+
#define N_ACL_RIGHTS 14 /* 1 plus the last 1<<x */
|
88
98
|
#define ACL_NO_RIGHTS 0
|
89
99
|
/* Currently, SELECT ... FOR [KEY] UPDATE/SHARE requires UPDATE privileges */
|
90
100
|
#define ACL_SELECT_FOR_UPDATE ACL_UPDATE
|
@@ -109,7 +119,7 @@ typedef struct Query
|
|
109
119
|
{
|
110
120
|
NodeTag type;
|
111
121
|
|
112
|
-
CmdType commandType; /* select|insert|update|delete|utility */
|
122
|
+
CmdType commandType; /* select|insert|update|delete|merge|utility */
|
113
123
|
|
114
124
|
QuerySource querySource; /* where did I come from? */
|
115
125
|
|
@@ -120,7 +130,7 @@ typedef struct Query
|
|
120
130
|
Node *utilityStmt; /* non-null if commandType == CMD_UTILITY */
|
121
131
|
|
122
132
|
int resultRelation; /* rtable index of target relation for
|
123
|
-
* INSERT/UPDATE/DELETE; 0 for SELECT */
|
133
|
+
* INSERT/UPDATE/DELETE/MERGE; 0 for SELECT */
|
124
134
|
|
125
135
|
bool hasAggs; /* has aggregates in tlist or havingQual */
|
126
136
|
bool hasWindowFuncs; /* has window functions in tlist */
|
@@ -132,10 +142,16 @@ typedef struct Query
|
|
132
142
|
bool hasForUpdate; /* FOR [KEY] UPDATE/SHARE was specified */
|
133
143
|
bool hasRowSecurity; /* rewriter has applied some RLS policy */
|
134
144
|
|
145
|
+
bool isReturn; /* is a RETURN statement */
|
146
|
+
|
135
147
|
List *cteList; /* WITH list (of CommonTableExpr's) */
|
136
148
|
|
137
149
|
List *rtable; /* list of range table entries */
|
138
|
-
FromExpr *jointree; /* table join tree (FROM and WHERE clauses)
|
150
|
+
FromExpr *jointree; /* table join tree (FROM and WHERE clauses);
|
151
|
+
* also USING clause for MERGE */
|
152
|
+
|
153
|
+
List *mergeActionList; /* list of actions for MERGE (only) */
|
154
|
+
bool mergeUseOuterJoin; /* whether to use outer join */
|
139
155
|
|
140
156
|
List *targetList; /* target list (of TargetEntry) */
|
141
157
|
|
@@ -146,6 +162,7 @@ typedef struct Query
|
|
146
162
|
List *returningList; /* return-values list (of TargetEntry) */
|
147
163
|
|
148
164
|
List *groupClause; /* a list of SortGroupClause's */
|
165
|
+
bool groupDistinct; /* is the group by clause distinct? */
|
149
166
|
|
150
167
|
List *groupingSets; /* a list of GroupingSet's if present */
|
151
168
|
|
@@ -207,7 +224,7 @@ typedef struct Query
|
|
207
224
|
typedef struct TypeName
|
208
225
|
{
|
209
226
|
NodeTag type;
|
210
|
-
List *names; /* qualified name (list of
|
227
|
+
List *names; /* qualified name (list of String nodes) */
|
211
228
|
Oid typeOid; /* type identified by OID */
|
212
229
|
bool setof; /* is a set? */
|
213
230
|
bool pct_type; /* %TYPE specified? */
|
@@ -220,7 +237,7 @@ typedef struct TypeName
|
|
220
237
|
/*
|
221
238
|
* ColumnRef - specifies a reference to a column, or possibly a whole tuple
|
222
239
|
*
|
223
|
-
* The "fields" list must be nonempty. It can contain
|
240
|
+
* The "fields" list must be nonempty. It can contain String nodes
|
224
241
|
* (representing names) and A_Star nodes (representing occurrence of a '*').
|
225
242
|
* Currently, A_Star must appear only as the last list element --- the grammar
|
226
243
|
* is responsible for enforcing this!
|
@@ -233,7 +250,7 @@ typedef struct TypeName
|
|
233
250
|
typedef struct ColumnRef
|
234
251
|
{
|
235
252
|
NodeTag type;
|
236
|
-
List *fields; /* field names (
|
253
|
+
List *fields; /* field names (String nodes) or A_Star */
|
237
254
|
int location; /* token location, or -1 if unknown */
|
238
255
|
} ColumnRef;
|
239
256
|
|
@@ -258,7 +275,6 @@ typedef enum A_Expr_Kind
|
|
258
275
|
AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */
|
259
276
|
AEXPR_NOT_DISTINCT, /* IS NOT DISTINCT FROM - name must be "=" */
|
260
277
|
AEXPR_NULLIF, /* NULLIF - name must be "=" */
|
261
|
-
AEXPR_OF, /* IS [NOT] OF - name must be "=" or "<>" */
|
262
278
|
AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */
|
263
279
|
AEXPR_LIKE, /* [NOT] LIKE - name must be "~~" or "!~~" */
|
264
280
|
AEXPR_ILIKE, /* [NOT] ILIKE - name must be "~~*" or "!~~*" */
|
@@ -266,8 +282,7 @@ typedef enum A_Expr_Kind
|
|
266
282
|
AEXPR_BETWEEN, /* name must be "BETWEEN" */
|
267
283
|
AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */
|
268
284
|
AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */
|
269
|
-
AEXPR_NOT_BETWEEN_SYM
|
270
|
-
AEXPR_PAREN /* nameless dummy node for parentheses */
|
285
|
+
AEXPR_NOT_BETWEEN_SYM /* name must be "NOT BETWEEN SYMMETRIC" */
|
271
286
|
} A_Expr_Kind;
|
272
287
|
|
273
288
|
typedef struct A_Expr
|
@@ -286,7 +301,21 @@ typedef struct A_Expr
|
|
286
301
|
typedef struct A_Const
|
287
302
|
{
|
288
303
|
NodeTag type;
|
289
|
-
|
304
|
+
|
305
|
+
/*
|
306
|
+
* Value nodes are inline for performance. You can treat 'val' as a node,
|
307
|
+
* as in IsA(&val, Integer). 'val' is not valid if isnull is true.
|
308
|
+
*/
|
309
|
+
union ValUnion
|
310
|
+
{
|
311
|
+
Node node;
|
312
|
+
Integer ival;
|
313
|
+
Float fval;
|
314
|
+
Boolean boolval;
|
315
|
+
String sval;
|
316
|
+
BitString bsval;
|
317
|
+
} val;
|
318
|
+
bool isnull; /* SQL NULL constant */
|
290
319
|
int location; /* token location, or -1 if unknown */
|
291
320
|
} A_Const;
|
292
321
|
|
@@ -318,6 +347,7 @@ typedef struct CollateClause
|
|
318
347
|
typedef enum RoleSpecType
|
319
348
|
{
|
320
349
|
ROLESPEC_CSTRING, /* role name is stored as a C string */
|
350
|
+
ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */
|
321
351
|
ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
|
322
352
|
ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
|
323
353
|
ROLESPEC_PUBLIC /* role name is "public" */
|
@@ -352,11 +382,12 @@ typedef struct FuncCall
|
|
352
382
|
List *args; /* the arguments (list of exprs) */
|
353
383
|
List *agg_order; /* ORDER BY (list of SortBy) */
|
354
384
|
Node *agg_filter; /* FILTER clause, if any */
|
385
|
+
struct WindowDef *over; /* OVER clause, if any */
|
355
386
|
bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */
|
356
387
|
bool agg_star; /* argument was really '*' */
|
357
388
|
bool agg_distinct; /* arguments were labeled DISTINCT */
|
358
389
|
bool func_variadic; /* last argument was labeled VARIADIC */
|
359
|
-
|
390
|
+
CoercionForm funcformat; /* how to display this node */
|
360
391
|
int location; /* token location, or -1 if unknown */
|
361
392
|
} FuncCall;
|
362
393
|
|
@@ -389,7 +420,7 @@ typedef struct A_Indices
|
|
389
420
|
* A_Indirection - select a field and/or array element from an expression
|
390
421
|
*
|
391
422
|
* The indirection list can contain A_Indices nodes (representing
|
392
|
-
* subscripting),
|
423
|
+
* subscripting), String nodes (representing field selection --- the
|
393
424
|
* string value is the name of the field to select), and A_Star nodes
|
394
425
|
* (representing selection of all fields of a composite type).
|
395
426
|
* For example, a complex selection operation like
|
@@ -646,6 +677,7 @@ typedef struct ColumnDef
|
|
646
677
|
NodeTag type;
|
647
678
|
char *colname; /* name of column */
|
648
679
|
TypeName *typeName; /* type of column */
|
680
|
+
char *compression; /* compression method for column */
|
649
681
|
int inhcount; /* number of times column is inherited */
|
650
682
|
bool is_local; /* column has local (non-inherited) def'n */
|
651
683
|
bool is_not_null; /* NOT NULL constraint specified? */
|
@@ -678,13 +710,14 @@ typedef struct TableLikeClause
|
|
678
710
|
typedef enum TableLikeOption
|
679
711
|
{
|
680
712
|
CREATE_TABLE_LIKE_COMMENTS = 1 << 0,
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
713
|
+
CREATE_TABLE_LIKE_COMPRESSION = 1 << 1,
|
714
|
+
CREATE_TABLE_LIKE_CONSTRAINTS = 1 << 2,
|
715
|
+
CREATE_TABLE_LIKE_DEFAULTS = 1 << 3,
|
716
|
+
CREATE_TABLE_LIKE_GENERATED = 1 << 4,
|
717
|
+
CREATE_TABLE_LIKE_IDENTITY = 1 << 5,
|
718
|
+
CREATE_TABLE_LIKE_INDEXES = 1 << 6,
|
719
|
+
CREATE_TABLE_LIKE_STATISTICS = 1 << 7,
|
720
|
+
CREATE_TABLE_LIKE_STORAGE = 1 << 8,
|
688
721
|
CREATE_TABLE_LIKE_ALL = PG_INT32_MAX
|
689
722
|
} TableLikeOption;
|
690
723
|
|
@@ -731,7 +764,8 @@ typedef struct DefElem
|
|
731
764
|
NodeTag type;
|
732
765
|
char *defnamespace; /* NULL if unqualified name */
|
733
766
|
char *defname;
|
734
|
-
Node *arg; /*
|
767
|
+
Node *arg; /* typically Integer, Float, String, or
|
768
|
+
* TypeName */
|
735
769
|
DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */
|
736
770
|
int location; /* token location, or -1 if unknown */
|
737
771
|
} DefElem;
|
@@ -860,6 +894,7 @@ typedef struct PartitionCmd
|
|
860
894
|
NodeTag type;
|
861
895
|
RangeVar *name; /* name of partition to attach/detach */
|
862
896
|
PartitionBoundSpec *bound; /* FOR VALUES, if attaching */
|
897
|
+
bool concurrent;
|
863
898
|
} PartitionCmd;
|
864
899
|
|
865
900
|
/****************************************************************************
|
@@ -996,8 +1031,8 @@ typedef struct RangeTblEntry
|
|
996
1031
|
*
|
997
1032
|
* rellockmode is really LOCKMODE, but it's declared int to avoid having
|
998
1033
|
* to include lock-related headers here. It must be RowExclusiveLock if
|
999
|
-
* the RTE is an INSERT/UPDATE/DELETE target, else RowShareLock if
|
1000
|
-
* is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock.
|
1034
|
+
* the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if
|
1035
|
+
* the RTE is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock.
|
1001
1036
|
*
|
1002
1037
|
* Note: in some cases, rule expansion may result in RTEs that are marked
|
1003
1038
|
* with RowExclusiveLock even though they are not the target of the
|
@@ -1057,6 +1092,13 @@ typedef struct RangeTblEntry
|
|
1057
1092
|
List *joinleftcols; /* left-side input column numbers */
|
1058
1093
|
List *joinrightcols; /* right-side input column numbers */
|
1059
1094
|
|
1095
|
+
/*
|
1096
|
+
* join_using_alias is an alias clause attached directly to JOIN/USING. It
|
1097
|
+
* is different from the alias field (below) in that it does not hide the
|
1098
|
+
* range variables of the tables being joined.
|
1099
|
+
*/
|
1100
|
+
Alias *join_using_alias;
|
1101
|
+
|
1060
1102
|
/*
|
1061
1103
|
* Fields valid for a function RTE (else NIL/zero):
|
1062
1104
|
*
|
@@ -1111,7 +1153,7 @@ typedef struct RangeTblEntry
|
|
1111
1153
|
* Fields valid for ENR RTEs (else NULL/zero):
|
1112
1154
|
*/
|
1113
1155
|
char *enrname; /* name of ephemeral named relation */
|
1114
|
-
|
1156
|
+
Cardinality enrtuples; /* estimated or actual from caller */
|
1115
1157
|
|
1116
1158
|
/*
|
1117
1159
|
* Fields valid in all RTEs:
|
@@ -1185,7 +1227,9 @@ typedef enum WCOKind
|
|
1185
1227
|
WCO_VIEW_CHECK, /* WCO on an auto-updatable view */
|
1186
1228
|
WCO_RLS_INSERT_CHECK, /* RLS INSERT WITH CHECK policy */
|
1187
1229
|
WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */
|
1188
|
-
WCO_RLS_CONFLICT_CHECK /* RLS ON CONFLICT DO UPDATE USING policy */
|
1230
|
+
WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO UPDATE USING policy */
|
1231
|
+
WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */
|
1232
|
+
WCO_RLS_MERGE_DELETE_CHECK /* RLS MERGE DELETE USING policy */
|
1189
1233
|
} WCOKind;
|
1190
1234
|
|
1191
1235
|
typedef struct WithCheckOption
|
@@ -1316,7 +1360,7 @@ typedef struct SortGroupClause
|
|
1316
1360
|
*
|
1317
1361
|
* SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) )
|
1318
1362
|
*/
|
1319
|
-
typedef enum
|
1363
|
+
typedef enum GroupingSetKind
|
1320
1364
|
{
|
1321
1365
|
GROUPING_SET_EMPTY,
|
1322
1366
|
GROUPING_SET_SIMPLE,
|
@@ -1360,6 +1404,7 @@ typedef struct WindowClause
|
|
1360
1404
|
int frameOptions; /* frame_clause options, see WindowDef */
|
1361
1405
|
Node *startOffset; /* expression for starting bound, if any */
|
1362
1406
|
Node *endOffset; /* expression for ending bound, if any */
|
1407
|
+
List *runCondition; /* qual to help short-circuit execution */
|
1363
1408
|
Oid startInRangeFunc; /* in_range function for startOffset */
|
1364
1409
|
Oid endInRangeFunc; /* in_range function for endOffset */
|
1365
1410
|
Oid inRangeColl; /* collation for in_range tests */
|
@@ -1439,9 +1484,8 @@ typedef struct OnConflictClause
|
|
1439
1484
|
/*
|
1440
1485
|
* CommonTableExpr -
|
1441
1486
|
* representation of WITH list element
|
1442
|
-
*
|
1443
|
-
* We don't currently support the SEARCH or CYCLE clause.
|
1444
1487
|
*/
|
1488
|
+
|
1445
1489
|
typedef enum CTEMaterialize
|
1446
1490
|
{
|
1447
1491
|
CTEMaterializeDefault, /* no option specified */
|
@@ -1449,6 +1493,31 @@ typedef enum CTEMaterialize
|
|
1449
1493
|
CTEMaterializeNever /* NOT MATERIALIZED */
|
1450
1494
|
} CTEMaterialize;
|
1451
1495
|
|
1496
|
+
typedef struct CTESearchClause
|
1497
|
+
{
|
1498
|
+
NodeTag type;
|
1499
|
+
List *search_col_list;
|
1500
|
+
bool search_breadth_first;
|
1501
|
+
char *search_seq_column;
|
1502
|
+
int location;
|
1503
|
+
} CTESearchClause;
|
1504
|
+
|
1505
|
+
typedef struct CTECycleClause
|
1506
|
+
{
|
1507
|
+
NodeTag type;
|
1508
|
+
List *cycle_col_list;
|
1509
|
+
char *cycle_mark_column;
|
1510
|
+
Node *cycle_mark_value;
|
1511
|
+
Node *cycle_mark_default;
|
1512
|
+
char *cycle_path_column;
|
1513
|
+
int location;
|
1514
|
+
/* These fields are set during parse analysis: */
|
1515
|
+
Oid cycle_mark_type; /* common type of _value and _default */
|
1516
|
+
int cycle_mark_typmod;
|
1517
|
+
Oid cycle_mark_collation;
|
1518
|
+
Oid cycle_mark_neop; /* <> operator for type */
|
1519
|
+
} CTECycleClause;
|
1520
|
+
|
1452
1521
|
typedef struct CommonTableExpr
|
1453
1522
|
{
|
1454
1523
|
NodeTag type;
|
@@ -1457,6 +1526,8 @@ typedef struct CommonTableExpr
|
|
1457
1526
|
CTEMaterialize ctematerialized; /* is this an optimization fence? */
|
1458
1527
|
/* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */
|
1459
1528
|
Node *ctequery; /* the CTE's subquery */
|
1529
|
+
CTESearchClause *search_clause;
|
1530
|
+
CTECycleClause *cycle_clause;
|
1460
1531
|
int location; /* token location, or -1 if unknown */
|
1461
1532
|
/* These fields are set during parse analysis: */
|
1462
1533
|
bool cterecursive; /* is this CTE actually recursive? */
|
@@ -1475,6 +1546,39 @@ typedef struct CommonTableExpr
|
|
1475
1546
|
((Query *) (cte)->ctequery)->targetList : \
|
1476
1547
|
((Query *) (cte)->ctequery)->returningList)
|
1477
1548
|
|
1549
|
+
/*
|
1550
|
+
* MergeWhenClause -
|
1551
|
+
* raw parser representation of a WHEN clause in a MERGE statement
|
1552
|
+
*
|
1553
|
+
* This is transformed into MergeAction by parse analysis
|
1554
|
+
*/
|
1555
|
+
typedef struct MergeWhenClause
|
1556
|
+
{
|
1557
|
+
NodeTag type;
|
1558
|
+
bool matched; /* true=MATCHED, false=NOT MATCHED */
|
1559
|
+
CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
|
1560
|
+
OverridingKind override; /* OVERRIDING clause */
|
1561
|
+
Node *condition; /* WHEN conditions (raw parser) */
|
1562
|
+
List *targetList; /* INSERT/UPDATE targetlist */
|
1563
|
+
/* the following members are only used in INSERT actions */
|
1564
|
+
List *values; /* VALUES to INSERT, or NULL */
|
1565
|
+
} MergeWhenClause;
|
1566
|
+
|
1567
|
+
/*
|
1568
|
+
* MergeAction -
|
1569
|
+
* Transformed representation of a WHEN clause in a MERGE statement
|
1570
|
+
*/
|
1571
|
+
typedef struct MergeAction
|
1572
|
+
{
|
1573
|
+
NodeTag type;
|
1574
|
+
bool matched; /* true=MATCHED, false=NOT MATCHED */
|
1575
|
+
CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
|
1576
|
+
OverridingKind override; /* OVERRIDING clause */
|
1577
|
+
Node *qual; /* transformed WHEN conditions */
|
1578
|
+
List *targetList; /* the target list (of TargetEntry) */
|
1579
|
+
List *updateColnos; /* target attribute numbers of an UPDATE */
|
1580
|
+
} MergeAction;
|
1581
|
+
|
1478
1582
|
/*
|
1479
1583
|
* TriggerTransition -
|
1480
1584
|
* representation of transition row or table naming clause
|
@@ -1568,6 +1672,20 @@ typedef struct UpdateStmt
|
|
1568
1672
|
WithClause *withClause; /* WITH clause */
|
1569
1673
|
} UpdateStmt;
|
1570
1674
|
|
1675
|
+
/* ----------------------
|
1676
|
+
* Merge Statement
|
1677
|
+
* ----------------------
|
1678
|
+
*/
|
1679
|
+
typedef struct MergeStmt
|
1680
|
+
{
|
1681
|
+
NodeTag type;
|
1682
|
+
RangeVar *relation; /* target relation to merge into */
|
1683
|
+
Node *sourceRelation; /* source relation */
|
1684
|
+
Node *joinCondition; /* join condition between source and target */
|
1685
|
+
List *mergeWhenClauses; /* list of MergeWhenClause(es) */
|
1686
|
+
WithClause *withClause; /* WITH clause */
|
1687
|
+
} MergeStmt;
|
1688
|
+
|
1571
1689
|
/* ----------------------
|
1572
1690
|
* Select Statement
|
1573
1691
|
*
|
@@ -1603,6 +1721,7 @@ typedef struct SelectStmt
|
|
1603
1721
|
List *fromClause; /* the FROM clause */
|
1604
1722
|
Node *whereClause; /* WHERE qualification */
|
1605
1723
|
List *groupClause; /* GROUP BY clauses */
|
1724
|
+
bool groupDistinct; /* Is this GROUP BY DISTINCT? */
|
1606
1725
|
Node *havingClause; /* HAVING conditional-expression */
|
1607
1726
|
List *windowClause; /* WINDOW window_name AS (...), ... */
|
1608
1727
|
|
@@ -1675,6 +1794,35 @@ typedef struct SetOperationStmt
|
|
1675
1794
|
} SetOperationStmt;
|
1676
1795
|
|
1677
1796
|
|
1797
|
+
/*
|
1798
|
+
* RETURN statement (inside SQL function body)
|
1799
|
+
*/
|
1800
|
+
typedef struct ReturnStmt
|
1801
|
+
{
|
1802
|
+
NodeTag type;
|
1803
|
+
Node *returnval;
|
1804
|
+
} ReturnStmt;
|
1805
|
+
|
1806
|
+
|
1807
|
+
/* ----------------------
|
1808
|
+
* PL/pgSQL Assignment Statement
|
1809
|
+
*
|
1810
|
+
* Like SelectStmt, this is transformed into a SELECT Query.
|
1811
|
+
* However, the targetlist of the result looks more like an UPDATE.
|
1812
|
+
* ----------------------
|
1813
|
+
*/
|
1814
|
+
typedef struct PLAssignStmt
|
1815
|
+
{
|
1816
|
+
NodeTag type;
|
1817
|
+
|
1818
|
+
char *name; /* initial column name */
|
1819
|
+
List *indirection; /* subscripts and field names, if any */
|
1820
|
+
int nnames; /* number of names to use in ColumnRef */
|
1821
|
+
SelectStmt *val; /* the PL/pgSQL expression to assign */
|
1822
|
+
int location; /* name's token location, or -1 if unknown */
|
1823
|
+
} PLAssignStmt;
|
1824
|
+
|
1825
|
+
|
1678
1826
|
/*****************************************************************************
|
1679
1827
|
* Other Statements (no optimizations required)
|
1680
1828
|
*
|
@@ -1724,9 +1872,11 @@ typedef enum ObjectType
|
|
1724
1872
|
OBJECT_OPCLASS,
|
1725
1873
|
OBJECT_OPERATOR,
|
1726
1874
|
OBJECT_OPFAMILY,
|
1875
|
+
OBJECT_PARAMETER_ACL,
|
1727
1876
|
OBJECT_POLICY,
|
1728
1877
|
OBJECT_PROCEDURE,
|
1729
1878
|
OBJECT_PUBLICATION,
|
1879
|
+
OBJECT_PUBLICATION_NAMESPACE,
|
1730
1880
|
OBJECT_PUBLICATION_REL,
|
1731
1881
|
OBJECT_ROLE,
|
1732
1882
|
OBJECT_ROUTINE,
|
@@ -1781,7 +1931,7 @@ typedef struct AlterTableStmt
|
|
1781
1931
|
NodeTag type;
|
1782
1932
|
RangeVar *relation; /* table to work on */
|
1783
1933
|
List *cmds; /* list of subcommands */
|
1784
|
-
ObjectType
|
1934
|
+
ObjectType objtype; /* type of object */
|
1785
1935
|
bool missing_ok; /* skip error if table missing */
|
1786
1936
|
} AlterTableStmt;
|
1787
1937
|
|
@@ -1800,6 +1950,7 @@ typedef enum AlterTableType
|
|
1800
1950
|
AT_SetOptions, /* alter column set ( options ) */
|
1801
1951
|
AT_ResetOptions, /* alter column reset ( options ) */
|
1802
1952
|
AT_SetStorage, /* alter column set storage */
|
1953
|
+
AT_SetCompression, /* alter column set compression */
|
1803
1954
|
AT_DropColumn, /* drop column */
|
1804
1955
|
AT_DropColumnRecurse, /* internal to commands/tablecmds.c */
|
1805
1956
|
AT_AddIndex, /* add index */
|
@@ -1823,6 +1974,7 @@ typedef enum AlterTableType
|
|
1823
1974
|
AT_SetLogged, /* SET LOGGED */
|
1824
1975
|
AT_SetUnLogged, /* SET UNLOGGED */
|
1825
1976
|
AT_DropOids, /* SET WITHOUT OIDS */
|
1977
|
+
AT_SetAccessMethod, /* SET ACCESS METHOD */
|
1826
1978
|
AT_SetTableSpace, /* SET TABLESPACE */
|
1827
1979
|
AT_SetRelOptions, /* SET (...) -- AM specific parameters */
|
1828
1980
|
AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */
|
@@ -1851,9 +2003,11 @@ typedef enum AlterTableType
|
|
1851
2003
|
AT_GenericOptions, /* OPTIONS (...) */
|
1852
2004
|
AT_AttachPartition, /* ATTACH PARTITION */
|
1853
2005
|
AT_DetachPartition, /* DETACH PARTITION */
|
2006
|
+
AT_DetachPartitionFinalize, /* DETACH PARTITION FINALIZE */
|
1854
2007
|
AT_AddIdentity, /* ADD IDENTITY */
|
1855
2008
|
AT_SetIdentity, /* SET identity column options */
|
1856
|
-
AT_DropIdentity
|
2009
|
+
AT_DropIdentity, /* DROP IDENTITY */
|
2010
|
+
AT_ReAddStatistics /* internal to commands/tablecmds.c */
|
1857
2011
|
} AlterTableType;
|
1858
2012
|
|
1859
2013
|
typedef struct ReplicaIdentityStmt
|
@@ -1935,27 +2089,39 @@ typedef struct GrantStmt
|
|
1935
2089
|
GrantTargetType targtype; /* type of the grant target */
|
1936
2090
|
ObjectType objtype; /* kind of object being operated on */
|
1937
2091
|
List *objects; /* list of RangeVar nodes, ObjectWithArgs
|
1938
|
-
* nodes, or plain names (as
|
2092
|
+
* nodes, or plain names (as String values) */
|
1939
2093
|
List *privileges; /* list of AccessPriv nodes */
|
1940
2094
|
/* privileges == NIL denotes ALL PRIVILEGES */
|
1941
2095
|
List *grantees; /* list of RoleSpec nodes */
|
1942
2096
|
bool grant_option; /* grant or revoke grant option */
|
2097
|
+
RoleSpec *grantor;
|
1943
2098
|
DropBehavior behavior; /* drop behavior (for REVOKE) */
|
1944
2099
|
} GrantStmt;
|
1945
2100
|
|
1946
2101
|
/*
|
1947
|
-
*
|
1948
|
-
*
|
1949
|
-
*
|
2102
|
+
* ObjectWithArgs represents a function/procedure/operator name plus parameter
|
2103
|
+
* identification.
|
2104
|
+
*
|
2105
|
+
* objargs includes only the types of the input parameters of the object.
|
2106
|
+
* In some contexts, that will be all we have, and it's enough to look up
|
2107
|
+
* objects according to the traditional Postgres rules (i.e., when only input
|
2108
|
+
* arguments matter).
|
2109
|
+
*
|
2110
|
+
* objfuncargs, if not NIL, carries the full specification of the parameter
|
2111
|
+
* list, including parameter mode annotations.
|
2112
|
+
*
|
2113
|
+
* Some grammar productions can set args_unspecified = true instead of
|
2114
|
+
* providing parameter info. In this case, lookup will succeed only if
|
2115
|
+
* the object name is unique. Note that otherwise, NIL parameter lists
|
2116
|
+
* mean zero arguments.
|
1950
2117
|
*/
|
1951
2118
|
typedef struct ObjectWithArgs
|
1952
2119
|
{
|
1953
2120
|
NodeTag type;
|
1954
2121
|
List *objname; /* qualified name of function/operator */
|
1955
|
-
List *objargs; /* list of Typename nodes */
|
1956
|
-
|
1957
|
-
|
1958
|
-
* means zero args) */
|
2122
|
+
List *objargs; /* list of Typename nodes (input args only) */
|
2123
|
+
List *objfuncargs; /* list of FunctionParameter nodes */
|
2124
|
+
bool args_unspecified; /* argument list was omitted? */
|
1959
2125
|
} ObjectWithArgs;
|
1960
2126
|
|
1961
2127
|
/*
|
@@ -1969,7 +2135,7 @@ typedef struct AccessPriv
|
|
1969
2135
|
{
|
1970
2136
|
NodeTag type;
|
1971
2137
|
char *priv_name; /* string name of privilege */
|
1972
|
-
List *cols; /* list of
|
2138
|
+
List *cols; /* list of String */
|
1973
2139
|
} AccessPriv;
|
1974
2140
|
|
1975
2141
|
/* ----------------------
|
@@ -1978,7 +2144,7 @@ typedef struct AccessPriv
|
|
1978
2144
|
* Note: because of the parsing ambiguity with the GRANT <privileges>
|
1979
2145
|
* statement, granted_roles is a list of AccessPriv; the execution code
|
1980
2146
|
* should complain if any column lists appear. grantee_roles is a list
|
1981
|
-
* of role names, as
|
2147
|
+
* of role names, as String values.
|
1982
2148
|
* ----------------------
|
1983
2149
|
*/
|
1984
2150
|
typedef struct GrantRoleStmt
|
@@ -2033,7 +2199,7 @@ typedef struct CopyStmt
|
|
2033
2199
|
* preserve the distinction in VariableSetKind for CreateCommandTag().
|
2034
2200
|
* ----------------------
|
2035
2201
|
*/
|
2036
|
-
typedef enum
|
2202
|
+
typedef enum VariableSetKind
|
2037
2203
|
{
|
2038
2204
|
VAR_SET_VALUE, /* SET var = value */
|
2039
2205
|
VAR_SET_DEFAULT, /* SET var TO DEFAULT */
|
@@ -2079,7 +2245,7 @@ typedef struct CreateStmt
|
|
2079
2245
|
RangeVar *relation; /* relation to create */
|
2080
2246
|
List *tableElts; /* column definitions (list of ColumnDef) */
|
2081
2247
|
List *inhRelations; /* relations to inherit from (list of
|
2082
|
-
*
|
2248
|
+
* RangeVar) */
|
2083
2249
|
PartitionBoundSpec *partbound; /* FOR VALUES clause */
|
2084
2250
|
PartitionSpec *partspec; /* PARTITION BY clause */
|
2085
2251
|
TypeName *ofTypename; /* OF typename */
|
@@ -2171,6 +2337,7 @@ typedef struct Constraint
|
|
2171
2337
|
char generated_when; /* ALWAYS or BY DEFAULT */
|
2172
2338
|
|
2173
2339
|
/* Fields used for unique constraints (UNIQUE and PRIMARY KEY): */
|
2340
|
+
bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
|
2174
2341
|
List *keys; /* String nodes naming referenced key
|
2175
2342
|
* column(s) */
|
2176
2343
|
List *including; /* String nodes naming referenced nonkey
|
@@ -2196,6 +2363,7 @@ typedef struct Constraint
|
|
2196
2363
|
char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
|
2197
2364
|
char fk_upd_action; /* ON UPDATE action */
|
2198
2365
|
char fk_del_action; /* ON DELETE action */
|
2366
|
+
List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */
|
2199
2367
|
List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
|
2200
2368
|
Oid old_pktable_oid; /* pg_constraint.confrelid of my former
|
2201
2369
|
* self */
|
@@ -2434,10 +2602,12 @@ typedef struct CreateAmStmt
|
|
2434
2602
|
typedef struct CreateTrigStmt
|
2435
2603
|
{
|
2436
2604
|
NodeTag type;
|
2605
|
+
bool replace; /* replace trigger if already exists */
|
2606
|
+
bool isconstraint; /* This is a constraint trigger */
|
2437
2607
|
char *trigname; /* TRIGGER's name */
|
2438
2608
|
RangeVar *relation; /* relation trigger is on */
|
2439
2609
|
List *funcname; /* qual. name of function to call */
|
2440
|
-
List *args; /* list of
|
2610
|
+
List *args; /* list of String or NIL */
|
2441
2611
|
bool row; /* ROW/STATEMENT */
|
2442
2612
|
/* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
|
2443
2613
|
int16 timing; /* BEFORE, AFTER, or INSTEAD */
|
@@ -2445,7 +2615,6 @@ typedef struct CreateTrigStmt
|
|
2445
2615
|
int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */
|
2446
2616
|
List *columns; /* column names, or NIL for all columns */
|
2447
2617
|
Node *whenClause; /* qual expression, or NULL if none */
|
2448
|
-
bool isconstraint; /* This is a constraint trigger */
|
2449
2618
|
/* explicitly named transition data */
|
2450
2619
|
List *transitionRels; /* TriggerTransition nodes, or NIL if none */
|
2451
2620
|
/* The remaining fields are only used for constraint triggers */
|
@@ -2574,7 +2743,7 @@ typedef struct DefineStmt
|
|
2574
2743
|
NodeTag type;
|
2575
2744
|
ObjectType kind; /* aggregate, operator, type */
|
2576
2745
|
bool oldstyle; /* hack to signal old CREATE AGG syntax */
|
2577
|
-
List *defnames; /* qualified name (list of
|
2746
|
+
List *defnames; /* qualified name (list of String) */
|
2578
2747
|
List *args; /* a list of TypeName (if needed) */
|
2579
2748
|
List *definition; /* a list of DefElem */
|
2580
2749
|
bool if_not_exists; /* just do nothing if it already exists? */
|
@@ -2588,7 +2757,7 @@ typedef struct DefineStmt
|
|
2588
2757
|
typedef struct CreateDomainStmt
|
2589
2758
|
{
|
2590
2759
|
NodeTag type;
|
2591
|
-
List *domainname; /* qualified name (list of
|
2760
|
+
List *domainname; /* qualified name (list of String) */
|
2592
2761
|
TypeName *typeName; /* the base type */
|
2593
2762
|
CollateClause *collClause; /* untransformed COLLATE spec, if any */
|
2594
2763
|
List *constraints; /* constraints (list of Constraint nodes) */
|
@@ -2601,7 +2770,7 @@ typedef struct CreateDomainStmt
|
|
2601
2770
|
typedef struct CreateOpClassStmt
|
2602
2771
|
{
|
2603
2772
|
NodeTag type;
|
2604
|
-
List *opclassname; /* qualified name (list of
|
2773
|
+
List *opclassname; /* qualified name (list of String) */
|
2605
2774
|
List *opfamilyname; /* qualified name (ditto); NIL if omitted */
|
2606
2775
|
char *amname; /* name of index AM opclass is for */
|
2607
2776
|
TypeName *datatype; /* datatype of indexed column */
|
@@ -2633,7 +2802,7 @@ typedef struct CreateOpClassItem
|
|
2633
2802
|
typedef struct CreateOpFamilyStmt
|
2634
2803
|
{
|
2635
2804
|
NodeTag type;
|
2636
|
-
List *opfamilyname; /* qualified name (list of
|
2805
|
+
List *opfamilyname; /* qualified name (list of String) */
|
2637
2806
|
char *amname; /* name of index AM opfamily is for */
|
2638
2807
|
} CreateOpFamilyStmt;
|
2639
2808
|
|
@@ -2644,7 +2813,7 @@ typedef struct CreateOpFamilyStmt
|
|
2644
2813
|
typedef struct AlterOpFamilyStmt
|
2645
2814
|
{
|
2646
2815
|
NodeTag type;
|
2647
|
-
List *opfamilyname; /* qualified name (list of
|
2816
|
+
List *opfamilyname; /* qualified name (list of String) */
|
2648
2817
|
char *amname; /* name of index AM opfamily is for */
|
2649
2818
|
bool isDrop; /* ADD or DROP the items? */
|
2650
2819
|
List *items; /* List of CreateOpClassItem nodes */
|
@@ -2714,12 +2883,13 @@ typedef struct SecLabelStmt
|
|
2714
2883
|
#define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */
|
2715
2884
|
#define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */
|
2716
2885
|
#define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */
|
2717
|
-
#define
|
2886
|
+
#define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */
|
2887
|
+
#define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */
|
2718
2888
|
/* these planner-control flags do not correspond to any SQL grammar: */
|
2719
|
-
#define CURSOR_OPT_FAST_PLAN
|
2720
|
-
#define CURSOR_OPT_GENERIC_PLAN
|
2721
|
-
#define CURSOR_OPT_CUSTOM_PLAN
|
2722
|
-
#define CURSOR_OPT_PARALLEL_OK
|
2889
|
+
#define CURSOR_OPT_FAST_PLAN 0x0100 /* prefer fast-start plan */
|
2890
|
+
#define CURSOR_OPT_GENERIC_PLAN 0x0200 /* force use of generic plan */
|
2891
|
+
#define CURSOR_OPT_CUSTOM_PLAN 0x0400 /* force use of custom plan */
|
2892
|
+
#define CURSOR_OPT_PARALLEL_OK 0x0800 /* parallel mode OK */
|
2723
2893
|
|
2724
2894
|
typedef struct DeclareCursorStmt
|
2725
2895
|
{
|
@@ -2796,6 +2966,7 @@ typedef struct IndexStmt
|
|
2796
2966
|
SubTransactionId oldFirstRelfilenodeSubid; /* rd_firstRelfilenodeSubid of
|
2797
2967
|
* oldNode */
|
2798
2968
|
bool unique; /* is index unique? */
|
2969
|
+
bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
|
2799
2970
|
bool primary; /* is index a primary key? */
|
2800
2971
|
bool isconstraint; /* is it for a pkey/unique constraint? */
|
2801
2972
|
bool deferrable; /* is the constraint DEFERRABLE? */
|
@@ -2814,14 +2985,30 @@ typedef struct IndexStmt
|
|
2814
2985
|
typedef struct CreateStatsStmt
|
2815
2986
|
{
|
2816
2987
|
NodeTag type;
|
2817
|
-
List *defnames; /* qualified name (list of
|
2818
|
-
List *stat_types; /* stat types (list of
|
2988
|
+
List *defnames; /* qualified name (list of String) */
|
2989
|
+
List *stat_types; /* stat types (list of String) */
|
2819
2990
|
List *exprs; /* expressions to build statistics on */
|
2820
2991
|
List *relations; /* rels to build stats on (list of RangeVar) */
|
2821
2992
|
char *stxcomment; /* comment to apply to stats, or NULL */
|
2993
|
+
bool transformed; /* true when transformStatsStmt is finished */
|
2822
2994
|
bool if_not_exists; /* do nothing if stats name already exists */
|
2823
2995
|
} CreateStatsStmt;
|
2824
2996
|
|
2997
|
+
/*
|
2998
|
+
* StatsElem - statistics parameters (used in CREATE STATISTICS)
|
2999
|
+
*
|
3000
|
+
* For a plain attribute, 'name' is the name of the referenced table column
|
3001
|
+
* and 'expr' is NULL. For an expression, 'name' is NULL and 'expr' is the
|
3002
|
+
* expression tree.
|
3003
|
+
*/
|
3004
|
+
typedef struct StatsElem
|
3005
|
+
{
|
3006
|
+
NodeTag type;
|
3007
|
+
char *name; /* name of attribute to index, or NULL */
|
3008
|
+
Node *expr; /* expression to index, or NULL */
|
3009
|
+
} StatsElem;
|
3010
|
+
|
3011
|
+
|
2825
3012
|
/* ----------------------
|
2826
3013
|
* Alter Statistics Statement
|
2827
3014
|
* ----------------------
|
@@ -2829,7 +3016,7 @@ typedef struct CreateStatsStmt
|
|
2829
3016
|
typedef struct AlterStatsStmt
|
2830
3017
|
{
|
2831
3018
|
NodeTag type;
|
2832
|
-
List *defnames; /* qualified name (list of
|
3019
|
+
List *defnames; /* qualified name (list of String) */
|
2833
3020
|
int stxstattarget; /* statistics target */
|
2834
3021
|
bool missing_ok; /* skip error if statistics object is missing */
|
2835
3022
|
} AlterStatsStmt;
|
@@ -2847,6 +3034,7 @@ typedef struct CreateFunctionStmt
|
|
2847
3034
|
List *parameters; /* a list of FunctionParameter */
|
2848
3035
|
TypeName *returnType; /* the return type */
|
2849
3036
|
List *options; /* a list of DefElem */
|
3037
|
+
Node *sql_body;
|
2850
3038
|
} CreateFunctionStmt;
|
2851
3039
|
|
2852
3040
|
typedef enum FunctionParameterMode
|
@@ -2856,7 +3044,9 @@ typedef enum FunctionParameterMode
|
|
2856
3044
|
FUNC_PARAM_OUT = 'o', /* output only */
|
2857
3045
|
FUNC_PARAM_INOUT = 'b', /* both */
|
2858
3046
|
FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */
|
2859
|
-
FUNC_PARAM_TABLE = 't' /* table function output column */
|
3047
|
+
FUNC_PARAM_TABLE = 't', /* table function output column */
|
3048
|
+
/* this is not used in pg_proc: */
|
3049
|
+
FUNC_PARAM_DEFAULT = 'd' /* default; effectively same as IN */
|
2860
3050
|
} FunctionParameterMode;
|
2861
3051
|
|
2862
3052
|
typedef struct FunctionParameter
|
@@ -2899,13 +3089,19 @@ typedef struct InlineCodeBlock
|
|
2899
3089
|
|
2900
3090
|
/* ----------------------
|
2901
3091
|
* CALL statement
|
3092
|
+
*
|
3093
|
+
* OUT-mode arguments are removed from the transformed funcexpr. The outargs
|
3094
|
+
* list contains copies of the expressions for all output arguments, in the
|
3095
|
+
* order of the procedure's declared arguments. (outargs is never evaluated,
|
3096
|
+
* but is useful to the caller as a reference for what to assign to.)
|
2902
3097
|
* ----------------------
|
2903
3098
|
*/
|
2904
3099
|
typedef struct CallStmt
|
2905
3100
|
{
|
2906
3101
|
NodeTag type;
|
2907
3102
|
FuncCall *funccall; /* from the parser */
|
2908
|
-
FuncExpr *funcexpr; /* transformed */
|
3103
|
+
FuncExpr *funcexpr; /* transformed call, with only input args */
|
3104
|
+
List *outargs; /* transformed output-argument expressions */
|
2909
3105
|
} CallStmt;
|
2910
3106
|
|
2911
3107
|
typedef struct CallContext
|
@@ -2942,7 +3138,7 @@ typedef struct AlterObjectDependsStmt
|
|
2942
3138
|
ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
|
2943
3139
|
RangeVar *relation; /* in case a table is involved */
|
2944
3140
|
Node *object; /* name of the object */
|
2945
|
-
|
3141
|
+
String *extname; /* extension name */
|
2946
3142
|
bool remove; /* set true to remove dep rather than add */
|
2947
3143
|
} AlterObjectDependsStmt;
|
2948
3144
|
|
@@ -3088,8 +3284,8 @@ typedef struct CompositeTypeStmt
|
|
3088
3284
|
typedef struct CreateEnumStmt
|
3089
3285
|
{
|
3090
3286
|
NodeTag type;
|
3091
|
-
List *typeName; /* qualified name (list of
|
3092
|
-
List *vals; /* enum values (list of
|
3287
|
+
List *typeName; /* qualified name (list of String) */
|
3288
|
+
List *vals; /* enum values (list of String) */
|
3093
3289
|
} CreateEnumStmt;
|
3094
3290
|
|
3095
3291
|
/* ----------------------
|
@@ -3099,7 +3295,7 @@ typedef struct CreateEnumStmt
|
|
3099
3295
|
typedef struct CreateRangeStmt
|
3100
3296
|
{
|
3101
3297
|
NodeTag type;
|
3102
|
-
List *typeName; /* qualified name (list of
|
3298
|
+
List *typeName; /* qualified name (list of String) */
|
3103
3299
|
List *params; /* range parameters (list of DefElem) */
|
3104
3300
|
} CreateRangeStmt;
|
3105
3301
|
|
@@ -3110,7 +3306,7 @@ typedef struct CreateRangeStmt
|
|
3110
3306
|
typedef struct AlterEnumStmt
|
3111
3307
|
{
|
3112
3308
|
NodeTag type;
|
3113
|
-
List *typeName; /* qualified name (list of
|
3309
|
+
List *typeName; /* qualified name (list of String) */
|
3114
3310
|
char *oldVal; /* old enum value's name, if renaming */
|
3115
3311
|
char *newVal; /* new enum value's name */
|
3116
3312
|
char *newValNeighbor; /* neighboring enum value, if specified */
|
@@ -3172,6 +3368,12 @@ typedef struct AlterDatabaseStmt
|
|
3172
3368
|
List *options; /* List of DefElem nodes */
|
3173
3369
|
} AlterDatabaseStmt;
|
3174
3370
|
|
3371
|
+
typedef struct AlterDatabaseRefreshCollStmt
|
3372
|
+
{
|
3373
|
+
NodeTag type;
|
3374
|
+
char *dbname;
|
3375
|
+
} AlterDatabaseRefreshCollStmt;
|
3376
|
+
|
3175
3377
|
typedef struct AlterDatabaseSetStmt
|
3176
3378
|
{
|
3177
3379
|
NodeTag type;
|
@@ -3205,18 +3407,12 @@ typedef struct AlterSystemStmt
|
|
3205
3407
|
* Cluster Statement (support pbrown's cluster index implementation)
|
3206
3408
|
* ----------------------
|
3207
3409
|
*/
|
3208
|
-
typedef enum ClusterOption
|
3209
|
-
{
|
3210
|
-
CLUOPT_RECHECK = 1 << 0, /* recheck relation state */
|
3211
|
-
CLUOPT_VERBOSE = 1 << 1 /* print progress info */
|
3212
|
-
} ClusterOption;
|
3213
|
-
|
3214
3410
|
typedef struct ClusterStmt
|
3215
3411
|
{
|
3216
3412
|
NodeTag type;
|
3217
3413
|
RangeVar *relation; /* relation being indexed, or NULL if all */
|
3218
3414
|
char *indexname; /* original index defined */
|
3219
|
-
|
3415
|
+
List *params; /* list of DefElem nodes */
|
3220
3416
|
} ClusterStmt;
|
3221
3417
|
|
3222
3418
|
/* ----------------------
|
@@ -3282,7 +3478,7 @@ typedef struct CreateTableAsStmt
|
|
3282
3478
|
NodeTag type;
|
3283
3479
|
Node *query; /* the query (see comments above) */
|
3284
3480
|
IntoClause *into; /* destination table */
|
3285
|
-
ObjectType
|
3481
|
+
ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */
|
3286
3482
|
bool is_select_into; /* it was written as SELECT INTO */
|
3287
3483
|
bool if_not_exists; /* just do nothing if it already exists? */
|
3288
3484
|
} CreateTableAsStmt;
|
@@ -3354,11 +3550,6 @@ typedef struct ConstraintsSetStmt
|
|
3354
3550
|
* REINDEX Statement
|
3355
3551
|
* ----------------------
|
3356
3552
|
*/
|
3357
|
-
|
3358
|
-
/* Reindex options */
|
3359
|
-
#define REINDEXOPT_VERBOSE (1 << 0) /* print progress info */
|
3360
|
-
#define REINDEXOPT_REPORT_PROGRESS (1 << 1) /* report pgstat progress */
|
3361
|
-
|
3362
3553
|
typedef enum ReindexObjectType
|
3363
3554
|
{
|
3364
3555
|
REINDEX_OBJECT_INDEX, /* index */
|
@@ -3375,8 +3566,7 @@ typedef struct ReindexStmt
|
|
3375
3566
|
* etc. */
|
3376
3567
|
RangeVar *relation; /* Table or index to reindex */
|
3377
3568
|
const char *name; /* name of database to reindex */
|
3378
|
-
|
3379
|
-
bool concurrent; /* reindex concurrently? */
|
3569
|
+
List *params; /* list of DefElem nodes */
|
3380
3570
|
} ReindexStmt;
|
3381
3571
|
|
3382
3572
|
/* ----------------------
|
@@ -3484,7 +3674,7 @@ typedef struct ReassignOwnedStmt
|
|
3484
3674
|
typedef struct AlterTSDictionaryStmt
|
3485
3675
|
{
|
3486
3676
|
NodeTag type;
|
3487
|
-
List *dictname; /* qualified name (list of
|
3677
|
+
List *dictname; /* qualified name (list of String) */
|
3488
3678
|
List *options; /* List of DefElem nodes */
|
3489
3679
|
} AlterTSDictionaryStmt;
|
3490
3680
|
|
@@ -3504,29 +3694,64 @@ typedef struct AlterTSConfigurationStmt
|
|
3504
3694
|
{
|
3505
3695
|
NodeTag type;
|
3506
3696
|
AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */
|
3507
|
-
List *cfgname; /* qualified name (list of
|
3697
|
+
List *cfgname; /* qualified name (list of String) */
|
3508
3698
|
|
3509
3699
|
/*
|
3510
3700
|
* dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
|
3511
3701
|
* NIL, but tokentype isn't, DROP MAPPING was specified.
|
3512
3702
|
*/
|
3513
|
-
List *tokentype; /* list of
|
3514
|
-
List *dicts; /* list of list of
|
3703
|
+
List *tokentype; /* list of String */
|
3704
|
+
List *dicts; /* list of list of String */
|
3515
3705
|
bool override; /* if true - remove old variant */
|
3516
3706
|
bool replace; /* if true - replace dictionary by another */
|
3517
3707
|
bool missing_ok; /* for DROP - skip error if missing? */
|
3518
3708
|
} AlterTSConfigurationStmt;
|
3519
3709
|
|
3710
|
+
typedef struct PublicationTable
|
3711
|
+
{
|
3712
|
+
NodeTag type;
|
3713
|
+
RangeVar *relation; /* relation to be published */
|
3714
|
+
Node *whereClause; /* qualifications */
|
3715
|
+
List *columns; /* List of columns in a publication table */
|
3716
|
+
} PublicationTable;
|
3717
|
+
|
3718
|
+
/*
|
3719
|
+
* Publication object type
|
3720
|
+
*/
|
3721
|
+
typedef enum PublicationObjSpecType
|
3722
|
+
{
|
3723
|
+
PUBLICATIONOBJ_TABLE, /* A table */
|
3724
|
+
PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */
|
3725
|
+
PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of
|
3726
|
+
* search_path */
|
3727
|
+
PUBLICATIONOBJ_CONTINUATION /* Continuation of previous type */
|
3728
|
+
} PublicationObjSpecType;
|
3729
|
+
|
3730
|
+
typedef struct PublicationObjSpec
|
3731
|
+
{
|
3732
|
+
NodeTag type;
|
3733
|
+
PublicationObjSpecType pubobjtype; /* type of this publication object */
|
3734
|
+
char *name;
|
3735
|
+
PublicationTable *pubtable;
|
3736
|
+
int location; /* token location, or -1 if unknown */
|
3737
|
+
} PublicationObjSpec;
|
3520
3738
|
|
3521
3739
|
typedef struct CreatePublicationStmt
|
3522
3740
|
{
|
3523
3741
|
NodeTag type;
|
3524
3742
|
char *pubname; /* Name of the publication */
|
3525
3743
|
List *options; /* List of DefElem nodes */
|
3526
|
-
List *
|
3744
|
+
List *pubobjects; /* Optional list of publication objects */
|
3527
3745
|
bool for_all_tables; /* Special publication for all tables in db */
|
3528
3746
|
} CreatePublicationStmt;
|
3529
3747
|
|
3748
|
+
typedef enum AlterPublicationAction
|
3749
|
+
{
|
3750
|
+
AP_AddObjects, /* add objects to publication */
|
3751
|
+
AP_DropObjects, /* remove objects from publication */
|
3752
|
+
AP_SetObjects /* set list of objects */
|
3753
|
+
} AlterPublicationAction;
|
3754
|
+
|
3530
3755
|
typedef struct AlterPublicationStmt
|
3531
3756
|
{
|
3532
3757
|
NodeTag type;
|
@@ -3535,10 +3760,14 @@ typedef struct AlterPublicationStmt
|
|
3535
3760
|
/* parameters used for ALTER PUBLICATION ... WITH */
|
3536
3761
|
List *options; /* List of DefElem nodes */
|
3537
3762
|
|
3538
|
-
/*
|
3539
|
-
|
3763
|
+
/*
|
3764
|
+
* Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication
|
3765
|
+
* objects.
|
3766
|
+
*/
|
3767
|
+
List *pubobjects; /* Optional list of publication objects */
|
3540
3768
|
bool for_all_tables; /* Special publication for all tables in db */
|
3541
|
-
|
3769
|
+
AlterPublicationAction action; /* What action to perform with the given
|
3770
|
+
* objects */
|
3542
3771
|
} AlterPublicationStmt;
|
3543
3772
|
|
3544
3773
|
typedef struct CreateSubscriptionStmt
|
@@ -3554,9 +3783,12 @@ typedef enum AlterSubscriptionType
|
|
3554
3783
|
{
|
3555
3784
|
ALTER_SUBSCRIPTION_OPTIONS,
|
3556
3785
|
ALTER_SUBSCRIPTION_CONNECTION,
|
3557
|
-
|
3786
|
+
ALTER_SUBSCRIPTION_SET_PUBLICATION,
|
3787
|
+
ALTER_SUBSCRIPTION_ADD_PUBLICATION,
|
3788
|
+
ALTER_SUBSCRIPTION_DROP_PUBLICATION,
|
3558
3789
|
ALTER_SUBSCRIPTION_REFRESH,
|
3559
|
-
ALTER_SUBSCRIPTION_ENABLED
|
3790
|
+
ALTER_SUBSCRIPTION_ENABLED,
|
3791
|
+
ALTER_SUBSCRIPTION_SKIP
|
3560
3792
|
} AlterSubscriptionType;
|
3561
3793
|
|
3562
3794
|
typedef struct AlterSubscriptionStmt
|