pg_query 2.2.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +32 -0
- 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 +986 -301
- 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 +10 -7
- data/lib/pg_query/pg_query_pb.rb +1108 -942
- data/lib/pg_query/treewalker.rb +6 -0
- data/lib/pg_query/truncate.rb +1 -1
- data/lib/pg_query/version.rb +1 -1
- metadata +22 -12
- 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
@@ -93,34 +93,48 @@ _fingerprintString(FingerprintContext *ctx, const char *str)
|
|
93
93
|
}
|
94
94
|
|
95
95
|
static void
|
96
|
-
_fingerprintInteger(FingerprintContext *ctx, const
|
96
|
+
_fingerprintInteger(FingerprintContext *ctx, const union ValUnion *value)
|
97
97
|
{
|
98
|
-
if (
|
98
|
+
if (value->ival.ival != 0) {
|
99
99
|
_fingerprintString(ctx, "Integer");
|
100
100
|
_fingerprintString(ctx, "ival");
|
101
101
|
char buffer[50];
|
102
|
-
sprintf(buffer, "%d",
|
102
|
+
sprintf(buffer, "%d", value->ival.ival);
|
103
103
|
_fingerprintString(ctx, buffer);
|
104
104
|
}
|
105
105
|
}
|
106
106
|
|
107
107
|
static void
|
108
|
-
_fingerprintFloat(FingerprintContext *ctx, const
|
108
|
+
_fingerprintFloat(FingerprintContext *ctx, const union ValUnion *value)
|
109
109
|
{
|
110
|
-
if (
|
110
|
+
if (value->fval.fval != NULL) {
|
111
|
+
// NB: We output `str` here intentionally, to match the output format from libpg_query 14
|
112
|
+
// and below. This results in stable fingerprints, despite the field name being changed in
|
113
|
+
// PG15 to `fval`.
|
111
114
|
_fingerprintString(ctx, "Float");
|
112
115
|
_fingerprintString(ctx, "str");
|
113
|
-
_fingerprintString(ctx,
|
116
|
+
_fingerprintString(ctx, value->fval.fval);
|
114
117
|
}
|
115
118
|
}
|
116
119
|
|
117
120
|
static void
|
118
|
-
|
121
|
+
_fingerprintBoolean(FingerprintContext *ctx, const union ValUnion *value)
|
119
122
|
{
|
120
|
-
|
123
|
+
_fingerprintString(ctx, "Boolean");
|
124
|
+
_fingerprintString(ctx, "boolval");
|
125
|
+
_fingerprintString(ctx, value->boolval.boolval ? "true" : "false");
|
126
|
+
}
|
127
|
+
|
128
|
+
static void
|
129
|
+
_fingerprintBitString(FingerprintContext *ctx, const union ValUnion *value)
|
130
|
+
{
|
131
|
+
if (value->bsval.bsval != NULL) {
|
132
|
+
// NB: We output `str` here intentionally, to match the output format from libpg_query 14
|
133
|
+
// and below. This results in stable fingerprints, despite the field name being changed in
|
134
|
+
// PG15 to `bsval`.
|
121
135
|
_fingerprintString(ctx, "BitString");
|
122
136
|
_fingerprintString(ctx, "str");
|
123
|
-
_fingerprintString(ctx,
|
137
|
+
_fingerprintString(ctx, value->bsval.bsval);
|
124
138
|
}
|
125
139
|
}
|
126
140
|
|
@@ -272,10 +286,16 @@ _fingerprintNode(FingerprintContext *ctx, const void *obj, const void *parent, c
|
|
272
286
|
case T_Float:
|
273
287
|
_fingerprintFloat(ctx, obj);
|
274
288
|
break;
|
289
|
+
case T_Boolean:
|
290
|
+
_fingerprintBoolean(ctx, obj);
|
291
|
+
break;
|
275
292
|
case T_String:
|
293
|
+
// NB: We output `str` here intentionally, to match the output format from libpg_query
|
294
|
+
// 14 and below. This results in stable fingerprints, despite the field name being
|
295
|
+
// changed in PG15 to `sval`.
|
276
296
|
_fingerprintString(ctx, "String");
|
277
297
|
_fingerprintString(ctx, "str");
|
278
|
-
_fingerprintString(ctx, ((
|
298
|
+
_fingerprintString(ctx, ((union ValUnion*) obj)->sval.sval);
|
279
299
|
break;
|
280
300
|
case T_BitString:
|
281
301
|
_fingerprintBitString(ctx, obj);
|
@@ -96,7 +96,6 @@ static void dump_row(StringInfo out, PLpgSQL_row *stmt);
|
|
96
96
|
static void dump_var(StringInfo out, PLpgSQL_var *stmt);
|
97
97
|
static void dump_variable(StringInfo out, PLpgSQL_variable *stmt);
|
98
98
|
static void dump_record_field(StringInfo out, PLpgSQL_recfield *node);
|
99
|
-
static void dump_array_elem(StringInfo out, PLpgSQL_arrayelem *node);
|
100
99
|
static void dump_stmt(StringInfo out, PLpgSQL_stmt *stmt);
|
101
100
|
static void dump_block(StringInfo out, PLpgSQL_stmt_block *block);
|
102
101
|
static void dump_exception_block(StringInfo out, PLpgSQL_exception_block *node);
|
@@ -130,7 +129,6 @@ static void dump_perform(StringInfo out, PLpgSQL_stmt_perform *stmt);
|
|
130
129
|
static void dump_call(StringInfo out, PLpgSQL_stmt_call *stmt);
|
131
130
|
static void dump_commit(StringInfo out, PLpgSQL_stmt_commit *stmt);
|
132
131
|
static void dump_rollback(StringInfo out, PLpgSQL_stmt_rollback *stmt);
|
133
|
-
static void dump_set(StringInfo out, PLpgSQL_stmt_set *stmt);
|
134
132
|
static void dump_expr(StringInfo out, PLpgSQL_expr *expr);
|
135
133
|
static void dump_function(StringInfo out, PLpgSQL_function *func);
|
136
134
|
static void dump_exception(StringInfo out, PLpgSQL_exception *node);
|
@@ -224,9 +222,6 @@ dump_stmt(StringInfo out, PLpgSQL_stmt *node)
|
|
224
222
|
case PLPGSQL_STMT_ROLLBACK:
|
225
223
|
dump_rollback(out, (PLpgSQL_stmt_rollback *) node);
|
226
224
|
break;
|
227
|
-
case PLPGSQL_STMT_SET:
|
228
|
-
dump_set(out, (PLpgSQL_stmt_set *) node);
|
229
|
-
break;
|
230
225
|
default:
|
231
226
|
elog(ERROR, "unrecognized cmd_type: %d", node->cmd_type);
|
232
227
|
break;
|
@@ -493,15 +488,6 @@ dump_rollback(StringInfo out, PLpgSQL_stmt_rollback *node)
|
|
493
488
|
WRITE_BOOL_FIELD(chain, chain, chain);
|
494
489
|
}
|
495
490
|
|
496
|
-
static void
|
497
|
-
dump_set(StringInfo out, PLpgSQL_stmt_set *node)
|
498
|
-
{
|
499
|
-
WRITE_NODE_TYPE("PLpgSQL_stmt_set");
|
500
|
-
|
501
|
-
WRITE_INT_FIELD(lineno, lineno, lineno);
|
502
|
-
WRITE_EXPR_FIELD(expr);
|
503
|
-
}
|
504
|
-
|
505
491
|
static void
|
506
492
|
dump_exit(StringInfo out, PLpgSQL_stmt_exit *node)
|
507
493
|
{
|
@@ -673,9 +659,6 @@ dump_function(StringInfo out, PLpgSQL_function *node)
|
|
673
659
|
case PLPGSQL_DTYPE_RECFIELD:
|
674
660
|
dump_record_field(out, (PLpgSQL_recfield *) d);
|
675
661
|
break;
|
676
|
-
case PLPGSQL_DTYPE_ARRAYELEM:
|
677
|
-
dump_array_elem(out, (PLpgSQL_arrayelem *) d);
|
678
|
-
break;
|
679
662
|
default:
|
680
663
|
elog(WARNING, "could not dump unrecognized dtype: %d",
|
681
664
|
(int) d->dtype);
|
@@ -780,14 +763,6 @@ dump_record_field(StringInfo out, PLpgSQL_recfield *node) {
|
|
780
763
|
WRITE_INT_FIELD(recparentno, recparentno, recparentno);
|
781
764
|
}
|
782
765
|
|
783
|
-
static void
|
784
|
-
dump_array_elem(StringInfo out, PLpgSQL_arrayelem *node) {
|
785
|
-
WRITE_NODE_TYPE("PLpgSQL_arrayelem");
|
786
|
-
|
787
|
-
WRITE_EXPR_FIELD(subscript);
|
788
|
-
WRITE_INT_FIELD(arrayparentno, arrayparentno, arrayparentno);
|
789
|
-
}
|
790
|
-
|
791
766
|
char *
|
792
767
|
plpgsqlToJSON(PLpgSQL_function *func)
|
793
768
|
{
|
@@ -195,39 +195,77 @@ _outOidList(StringInfo out, const List *node)
|
|
195
195
|
}
|
196
196
|
|
197
197
|
static void
|
198
|
-
_outInteger(StringInfo out, const
|
198
|
+
_outInteger(StringInfo out, const Integer *node)
|
199
199
|
{
|
200
|
-
|
200
|
+
if (node->ival > 0)
|
201
|
+
appendStringInfo(out, "\"ival\":%d", node->ival);
|
201
202
|
}
|
202
203
|
|
203
204
|
static void
|
204
|
-
|
205
|
+
_outBoolean(StringInfo out, const Boolean *node)
|
205
206
|
{
|
206
|
-
appendStringInfo(out, "\"
|
207
|
-
_outToken(out, node->val.str);
|
208
|
-
appendStringInfo(out, ",");
|
207
|
+
appendStringInfo(out, "\"boolval\":%s", booltostr(node->boolval));
|
209
208
|
}
|
210
209
|
|
211
210
|
static void
|
212
|
-
|
211
|
+
_outFloat(StringInfo out, const Float *node)
|
213
212
|
{
|
214
|
-
appendStringInfo(out, "\"
|
215
|
-
_outToken(out, node->
|
216
|
-
appendStringInfo(out, ",");
|
213
|
+
appendStringInfo(out, "\"fval\":");
|
214
|
+
_outToken(out, node->fval);
|
217
215
|
}
|
218
216
|
|
219
217
|
static void
|
220
|
-
|
218
|
+
_outString(StringInfo out, const String *node)
|
221
219
|
{
|
222
|
-
appendStringInfo(out, "\"
|
223
|
-
_outToken(out, node->
|
224
|
-
appendStringInfo(out, ",");
|
220
|
+
appendStringInfo(out, "\"sval\":");
|
221
|
+
_outToken(out, node->sval);
|
225
222
|
}
|
226
223
|
|
227
224
|
static void
|
228
|
-
|
225
|
+
_outBitString(StringInfo out, const BitString *node)
|
229
226
|
{
|
230
|
-
|
227
|
+
appendStringInfo(out, "\"bsval\":");
|
228
|
+
_outToken(out, node->bsval);
|
229
|
+
}
|
230
|
+
|
231
|
+
static void
|
232
|
+
_outAConst(StringInfo out, const A_Const *node)
|
233
|
+
{
|
234
|
+
if (node->isnull) {
|
235
|
+
appendStringInfo(out, "\"isnull\":true");
|
236
|
+
} else {
|
237
|
+
switch (node->val.node.type) {
|
238
|
+
case T_Integer:
|
239
|
+
appendStringInfoString(out, "\"ival\":{");
|
240
|
+
_outInteger(out, &node->val.ival);
|
241
|
+
appendStringInfoChar(out, '}');
|
242
|
+
break;
|
243
|
+
case T_Float:
|
244
|
+
appendStringInfoString(out, "\"fval\":{");
|
245
|
+
_outFloat(out, &node->val.fval);
|
246
|
+
appendStringInfoChar(out, '}');
|
247
|
+
break;
|
248
|
+
case T_Boolean:
|
249
|
+
appendStringInfo(out, "\"boolval\":{%s}", node->val.boolval.boolval ? "\"boolval\":true" : "");
|
250
|
+
break;
|
251
|
+
case T_String:
|
252
|
+
appendStringInfoString(out, "\"sval\":{");
|
253
|
+
_outString(out, &node->val.sval);
|
254
|
+
appendStringInfoChar(out, '}');
|
255
|
+
break;
|
256
|
+
case T_BitString:
|
257
|
+
appendStringInfoString(out, "\"bsval\":{");
|
258
|
+
_outBitString(out, &node->val.bsval);
|
259
|
+
appendStringInfoChar(out, '}');
|
260
|
+
break;
|
261
|
+
|
262
|
+
// Unreachable, A_Const cannot contain any other nodes.
|
263
|
+
default:
|
264
|
+
Assert(false);
|
265
|
+
}
|
266
|
+
}
|
267
|
+
|
268
|
+
appendStringInfo(out, ",\"location\":%d", node->location);
|
231
269
|
}
|
232
270
|
|
233
271
|
#include "pg_query_enum_defs.c"
|
@@ -150,33 +150,93 @@ _outOidList(PgQuery__OidList* out, const List *node)
|
|
150
150
|
// TODO: Add Bitmapset
|
151
151
|
|
152
152
|
static void
|
153
|
-
_outInteger(PgQuery__Integer* out, const
|
153
|
+
_outInteger(PgQuery__Integer* out, const Integer *node)
|
154
154
|
{
|
155
|
-
out->ival = node->
|
155
|
+
out->ival = node->ival;
|
156
156
|
}
|
157
157
|
|
158
158
|
static void
|
159
|
-
_outFloat(PgQuery__Float* out, const
|
159
|
+
_outFloat(PgQuery__Float* out, const Float *node)
|
160
160
|
{
|
161
|
-
out->
|
161
|
+
out->fval = node->fval;
|
162
162
|
}
|
163
163
|
|
164
164
|
static void
|
165
|
-
|
165
|
+
_outBoolean(PgQuery__Boolean* out, const Boolean *node)
|
166
166
|
{
|
167
|
-
out->
|
167
|
+
out->boolval = node->boolval;
|
168
168
|
}
|
169
169
|
|
170
170
|
static void
|
171
|
-
|
171
|
+
_outString(PgQuery__String* out, const String *node)
|
172
172
|
{
|
173
|
-
out->
|
173
|
+
out->sval = node->sval;
|
174
174
|
}
|
175
175
|
|
176
176
|
static void
|
177
|
-
|
177
|
+
_outBitString(PgQuery__BitString* out, const BitString *node)
|
178
178
|
{
|
179
|
-
|
179
|
+
out->bsval = node->bsval;
|
180
|
+
}
|
181
|
+
|
182
|
+
static void
|
183
|
+
_outAConst(PgQuery__AConst* out, const A_Const *node)
|
184
|
+
{
|
185
|
+
out->isnull = node->isnull;
|
186
|
+
out->location = node->location;
|
187
|
+
|
188
|
+
if (!node->isnull) {
|
189
|
+
switch (nodeTag(&node->val.node)) {
|
190
|
+
case T_Integer: {
|
191
|
+
PgQuery__Integer *value = palloc(sizeof(PgQuery__Integer));
|
192
|
+
pg_query__integer__init(value);
|
193
|
+
value->ival = node->val.ival.ival;
|
194
|
+
|
195
|
+
out->val_case = PG_QUERY__A__CONST__VAL_IVAL;
|
196
|
+
out->ival = value;
|
197
|
+
break;
|
198
|
+
}
|
199
|
+
case T_Float: {
|
200
|
+
PgQuery__Float *value = palloc(sizeof(PgQuery__Float));
|
201
|
+
pg_query__float__init(value);
|
202
|
+
value->fval = pstrdup(node->val.fval.fval);
|
203
|
+
|
204
|
+
out->val_case = PG_QUERY__A__CONST__VAL_FVAL;
|
205
|
+
out->fval = value;
|
206
|
+
break;
|
207
|
+
}
|
208
|
+
case T_Boolean: {
|
209
|
+
PgQuery__Boolean *value = palloc(sizeof(PgQuery__Boolean));
|
210
|
+
pg_query__boolean__init(value);
|
211
|
+
value->boolval = node->val.boolval.boolval;
|
212
|
+
|
213
|
+
out->val_case = PG_QUERY__A__CONST__VAL_BOOLVAL;
|
214
|
+
out->boolval = value;
|
215
|
+
break;
|
216
|
+
}
|
217
|
+
case T_String: {
|
218
|
+
PgQuery__String *value = palloc(sizeof(PgQuery__String));
|
219
|
+
pg_query__string__init(value);
|
220
|
+
value->sval = pstrdup(node->val.sval.sval);
|
221
|
+
|
222
|
+
out->val_case = PG_QUERY__A__CONST__VAL_SVAL;
|
223
|
+
out->sval = value;
|
224
|
+
break;
|
225
|
+
}
|
226
|
+
case T_BitString: {
|
227
|
+
PgQuery__BitString *value = palloc(sizeof(PgQuery__BitString));
|
228
|
+
pg_query__bit_string__init(value);
|
229
|
+
value->bsval = pstrdup(node->val.bsval.bsval);
|
230
|
+
|
231
|
+
out->val_case = PG_QUERY__A__CONST__VAL_BSVAL;
|
232
|
+
out->bsval = value;
|
233
|
+
break;
|
234
|
+
}
|
235
|
+
default:
|
236
|
+
// Unreachable
|
237
|
+
Assert(false);
|
238
|
+
}
|
239
|
+
}
|
180
240
|
}
|
181
241
|
|
182
242
|
#include "pg_query_enum_defs.c"
|
@@ -74,6 +74,12 @@
|
|
74
74
|
|
75
75
|
static Node * _readNode(PgQuery__Node *msg);
|
76
76
|
|
77
|
+
static String *
|
78
|
+
_readString(PgQuery__String* msg)
|
79
|
+
{
|
80
|
+
return makeString(pstrdup(msg->sval));
|
81
|
+
}
|
82
|
+
|
77
83
|
#include "pg_query_enum_defs.c"
|
78
84
|
#include "pg_query_readfuncs_defs.c"
|
79
85
|
|
@@ -96,17 +102,45 @@ static Node * _readNode(PgQuery__Node *msg)
|
|
96
102
|
case PG_QUERY__NODE__NODE_INTEGER:
|
97
103
|
return (Node *) makeInteger(msg->integer->ival);
|
98
104
|
case PG_QUERY__NODE__NODE_FLOAT:
|
99
|
-
return (Node *) makeFloat(pstrdup(msg->float_->
|
105
|
+
return (Node *) makeFloat(pstrdup(msg->float_->fval));
|
106
|
+
case PG_QUERY__NODE__NODE_BOOLEAN:
|
107
|
+
return (Node *) makeBoolean(msg->boolean->boolval);
|
100
108
|
case PG_QUERY__NODE__NODE_STRING:
|
101
|
-
return (Node *) makeString(pstrdup(msg->string->
|
109
|
+
return (Node *) makeString(pstrdup(msg->string->sval));
|
102
110
|
case PG_QUERY__NODE__NODE_BIT_STRING:
|
103
|
-
return (Node *) makeBitString(pstrdup(msg->bit_string->
|
104
|
-
case
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
111
|
+
return (Node *) makeBitString(pstrdup(msg->bit_string->bsval));
|
112
|
+
case PG_QUERY__NODE__NODE_A_CONST: {
|
113
|
+
A_Const *ac = makeNode(A_Const);
|
114
|
+
ac->location = msg->a_const->location;
|
115
|
+
|
116
|
+
if (msg->a_const->isnull) {
|
117
|
+
ac->isnull = true;
|
118
|
+
} else {
|
119
|
+
switch (msg->a_const->val_case) {
|
120
|
+
case PG_QUERY__A__CONST__VAL_IVAL:
|
121
|
+
ac->val.ival = *makeInteger(msg->a_const->ival->ival);
|
122
|
+
break;
|
123
|
+
case PG_QUERY__A__CONST__VAL_FVAL:
|
124
|
+
ac->val.fval = *makeFloat(pstrdup(msg->a_const->fval->fval));
|
125
|
+
break;
|
126
|
+
case PG_QUERY__A__CONST__VAL_BOOLVAL:
|
127
|
+
ac->val.boolval = *makeBoolean(msg->a_const->boolval->boolval);
|
128
|
+
break;
|
129
|
+
case PG_QUERY__A__CONST__VAL_SVAL:
|
130
|
+
ac->val.sval = *makeString(pstrdup(msg->a_const->sval->sval));
|
131
|
+
break;
|
132
|
+
case PG_QUERY__A__CONST__VAL_BSVAL:
|
133
|
+
ac->val.bsval = *makeBitString(pstrdup(msg->a_const->bsval->bsval));
|
134
|
+
break;
|
135
|
+
case PG_QUERY__A__CONST__VAL__NOT_SET:
|
136
|
+
case _PG_QUERY__A__CONST__VAL__CASE_IS_INT_SIZE:
|
137
|
+
Assert(false);
|
138
|
+
break;
|
139
|
+
}
|
109
140
|
}
|
141
|
+
|
142
|
+
return (Node *) ac;
|
143
|
+
}
|
110
144
|
case PG_QUERY__NODE__NODE_LIST:
|
111
145
|
return (Node *) _readList(msg->list);
|
112
146
|
case PG_QUERY__NODE__NODE__NOT_SET:
|
@@ -101,8 +101,9 @@ PgQueryScanResult pg_query_scan(const char* input)
|
|
101
101
|
output_tokens[i]->token = tok;
|
102
102
|
|
103
103
|
switch (tok) {
|
104
|
-
#define PG_KEYWORD(a,b,c) case b: output_tokens[i]->keyword_kind = c + 1; break;
|
104
|
+
#define PG_KEYWORD(a,b,c,d) case b: output_tokens[i]->keyword_kind = c + 1; break;
|
105
105
|
#include "parser/kwlist.h"
|
106
|
+
#undef PG_KEYWORD
|
106
107
|
default: output_tokens[i]->keyword_kind = 0;
|
107
108
|
}
|
108
109
|
}
|
@@ -59,8 +59,9 @@ PgQuerySplitResult pg_query_split_with_scanner(const char* input)
|
|
59
59
|
{
|
60
60
|
int tok = core_yylex(&yylval, &yylloc, yyscanner);
|
61
61
|
switch (tok) {
|
62
|
-
#define PG_KEYWORD(a,b,c) case b: is_keyword = true; break;
|
62
|
+
#define PG_KEYWORD(a,b,c,d) case b: is_keyword = true; break;
|
63
63
|
#include "parser/kwlist.h"
|
64
|
+
#undef PG_KEYWORD
|
64
65
|
default: is_keyword = false;
|
65
66
|
}
|
66
67
|
if (is_keyword)
|
@@ -88,7 +89,7 @@ PgQuerySplitResult pg_query_split_with_scanner(const char* input)
|
|
88
89
|
{
|
89
90
|
int tok = core_yylex(&yylval, &yylloc, yyscanner);
|
90
91
|
switch (tok) {
|
91
|
-
#define PG_KEYWORD(a,b,c) case b: is_keyword = true; break;
|
92
|
+
#define PG_KEYWORD(a,b,c,d) case b: is_keyword = true; break;
|
92
93
|
#include "parser/kwlist.h"
|
93
94
|
default: is_keyword = false;
|
94
95
|
}
|
@@ -16,7 +16,7 @@
|
|
16
16
|
* and implementing search-path-controlled searches.
|
17
17
|
*
|
18
18
|
*
|
19
|
-
* Portions Copyright (c) 1996-
|
19
|
+
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
|
20
20
|
* Portions Copyright (c) 1994, Regents of the University of California
|
21
21
|
*
|
22
22
|
* IDENTIFICATION
|
@@ -214,6 +214,7 @@ static void RemoveTempRelations(Oid tempNamespaceId);
|
|
214
214
|
static void RemoveTempRelationsCallback(int code, Datum arg);
|
215
215
|
static void NamespaceCallback(Datum arg, int cacheid, uint32 hashvalue);
|
216
216
|
static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
|
217
|
+
bool include_out_arguments, int pronargs,
|
217
218
|
int **argnumbers);
|
218
219
|
|
219
220
|
|
@@ -356,6 +357,12 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
|
|
356
357
|
* of additional args (which can be retrieved from the function's
|
357
358
|
* proargdefaults entry).
|
358
359
|
*
|
360
|
+
* If include_out_arguments is true, then OUT-mode arguments are considered to
|
361
|
+
* be included in the argument list. Their types are included in the returned
|
362
|
+
* arrays, and argnumbers are indexes in proallargtypes not proargtypes.
|
363
|
+
* We also set nominalnargs to be the length of proallargtypes not proargtypes.
|
364
|
+
* Otherwise OUT-mode arguments are ignored.
|
365
|
+
*
|
359
366
|
* It is not possible for nvargs and ndargs to both be nonzero in the same
|
360
367
|
* list entry, since default insertion allows matches to functions with more
|
361
368
|
* than nargs arguments while the variadic transformation requires the same
|
@@ -366,7 +373,8 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
|
|
366
373
|
* first any positional arguments, then the named arguments, then defaulted
|
367
374
|
* arguments (if needed and allowed by expand_defaults). The argnumbers[]
|
368
375
|
* array can be used to map this back to the catalog information.
|
369
|
-
* argnumbers[k] is set to the proargtypes index of the
|
376
|
+
* argnumbers[k] is set to the proargtypes or proallargtypes index of the
|
377
|
+
* k'th call argument.
|
370
378
|
*
|
371
379
|
* We search a single namespace if the function name is qualified, else
|
372
380
|
* all namespaces in the search path. In the multiple-namespace case,
|
@@ -390,7 +398,7 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
|
|
390
398
|
* such an entry it should react as though the call were ambiguous.
|
391
399
|
*
|
392
400
|
* If missing_ok is true, an empty list (NULL) is returned if the name was
|
393
|
-
* schema-
|
401
|
+
* schema-qualified with a schema that does not exist. Likewise if no
|
394
402
|
* candidate is found for other reasons.
|
395
403
|
*/
|
396
404
|
|
@@ -404,6 +412,10 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
|
|
404
412
|
* the function, in positions after the last positional argument, and there
|
405
413
|
* are defaults for all unsupplied arguments.
|
406
414
|
*
|
415
|
+
* If include_out_arguments is true, we are treating OUT arguments as
|
416
|
+
* included in the argument list. pronargs is the number of arguments
|
417
|
+
* we're considering (the length of either proargtypes or proallargtypes).
|
418
|
+
*
|
407
419
|
* The number of positional arguments is nargs - list_length(argnames).
|
408
420
|
* Note caller has already done basic checks on argument count.
|
409
421
|
*
|
@@ -428,8 +440,7 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
|
|
428
440
|
* Given a possibly-qualified operator name and exact input datatypes,
|
429
441
|
* look up the operator. Returns InvalidOid if not found.
|
430
442
|
*
|
431
|
-
* Pass oprleft = InvalidOid for a prefix op
|
432
|
-
* a postfix op.
|
443
|
+
* Pass oprleft = InvalidOid for a prefix op.
|
433
444
|
*
|
434
445
|
* If the operator name is not schema-qualified, it is sought in the current
|
435
446
|
* namespace search path. If the name is schema-qualified and the given
|
@@ -451,8 +462,8 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
|
|
451
462
|
* namespace case, we arrange for entries in earlier namespaces to mask
|
452
463
|
* identical entries in later namespaces.
|
453
464
|
*
|
454
|
-
* The returned items always have two args[] entries ---
|
455
|
-
*
|
465
|
+
* The returned items always have two args[] entries --- the first will be
|
466
|
+
* InvalidOid for a prefix oprkind. nargs is always 2, too.
|
456
467
|
*/
|
457
468
|
#define SPACE_PER_OP MAXALIGN(offsetof(struct _FuncCandidateList, args) + \
|
458
469
|
2 * sizeof(Oid))
|
@@ -677,7 +688,7 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
|
|
677
688
|
|
678
689
|
/*
|
679
690
|
* QualifiedNameGetCreationNamespace
|
680
|
-
* Given a possibly-qualified name for an object (in List-of-
|
691
|
+
* Given a possibly-qualified name for an object (in List-of-Strings
|
681
692
|
* format), determine what namespace the object should be created in.
|
682
693
|
* Also extract and return the object name (last component of list).
|
683
694
|
*
|
@@ -710,7 +721,7 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
|
|
710
721
|
* This is used primarily to form error messages, and so we do not quote
|
711
722
|
* the list elements, for the sake of legibility.
|
712
723
|
*
|
713
|
-
* In most scenarios the list elements should always be
|
724
|
+
* In most scenarios the list elements should always be String values,
|
714
725
|
* but we also allow A_Star for the convenience of ColumnRef processing.
|
715
726
|
*/
|
716
727
|
char *
|
@@ -9,7 +9,7 @@
|
|
9
9
|
* pg_proc.c
|
10
10
|
* routines to support manipulation of the pg_proc relation
|
11
11
|
*
|
12
|
-
* Portions Copyright (c) 1996-
|
12
|
+
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
|
13
13
|
* Portions Copyright (c) 1994, Regents of the University of California
|
14
14
|
*
|
15
15
|
*
|
@@ -38,8 +38,11 @@
|
|
38
38
|
#include "mb/pg_wchar.h"
|
39
39
|
#include "miscadmin.h"
|
40
40
|
#include "nodes/nodeFuncs.h"
|
41
|
+
#include "parser/analyze.h"
|
41
42
|
#include "parser/parse_coerce.h"
|
42
43
|
#include "parser/parse_type.h"
|
44
|
+
#include "pgstat.h"
|
45
|
+
#include "rewrite/rewriteHandler.h"
|
43
46
|
#include "tcop/pquery.h"
|
44
47
|
#include "tcop/tcopprot.h"
|
45
48
|
#include "utils/acl.h"
|
@@ -10,7 +10,7 @@
|
|
10
10
|
* Support routines for various kinds of object creation.
|
11
11
|
*
|
12
12
|
*
|
13
|
-
* Portions Copyright (c) 1996-
|
13
|
+
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
|
14
14
|
* Portions Copyright (c) 1994, Regents of the University of California
|
15
15
|
*
|
16
16
|
*
|
@@ -92,6 +92,11 @@ defGetInt32(DefElem *def)
|
|
92
92
|
*/
|
93
93
|
|
94
94
|
|
95
|
+
/*
|
96
|
+
* Extract an OID value from a DefElem.
|
97
|
+
*/
|
98
|
+
|
99
|
+
|
95
100
|
/*
|
96
101
|
* Extract a possibly-qualified name (as a List of Strings) from a DefElem.
|
97
102
|
*/
|
@@ -115,3 +120,8 @@ defGetInt32(DefElem *def)
|
|
115
120
|
* Extract a list of string values (otherwise uninterpreted) from a DefElem.
|
116
121
|
*/
|
117
122
|
|
123
|
+
|
124
|
+
/*
|
125
|
+
* Raise an error about a conflicting DefElem.
|
126
|
+
*/
|
127
|
+
|
@@ -23,7 +23,7 @@
|
|
23
23
|
* bms_is_empty() in preference to testing for NULL.)
|
24
24
|
*
|
25
25
|
*
|
26
|
-
* Copyright (c) 2003-
|
26
|
+
* Copyright (c) 2003-2022, PostgreSQL Global Development Group
|
27
27
|
*
|
28
28
|
* IDENTIFICATION
|
29
29
|
* src/backend/nodes/bitmapset.c
|
@@ -233,6 +233,8 @@ bms_free(Bitmapset *a)
|
|
233
233
|
|
234
234
|
/*
|
235
235
|
* bms_nonempty_difference - do sets have a nonempty difference?
|
236
|
+
*
|
237
|
+
* i.e., are any members set in 'a' that are not also set in 'b'.
|
236
238
|
*/
|
237
239
|
|
238
240
|
|