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
|
@@ -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
|
/****************************************************************************
|
|
@@ -915,10 +950,10 @@ typedef struct PartitionCmd
|
|
|
915
950
|
* inFromCl marks those range variables that are listed in the FROM clause.
|
|
916
951
|
* It's false for RTEs that are added to a query behind the scenes, such
|
|
917
952
|
* as the NEW and OLD variables for a rule, or the subqueries of a UNION.
|
|
918
|
-
* This flag is not used
|
|
919
|
-
* a separate "namespace" data structure to
|
|
920
|
-
* needed by ruleutils.c to determine
|
|
921
|
-
* decompiled queries.
|
|
953
|
+
* This flag is not used during parsing (except in transformLockingClause,
|
|
954
|
+
* q.v.); the parser now uses a separate "namespace" data structure to
|
|
955
|
+
* control visibility. But it is needed by ruleutils.c to determine
|
|
956
|
+
* whether RTEs should be shown in decompiled queries.
|
|
922
957
|
*
|
|
923
958
|
* requiredPerms and checkAsUser specify run-time access permissions
|
|
924
959
|
* checks to be performed at query startup. The user must have *all*
|
|
@@ -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
|
|
@@ -1876,6 +2030,7 @@ typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
|
|
|
1876
2030
|
* constraint, or parent table */
|
|
1877
2031
|
DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
|
|
1878
2032
|
bool missing_ok; /* skip error if missing? */
|
|
2033
|
+
bool recurse; /* exec-time recursion */
|
|
1879
2034
|
} AlterTableCmd;
|
|
1880
2035
|
|
|
1881
2036
|
|
|
@@ -1934,27 +2089,39 @@ typedef struct GrantStmt
|
|
|
1934
2089
|
GrantTargetType targtype; /* type of the grant target */
|
|
1935
2090
|
ObjectType objtype; /* kind of object being operated on */
|
|
1936
2091
|
List *objects; /* list of RangeVar nodes, ObjectWithArgs
|
|
1937
|
-
* nodes, or plain names (as
|
|
2092
|
+
* nodes, or plain names (as String values) */
|
|
1938
2093
|
List *privileges; /* list of AccessPriv nodes */
|
|
1939
2094
|
/* privileges == NIL denotes ALL PRIVILEGES */
|
|
1940
2095
|
List *grantees; /* list of RoleSpec nodes */
|
|
1941
2096
|
bool grant_option; /* grant or revoke grant option */
|
|
2097
|
+
RoleSpec *grantor;
|
|
1942
2098
|
DropBehavior behavior; /* drop behavior (for REVOKE) */
|
|
1943
2099
|
} GrantStmt;
|
|
1944
2100
|
|
|
1945
2101
|
/*
|
|
1946
|
-
*
|
|
1947
|
-
*
|
|
1948
|
-
*
|
|
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.
|
|
1949
2117
|
*/
|
|
1950
2118
|
typedef struct ObjectWithArgs
|
|
1951
2119
|
{
|
|
1952
2120
|
NodeTag type;
|
|
1953
2121
|
List *objname; /* qualified name of function/operator */
|
|
1954
|
-
List *objargs; /* list of Typename nodes */
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
* 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? */
|
|
1958
2125
|
} ObjectWithArgs;
|
|
1959
2126
|
|
|
1960
2127
|
/*
|
|
@@ -1968,7 +2135,7 @@ typedef struct AccessPriv
|
|
|
1968
2135
|
{
|
|
1969
2136
|
NodeTag type;
|
|
1970
2137
|
char *priv_name; /* string name of privilege */
|
|
1971
|
-
List *cols; /* list of
|
|
2138
|
+
List *cols; /* list of String */
|
|
1972
2139
|
} AccessPriv;
|
|
1973
2140
|
|
|
1974
2141
|
/* ----------------------
|
|
@@ -1977,7 +2144,7 @@ typedef struct AccessPriv
|
|
|
1977
2144
|
* Note: because of the parsing ambiguity with the GRANT <privileges>
|
|
1978
2145
|
* statement, granted_roles is a list of AccessPriv; the execution code
|
|
1979
2146
|
* should complain if any column lists appear. grantee_roles is a list
|
|
1980
|
-
* of role names, as
|
|
2147
|
+
* of role names, as String values.
|
|
1981
2148
|
* ----------------------
|
|
1982
2149
|
*/
|
|
1983
2150
|
typedef struct GrantRoleStmt
|
|
@@ -2032,7 +2199,7 @@ typedef struct CopyStmt
|
|
|
2032
2199
|
* preserve the distinction in VariableSetKind for CreateCommandTag().
|
|
2033
2200
|
* ----------------------
|
|
2034
2201
|
*/
|
|
2035
|
-
typedef enum
|
|
2202
|
+
typedef enum VariableSetKind
|
|
2036
2203
|
{
|
|
2037
2204
|
VAR_SET_VALUE, /* SET var = value */
|
|
2038
2205
|
VAR_SET_DEFAULT, /* SET var TO DEFAULT */
|
|
@@ -2078,7 +2245,7 @@ typedef struct CreateStmt
|
|
|
2078
2245
|
RangeVar *relation; /* relation to create */
|
|
2079
2246
|
List *tableElts; /* column definitions (list of ColumnDef) */
|
|
2080
2247
|
List *inhRelations; /* relations to inherit from (list of
|
|
2081
|
-
*
|
|
2248
|
+
* RangeVar) */
|
|
2082
2249
|
PartitionBoundSpec *partbound; /* FOR VALUES clause */
|
|
2083
2250
|
PartitionSpec *partspec; /* PARTITION BY clause */
|
|
2084
2251
|
TypeName *ofTypename; /* OF typename */
|
|
@@ -2170,6 +2337,7 @@ typedef struct Constraint
|
|
|
2170
2337
|
char generated_when; /* ALWAYS or BY DEFAULT */
|
|
2171
2338
|
|
|
2172
2339
|
/* Fields used for unique constraints (UNIQUE and PRIMARY KEY): */
|
|
2340
|
+
bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
|
|
2173
2341
|
List *keys; /* String nodes naming referenced key
|
|
2174
2342
|
* column(s) */
|
|
2175
2343
|
List *including; /* String nodes naming referenced nonkey
|
|
@@ -2195,6 +2363,7 @@ typedef struct Constraint
|
|
|
2195
2363
|
char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
|
|
2196
2364
|
char fk_upd_action; /* ON UPDATE action */
|
|
2197
2365
|
char fk_del_action; /* ON DELETE action */
|
|
2366
|
+
List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */
|
|
2198
2367
|
List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
|
|
2199
2368
|
Oid old_pktable_oid; /* pg_constraint.confrelid of my former
|
|
2200
2369
|
* self */
|
|
@@ -2433,10 +2602,12 @@ typedef struct CreateAmStmt
|
|
|
2433
2602
|
typedef struct CreateTrigStmt
|
|
2434
2603
|
{
|
|
2435
2604
|
NodeTag type;
|
|
2605
|
+
bool replace; /* replace trigger if already exists */
|
|
2606
|
+
bool isconstraint; /* This is a constraint trigger */
|
|
2436
2607
|
char *trigname; /* TRIGGER's name */
|
|
2437
2608
|
RangeVar *relation; /* relation trigger is on */
|
|
2438
2609
|
List *funcname; /* qual. name of function to call */
|
|
2439
|
-
List *args; /* list of
|
|
2610
|
+
List *args; /* list of String or NIL */
|
|
2440
2611
|
bool row; /* ROW/STATEMENT */
|
|
2441
2612
|
/* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
|
|
2442
2613
|
int16 timing; /* BEFORE, AFTER, or INSTEAD */
|
|
@@ -2444,7 +2615,6 @@ typedef struct CreateTrigStmt
|
|
|
2444
2615
|
int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */
|
|
2445
2616
|
List *columns; /* column names, or NIL for all columns */
|
|
2446
2617
|
Node *whenClause; /* qual expression, or NULL if none */
|
|
2447
|
-
bool isconstraint; /* This is a constraint trigger */
|
|
2448
2618
|
/* explicitly named transition data */
|
|
2449
2619
|
List *transitionRels; /* TriggerTransition nodes, or NIL if none */
|
|
2450
2620
|
/* The remaining fields are only used for constraint triggers */
|
|
@@ -2573,7 +2743,7 @@ typedef struct DefineStmt
|
|
|
2573
2743
|
NodeTag type;
|
|
2574
2744
|
ObjectType kind; /* aggregate, operator, type */
|
|
2575
2745
|
bool oldstyle; /* hack to signal old CREATE AGG syntax */
|
|
2576
|
-
List *defnames; /* qualified name (list of
|
|
2746
|
+
List *defnames; /* qualified name (list of String) */
|
|
2577
2747
|
List *args; /* a list of TypeName (if needed) */
|
|
2578
2748
|
List *definition; /* a list of DefElem */
|
|
2579
2749
|
bool if_not_exists; /* just do nothing if it already exists? */
|
|
@@ -2587,7 +2757,7 @@ typedef struct DefineStmt
|
|
|
2587
2757
|
typedef struct CreateDomainStmt
|
|
2588
2758
|
{
|
|
2589
2759
|
NodeTag type;
|
|
2590
|
-
List *domainname; /* qualified name (list of
|
|
2760
|
+
List *domainname; /* qualified name (list of String) */
|
|
2591
2761
|
TypeName *typeName; /* the base type */
|
|
2592
2762
|
CollateClause *collClause; /* untransformed COLLATE spec, if any */
|
|
2593
2763
|
List *constraints; /* constraints (list of Constraint nodes) */
|
|
@@ -2600,7 +2770,7 @@ typedef struct CreateDomainStmt
|
|
|
2600
2770
|
typedef struct CreateOpClassStmt
|
|
2601
2771
|
{
|
|
2602
2772
|
NodeTag type;
|
|
2603
|
-
List *opclassname; /* qualified name (list of
|
|
2773
|
+
List *opclassname; /* qualified name (list of String) */
|
|
2604
2774
|
List *opfamilyname; /* qualified name (ditto); NIL if omitted */
|
|
2605
2775
|
char *amname; /* name of index AM opclass is for */
|
|
2606
2776
|
TypeName *datatype; /* datatype of indexed column */
|
|
@@ -2632,7 +2802,7 @@ typedef struct CreateOpClassItem
|
|
|
2632
2802
|
typedef struct CreateOpFamilyStmt
|
|
2633
2803
|
{
|
|
2634
2804
|
NodeTag type;
|
|
2635
|
-
List *opfamilyname; /* qualified name (list of
|
|
2805
|
+
List *opfamilyname; /* qualified name (list of String) */
|
|
2636
2806
|
char *amname; /* name of index AM opfamily is for */
|
|
2637
2807
|
} CreateOpFamilyStmt;
|
|
2638
2808
|
|
|
@@ -2643,7 +2813,7 @@ typedef struct CreateOpFamilyStmt
|
|
|
2643
2813
|
typedef struct AlterOpFamilyStmt
|
|
2644
2814
|
{
|
|
2645
2815
|
NodeTag type;
|
|
2646
|
-
List *opfamilyname; /* qualified name (list of
|
|
2816
|
+
List *opfamilyname; /* qualified name (list of String) */
|
|
2647
2817
|
char *amname; /* name of index AM opfamily is for */
|
|
2648
2818
|
bool isDrop; /* ADD or DROP the items? */
|
|
2649
2819
|
List *items; /* List of CreateOpClassItem nodes */
|
|
@@ -2713,12 +2883,13 @@ typedef struct SecLabelStmt
|
|
|
2713
2883
|
#define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */
|
|
2714
2884
|
#define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */
|
|
2715
2885
|
#define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */
|
|
2716
|
-
#define
|
|
2886
|
+
#define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */
|
|
2887
|
+
#define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */
|
|
2717
2888
|
/* these planner-control flags do not correspond to any SQL grammar: */
|
|
2718
|
-
#define CURSOR_OPT_FAST_PLAN
|
|
2719
|
-
#define CURSOR_OPT_GENERIC_PLAN
|
|
2720
|
-
#define CURSOR_OPT_CUSTOM_PLAN
|
|
2721
|
-
#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 */
|
|
2722
2893
|
|
|
2723
2894
|
typedef struct DeclareCursorStmt
|
|
2724
2895
|
{
|
|
@@ -2795,6 +2966,7 @@ typedef struct IndexStmt
|
|
|
2795
2966
|
SubTransactionId oldFirstRelfilenodeSubid; /* rd_firstRelfilenodeSubid of
|
|
2796
2967
|
* oldNode */
|
|
2797
2968
|
bool unique; /* is index unique? */
|
|
2969
|
+
bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
|
|
2798
2970
|
bool primary; /* is index a primary key? */
|
|
2799
2971
|
bool isconstraint; /* is it for a pkey/unique constraint? */
|
|
2800
2972
|
bool deferrable; /* is the constraint DEFERRABLE? */
|
|
@@ -2813,14 +2985,30 @@ typedef struct IndexStmt
|
|
|
2813
2985
|
typedef struct CreateStatsStmt
|
|
2814
2986
|
{
|
|
2815
2987
|
NodeTag type;
|
|
2816
|
-
List *defnames; /* qualified name (list of
|
|
2817
|
-
List *stat_types; /* stat types (list of
|
|
2988
|
+
List *defnames; /* qualified name (list of String) */
|
|
2989
|
+
List *stat_types; /* stat types (list of String) */
|
|
2818
2990
|
List *exprs; /* expressions to build statistics on */
|
|
2819
2991
|
List *relations; /* rels to build stats on (list of RangeVar) */
|
|
2820
2992
|
char *stxcomment; /* comment to apply to stats, or NULL */
|
|
2993
|
+
bool transformed; /* true when transformStatsStmt is finished */
|
|
2821
2994
|
bool if_not_exists; /* do nothing if stats name already exists */
|
|
2822
2995
|
} CreateStatsStmt;
|
|
2823
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
|
+
|
|
2824
3012
|
/* ----------------------
|
|
2825
3013
|
* Alter Statistics Statement
|
|
2826
3014
|
* ----------------------
|
|
@@ -2828,7 +3016,7 @@ typedef struct CreateStatsStmt
|
|
|
2828
3016
|
typedef struct AlterStatsStmt
|
|
2829
3017
|
{
|
|
2830
3018
|
NodeTag type;
|
|
2831
|
-
List *defnames; /* qualified name (list of
|
|
3019
|
+
List *defnames; /* qualified name (list of String) */
|
|
2832
3020
|
int stxstattarget; /* statistics target */
|
|
2833
3021
|
bool missing_ok; /* skip error if statistics object is missing */
|
|
2834
3022
|
} AlterStatsStmt;
|
|
@@ -2846,6 +3034,7 @@ typedef struct CreateFunctionStmt
|
|
|
2846
3034
|
List *parameters; /* a list of FunctionParameter */
|
|
2847
3035
|
TypeName *returnType; /* the return type */
|
|
2848
3036
|
List *options; /* a list of DefElem */
|
|
3037
|
+
Node *sql_body;
|
|
2849
3038
|
} CreateFunctionStmt;
|
|
2850
3039
|
|
|
2851
3040
|
typedef enum FunctionParameterMode
|
|
@@ -2855,7 +3044,9 @@ typedef enum FunctionParameterMode
|
|
|
2855
3044
|
FUNC_PARAM_OUT = 'o', /* output only */
|
|
2856
3045
|
FUNC_PARAM_INOUT = 'b', /* both */
|
|
2857
3046
|
FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */
|
|
2858
|
-
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 */
|
|
2859
3050
|
} FunctionParameterMode;
|
|
2860
3051
|
|
|
2861
3052
|
typedef struct FunctionParameter
|
|
@@ -2898,13 +3089,19 @@ typedef struct InlineCodeBlock
|
|
|
2898
3089
|
|
|
2899
3090
|
/* ----------------------
|
|
2900
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.)
|
|
2901
3097
|
* ----------------------
|
|
2902
3098
|
*/
|
|
2903
3099
|
typedef struct CallStmt
|
|
2904
3100
|
{
|
|
2905
3101
|
NodeTag type;
|
|
2906
3102
|
FuncCall *funccall; /* from the parser */
|
|
2907
|
-
FuncExpr *funcexpr; /* transformed */
|
|
3103
|
+
FuncExpr *funcexpr; /* transformed call, with only input args */
|
|
3104
|
+
List *outargs; /* transformed output-argument expressions */
|
|
2908
3105
|
} CallStmt;
|
|
2909
3106
|
|
|
2910
3107
|
typedef struct CallContext
|
|
@@ -2941,7 +3138,7 @@ typedef struct AlterObjectDependsStmt
|
|
|
2941
3138
|
ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
|
|
2942
3139
|
RangeVar *relation; /* in case a table is involved */
|
|
2943
3140
|
Node *object; /* name of the object */
|
|
2944
|
-
|
|
3141
|
+
String *extname; /* extension name */
|
|
2945
3142
|
bool remove; /* set true to remove dep rather than add */
|
|
2946
3143
|
} AlterObjectDependsStmt;
|
|
2947
3144
|
|
|
@@ -3087,8 +3284,8 @@ typedef struct CompositeTypeStmt
|
|
|
3087
3284
|
typedef struct CreateEnumStmt
|
|
3088
3285
|
{
|
|
3089
3286
|
NodeTag type;
|
|
3090
|
-
List *typeName; /* qualified name (list of
|
|
3091
|
-
List *vals; /* enum values (list of
|
|
3287
|
+
List *typeName; /* qualified name (list of String) */
|
|
3288
|
+
List *vals; /* enum values (list of String) */
|
|
3092
3289
|
} CreateEnumStmt;
|
|
3093
3290
|
|
|
3094
3291
|
/* ----------------------
|
|
@@ -3098,7 +3295,7 @@ typedef struct CreateEnumStmt
|
|
|
3098
3295
|
typedef struct CreateRangeStmt
|
|
3099
3296
|
{
|
|
3100
3297
|
NodeTag type;
|
|
3101
|
-
List *typeName; /* qualified name (list of
|
|
3298
|
+
List *typeName; /* qualified name (list of String) */
|
|
3102
3299
|
List *params; /* range parameters (list of DefElem) */
|
|
3103
3300
|
} CreateRangeStmt;
|
|
3104
3301
|
|
|
@@ -3109,7 +3306,7 @@ typedef struct CreateRangeStmt
|
|
|
3109
3306
|
typedef struct AlterEnumStmt
|
|
3110
3307
|
{
|
|
3111
3308
|
NodeTag type;
|
|
3112
|
-
List *typeName; /* qualified name (list of
|
|
3309
|
+
List *typeName; /* qualified name (list of String) */
|
|
3113
3310
|
char *oldVal; /* old enum value's name, if renaming */
|
|
3114
3311
|
char *newVal; /* new enum value's name */
|
|
3115
3312
|
char *newValNeighbor; /* neighboring enum value, if specified */
|
|
@@ -3171,6 +3368,12 @@ typedef struct AlterDatabaseStmt
|
|
|
3171
3368
|
List *options; /* List of DefElem nodes */
|
|
3172
3369
|
} AlterDatabaseStmt;
|
|
3173
3370
|
|
|
3371
|
+
typedef struct AlterDatabaseRefreshCollStmt
|
|
3372
|
+
{
|
|
3373
|
+
NodeTag type;
|
|
3374
|
+
char *dbname;
|
|
3375
|
+
} AlterDatabaseRefreshCollStmt;
|
|
3376
|
+
|
|
3174
3377
|
typedef struct AlterDatabaseSetStmt
|
|
3175
3378
|
{
|
|
3176
3379
|
NodeTag type;
|
|
@@ -3204,18 +3407,12 @@ typedef struct AlterSystemStmt
|
|
|
3204
3407
|
* Cluster Statement (support pbrown's cluster index implementation)
|
|
3205
3408
|
* ----------------------
|
|
3206
3409
|
*/
|
|
3207
|
-
typedef enum ClusterOption
|
|
3208
|
-
{
|
|
3209
|
-
CLUOPT_RECHECK = 1 << 0, /* recheck relation state */
|
|
3210
|
-
CLUOPT_VERBOSE = 1 << 1 /* print progress info */
|
|
3211
|
-
} ClusterOption;
|
|
3212
|
-
|
|
3213
3410
|
typedef struct ClusterStmt
|
|
3214
3411
|
{
|
|
3215
3412
|
NodeTag type;
|
|
3216
3413
|
RangeVar *relation; /* relation being indexed, or NULL if all */
|
|
3217
3414
|
char *indexname; /* original index defined */
|
|
3218
|
-
|
|
3415
|
+
List *params; /* list of DefElem nodes */
|
|
3219
3416
|
} ClusterStmt;
|
|
3220
3417
|
|
|
3221
3418
|
/* ----------------------
|
|
@@ -3281,7 +3478,7 @@ typedef struct CreateTableAsStmt
|
|
|
3281
3478
|
NodeTag type;
|
|
3282
3479
|
Node *query; /* the query (see comments above) */
|
|
3283
3480
|
IntoClause *into; /* destination table */
|
|
3284
|
-
ObjectType
|
|
3481
|
+
ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */
|
|
3285
3482
|
bool is_select_into; /* it was written as SELECT INTO */
|
|
3286
3483
|
bool if_not_exists; /* just do nothing if it already exists? */
|
|
3287
3484
|
} CreateTableAsStmt;
|
|
@@ -3353,11 +3550,6 @@ typedef struct ConstraintsSetStmt
|
|
|
3353
3550
|
* REINDEX Statement
|
|
3354
3551
|
* ----------------------
|
|
3355
3552
|
*/
|
|
3356
|
-
|
|
3357
|
-
/* Reindex options */
|
|
3358
|
-
#define REINDEXOPT_VERBOSE (1 << 0) /* print progress info */
|
|
3359
|
-
#define REINDEXOPT_REPORT_PROGRESS (1 << 1) /* report pgstat progress */
|
|
3360
|
-
|
|
3361
3553
|
typedef enum ReindexObjectType
|
|
3362
3554
|
{
|
|
3363
3555
|
REINDEX_OBJECT_INDEX, /* index */
|
|
@@ -3374,8 +3566,7 @@ typedef struct ReindexStmt
|
|
|
3374
3566
|
* etc. */
|
|
3375
3567
|
RangeVar *relation; /* Table or index to reindex */
|
|
3376
3568
|
const char *name; /* name of database to reindex */
|
|
3377
|
-
|
|
3378
|
-
bool concurrent; /* reindex concurrently? */
|
|
3569
|
+
List *params; /* list of DefElem nodes */
|
|
3379
3570
|
} ReindexStmt;
|
|
3380
3571
|
|
|
3381
3572
|
/* ----------------------
|
|
@@ -3483,7 +3674,7 @@ typedef struct ReassignOwnedStmt
|
|
|
3483
3674
|
typedef struct AlterTSDictionaryStmt
|
|
3484
3675
|
{
|
|
3485
3676
|
NodeTag type;
|
|
3486
|
-
List *dictname; /* qualified name (list of
|
|
3677
|
+
List *dictname; /* qualified name (list of String) */
|
|
3487
3678
|
List *options; /* List of DefElem nodes */
|
|
3488
3679
|
} AlterTSDictionaryStmt;
|
|
3489
3680
|
|
|
@@ -3503,29 +3694,64 @@ typedef struct AlterTSConfigurationStmt
|
|
|
3503
3694
|
{
|
|
3504
3695
|
NodeTag type;
|
|
3505
3696
|
AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */
|
|
3506
|
-
List *cfgname; /* qualified name (list of
|
|
3697
|
+
List *cfgname; /* qualified name (list of String) */
|
|
3507
3698
|
|
|
3508
3699
|
/*
|
|
3509
3700
|
* dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
|
|
3510
3701
|
* NIL, but tokentype isn't, DROP MAPPING was specified.
|
|
3511
3702
|
*/
|
|
3512
|
-
List *tokentype; /* list of
|
|
3513
|
-
List *dicts; /* list of list of
|
|
3703
|
+
List *tokentype; /* list of String */
|
|
3704
|
+
List *dicts; /* list of list of String */
|
|
3514
3705
|
bool override; /* if true - remove old variant */
|
|
3515
3706
|
bool replace; /* if true - replace dictionary by another */
|
|
3516
3707
|
bool missing_ok; /* for DROP - skip error if missing? */
|
|
3517
3708
|
} AlterTSConfigurationStmt;
|
|
3518
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;
|
|
3519
3738
|
|
|
3520
3739
|
typedef struct CreatePublicationStmt
|
|
3521
3740
|
{
|
|
3522
3741
|
NodeTag type;
|
|
3523
3742
|
char *pubname; /* Name of the publication */
|
|
3524
3743
|
List *options; /* List of DefElem nodes */
|
|
3525
|
-
List *
|
|
3744
|
+
List *pubobjects; /* Optional list of publication objects */
|
|
3526
3745
|
bool for_all_tables; /* Special publication for all tables in db */
|
|
3527
3746
|
} CreatePublicationStmt;
|
|
3528
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
|
+
|
|
3529
3755
|
typedef struct AlterPublicationStmt
|
|
3530
3756
|
{
|
|
3531
3757
|
NodeTag type;
|
|
@@ -3534,10 +3760,14 @@ typedef struct AlterPublicationStmt
|
|
|
3534
3760
|
/* parameters used for ALTER PUBLICATION ... WITH */
|
|
3535
3761
|
List *options; /* List of DefElem nodes */
|
|
3536
3762
|
|
|
3537
|
-
/*
|
|
3538
|
-
|
|
3763
|
+
/*
|
|
3764
|
+
* Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication
|
|
3765
|
+
* objects.
|
|
3766
|
+
*/
|
|
3767
|
+
List *pubobjects; /* Optional list of publication objects */
|
|
3539
3768
|
bool for_all_tables; /* Special publication for all tables in db */
|
|
3540
|
-
|
|
3769
|
+
AlterPublicationAction action; /* What action to perform with the given
|
|
3770
|
+
* objects */
|
|
3541
3771
|
} AlterPublicationStmt;
|
|
3542
3772
|
|
|
3543
3773
|
typedef struct CreateSubscriptionStmt
|
|
@@ -3553,9 +3783,12 @@ typedef enum AlterSubscriptionType
|
|
|
3553
3783
|
{
|
|
3554
3784
|
ALTER_SUBSCRIPTION_OPTIONS,
|
|
3555
3785
|
ALTER_SUBSCRIPTION_CONNECTION,
|
|
3556
|
-
|
|
3786
|
+
ALTER_SUBSCRIPTION_SET_PUBLICATION,
|
|
3787
|
+
ALTER_SUBSCRIPTION_ADD_PUBLICATION,
|
|
3788
|
+
ALTER_SUBSCRIPTION_DROP_PUBLICATION,
|
|
3557
3789
|
ALTER_SUBSCRIPTION_REFRESH,
|
|
3558
|
-
ALTER_SUBSCRIPTION_ENABLED
|
|
3790
|
+
ALTER_SUBSCRIPTION_ENABLED,
|
|
3791
|
+
ALTER_SUBSCRIPTION_SKIP
|
|
3559
3792
|
} AlterSubscriptionType;
|
|
3560
3793
|
|
|
3561
3794
|
typedef struct AlterSubscriptionStmt
|