gitlab-pg_query 1.3.1 → 2.0.4
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 +217 -99
- data/README.md +92 -69
- data/Rakefile +85 -5
- data/ext/pg_query/extconf.rb +3 -40
- data/ext/pg_query/guc-file.c +0 -0
- data/ext/pg_query/include/access/amapi.h +246 -0
- data/ext/pg_query/include/access/attmap.h +52 -0
- data/ext/pg_query/include/access/attnum.h +64 -0
- data/ext/pg_query/include/access/clog.h +61 -0
- data/ext/pg_query/include/access/commit_ts.h +77 -0
- data/ext/pg_query/include/access/detoast.h +92 -0
- data/ext/pg_query/include/access/genam.h +228 -0
- data/ext/pg_query/include/access/gin.h +78 -0
- data/ext/pg_query/include/access/htup.h +89 -0
- data/ext/pg_query/include/access/htup_details.h +819 -0
- data/ext/pg_query/include/access/itup.h +161 -0
- data/ext/pg_query/include/access/parallel.h +82 -0
- data/ext/pg_query/include/access/printtup.h +35 -0
- data/ext/pg_query/include/access/relation.h +28 -0
- data/ext/pg_query/include/access/relscan.h +176 -0
- data/ext/pg_query/include/access/rmgr.h +35 -0
- data/ext/pg_query/include/access/rmgrlist.h +49 -0
- data/ext/pg_query/include/access/sdir.h +58 -0
- data/ext/pg_query/include/access/skey.h +151 -0
- data/ext/pg_query/include/access/stratnum.h +83 -0
- data/ext/pg_query/include/access/sysattr.h +29 -0
- data/ext/pg_query/include/access/table.h +27 -0
- data/ext/pg_query/include/access/tableam.h +1825 -0
- data/ext/pg_query/include/access/transam.h +265 -0
- data/ext/pg_query/include/access/tupconvert.h +51 -0
- data/ext/pg_query/include/access/tupdesc.h +154 -0
- data/ext/pg_query/include/access/tupmacs.h +247 -0
- data/ext/pg_query/include/access/twophase.h +61 -0
- data/ext/pg_query/include/access/xact.h +463 -0
- data/ext/pg_query/include/access/xlog.h +398 -0
- data/ext/pg_query/include/access/xlog_internal.h +330 -0
- data/ext/pg_query/include/access/xlogdefs.h +109 -0
- data/ext/pg_query/include/access/xloginsert.h +64 -0
- data/ext/pg_query/include/access/xlogreader.h +327 -0
- data/ext/pg_query/include/access/xlogrecord.h +227 -0
- data/ext/pg_query/include/bootstrap/bootstrap.h +62 -0
- data/ext/pg_query/include/c.h +1322 -0
- data/ext/pg_query/include/catalog/catalog.h +42 -0
- data/ext/pg_query/include/catalog/catversion.h +58 -0
- data/ext/pg_query/include/catalog/dependency.h +275 -0
- data/ext/pg_query/include/catalog/genbki.h +64 -0
- data/ext/pg_query/include/catalog/index.h +199 -0
- data/ext/pg_query/include/catalog/indexing.h +366 -0
- data/ext/pg_query/include/catalog/namespace.h +188 -0
- data/ext/pg_query/include/catalog/objectaccess.h +197 -0
- data/ext/pg_query/include/catalog/objectaddress.h +84 -0
- data/ext/pg_query/include/catalog/pg_aggregate.h +176 -0
- data/ext/pg_query/include/catalog/pg_aggregate_d.h +77 -0
- data/ext/pg_query/include/catalog/pg_am.h +60 -0
- data/ext/pg_query/include/catalog/pg_am_d.h +45 -0
- data/ext/pg_query/include/catalog/pg_attribute.h +204 -0
- data/ext/pg_query/include/catalog/pg_attribute_d.h +59 -0
- data/ext/pg_query/include/catalog/pg_authid.h +58 -0
- data/ext/pg_query/include/catalog/pg_authid_d.h +49 -0
- data/ext/pg_query/include/catalog/pg_class.h +200 -0
- data/ext/pg_query/include/catalog/pg_class_d.h +103 -0
- data/ext/pg_query/include/catalog/pg_collation.h +73 -0
- data/ext/pg_query/include/catalog/pg_collation_d.h +45 -0
- data/ext/pg_query/include/catalog/pg_constraint.h +247 -0
- data/ext/pg_query/include/catalog/pg_constraint_d.h +67 -0
- data/ext/pg_query/include/catalog/pg_control.h +250 -0
- data/ext/pg_query/include/catalog/pg_conversion.h +72 -0
- data/ext/pg_query/include/catalog/pg_conversion_d.h +35 -0
- data/ext/pg_query/include/catalog/pg_depend.h +73 -0
- data/ext/pg_query/include/catalog/pg_depend_d.h +34 -0
- data/ext/pg_query/include/catalog/pg_event_trigger.h +51 -0
- data/ext/pg_query/include/catalog/pg_event_trigger_d.h +34 -0
- data/ext/pg_query/include/catalog/pg_index.h +80 -0
- data/ext/pg_query/include/catalog/pg_index_d.h +56 -0
- data/ext/pg_query/include/catalog/pg_language.h +67 -0
- data/ext/pg_query/include/catalog/pg_language_d.h +39 -0
- data/ext/pg_query/include/catalog/pg_namespace.h +59 -0
- data/ext/pg_query/include/catalog/pg_namespace_d.h +34 -0
- data/ext/pg_query/include/catalog/pg_opclass.h +85 -0
- data/ext/pg_query/include/catalog/pg_opclass_d.h +49 -0
- data/ext/pg_query/include/catalog/pg_operator.h +102 -0
- data/ext/pg_query/include/catalog/pg_operator_d.h +106 -0
- data/ext/pg_query/include/catalog/pg_opfamily.h +60 -0
- data/ext/pg_query/include/catalog/pg_opfamily_d.h +47 -0
- data/ext/pg_query/include/catalog/pg_partitioned_table.h +63 -0
- data/ext/pg_query/include/catalog/pg_partitioned_table_d.h +35 -0
- data/ext/pg_query/include/catalog/pg_proc.h +211 -0
- data/ext/pg_query/include/catalog/pg_proc_d.h +99 -0
- data/ext/pg_query/include/catalog/pg_publication.h +115 -0
- data/ext/pg_query/include/catalog/pg_publication_d.h +36 -0
- data/ext/pg_query/include/catalog/pg_replication_origin.h +57 -0
- data/ext/pg_query/include/catalog/pg_replication_origin_d.h +29 -0
- data/ext/pg_query/include/catalog/pg_statistic.h +275 -0
- data/ext/pg_query/include/catalog/pg_statistic_d.h +194 -0
- data/ext/pg_query/include/catalog/pg_statistic_ext.h +74 -0
- data/ext/pg_query/include/catalog/pg_statistic_ext_d.h +40 -0
- data/ext/pg_query/include/catalog/pg_transform.h +45 -0
- data/ext/pg_query/include/catalog/pg_transform_d.h +32 -0
- data/ext/pg_query/include/catalog/pg_trigger.h +137 -0
- data/ext/pg_query/include/catalog/pg_trigger_d.h +106 -0
- data/ext/pg_query/include/catalog/pg_ts_config.h +50 -0
- data/ext/pg_query/include/catalog/pg_ts_config_d.h +32 -0
- data/ext/pg_query/include/catalog/pg_ts_dict.h +54 -0
- data/ext/pg_query/include/catalog/pg_ts_dict_d.h +33 -0
- data/ext/pg_query/include/catalog/pg_ts_parser.h +57 -0
- data/ext/pg_query/include/catalog/pg_ts_parser_d.h +35 -0
- data/ext/pg_query/include/catalog/pg_ts_template.h +48 -0
- data/ext/pg_query/include/catalog/pg_ts_template_d.h +32 -0
- data/ext/pg_query/include/catalog/pg_type.h +372 -0
- data/ext/pg_query/include/catalog/pg_type_d.h +285 -0
- data/ext/pg_query/include/catalog/storage.h +48 -0
- data/ext/pg_query/include/commands/async.h +54 -0
- data/ext/pg_query/include/commands/dbcommands.h +35 -0
- data/ext/pg_query/include/commands/defrem.h +173 -0
- data/ext/pg_query/include/commands/event_trigger.h +88 -0
- data/ext/pg_query/include/commands/explain.h +127 -0
- data/ext/pg_query/include/commands/prepare.h +61 -0
- data/ext/pg_query/include/commands/tablespace.h +67 -0
- data/ext/pg_query/include/commands/trigger.h +277 -0
- data/ext/pg_query/include/commands/user.h +37 -0
- data/ext/pg_query/include/commands/vacuum.h +293 -0
- data/ext/pg_query/include/commands/variable.h +38 -0
- data/ext/pg_query/include/common/file_perm.h +56 -0
- data/ext/pg_query/include/common/hashfn.h +104 -0
- data/ext/pg_query/include/common/ip.h +37 -0
- data/ext/pg_query/include/common/keywords.h +33 -0
- data/ext/pg_query/include/common/kwlookup.h +44 -0
- data/ext/pg_query/include/common/relpath.h +90 -0
- data/ext/pg_query/include/common/string.h +19 -0
- data/ext/pg_query/include/common/unicode_combining_table.h +196 -0
- data/ext/pg_query/include/datatype/timestamp.h +197 -0
- data/ext/pg_query/include/executor/execdesc.h +70 -0
- data/ext/pg_query/include/executor/executor.h +614 -0
- data/ext/pg_query/include/executor/functions.h +41 -0
- data/ext/pg_query/include/executor/instrument.h +101 -0
- data/ext/pg_query/include/executor/spi.h +175 -0
- data/ext/pg_query/include/executor/tablefunc.h +67 -0
- data/ext/pg_query/include/executor/tuptable.h +487 -0
- data/ext/pg_query/include/fmgr.h +775 -0
- data/ext/pg_query/include/funcapi.h +348 -0
- data/ext/pg_query/include/getaddrinfo.h +162 -0
- data/ext/pg_query/include/jit/jit.h +105 -0
- data/ext/pg_query/include/kwlist_d.h +1072 -0
- data/ext/pg_query/include/lib/ilist.h +727 -0
- data/ext/pg_query/include/lib/pairingheap.h +102 -0
- data/ext/pg_query/include/lib/simplehash.h +1059 -0
- data/ext/pg_query/include/lib/stringinfo.h +161 -0
- data/ext/pg_query/include/libpq/auth.h +29 -0
- data/ext/pg_query/include/libpq/crypt.h +46 -0
- data/ext/pg_query/include/libpq/hba.h +140 -0
- data/ext/pg_query/include/libpq/libpq-be.h +326 -0
- data/ext/pg_query/include/libpq/libpq.h +133 -0
- data/ext/pg_query/include/libpq/pqcomm.h +208 -0
- data/ext/pg_query/include/libpq/pqformat.h +210 -0
- data/ext/pg_query/include/libpq/pqsignal.h +42 -0
- data/ext/pg_query/include/mb/pg_wchar.h +672 -0
- data/ext/pg_query/include/mb/stringinfo_mb.h +24 -0
- data/ext/pg_query/include/miscadmin.h +476 -0
- data/ext/pg_query/include/nodes/bitmapset.h +122 -0
- data/ext/pg_query/include/nodes/execnodes.h +2520 -0
- data/ext/pg_query/include/nodes/extensible.h +160 -0
- data/ext/pg_query/include/nodes/lockoptions.h +61 -0
- data/ext/pg_query/include/nodes/makefuncs.h +108 -0
- data/ext/pg_query/include/nodes/memnodes.h +108 -0
- data/ext/pg_query/include/nodes/nodeFuncs.h +162 -0
- data/ext/pg_query/include/nodes/nodes.h +842 -0
- data/ext/pg_query/include/nodes/params.h +170 -0
- data/ext/pg_query/include/nodes/parsenodes.h +3579 -0
- data/ext/pg_query/include/nodes/pathnodes.h +2556 -0
- data/ext/pg_query/include/nodes/pg_list.h +605 -0
- data/ext/pg_query/include/nodes/plannodes.h +1251 -0
- data/ext/pg_query/include/nodes/primnodes.h +1541 -0
- data/ext/pg_query/include/nodes/print.h +34 -0
- data/ext/pg_query/include/nodes/tidbitmap.h +75 -0
- data/ext/pg_query/include/nodes/value.h +61 -0
- data/ext/pg_query/include/optimizer/cost.h +206 -0
- data/ext/pg_query/include/optimizer/geqo.h +88 -0
- data/ext/pg_query/include/optimizer/geqo_gene.h +45 -0
- data/ext/pg_query/include/optimizer/optimizer.h +199 -0
- data/ext/pg_query/include/optimizer/paths.h +249 -0
- data/ext/pg_query/include/optimizer/planmain.h +119 -0
- data/ext/pg_query/include/parser/analyze.h +49 -0
- data/ext/pg_query/include/parser/gram.h +1067 -0
- data/ext/pg_query/include/parser/gramparse.h +75 -0
- data/ext/pg_query/include/parser/kwlist.h +477 -0
- data/ext/pg_query/include/parser/parse_agg.h +68 -0
- data/ext/pg_query/include/parser/parse_clause.h +54 -0
- data/ext/pg_query/include/parser/parse_coerce.h +97 -0
- data/ext/pg_query/include/parser/parse_collate.h +27 -0
- data/ext/pg_query/include/parser/parse_expr.h +26 -0
- data/ext/pg_query/include/parser/parse_func.h +73 -0
- data/ext/pg_query/include/parser/parse_node.h +327 -0
- data/ext/pg_query/include/parser/parse_oper.h +67 -0
- data/ext/pg_query/include/parser/parse_relation.h +123 -0
- data/ext/pg_query/include/parser/parse_target.h +46 -0
- data/ext/pg_query/include/parser/parse_type.h +60 -0
- data/ext/pg_query/include/parser/parser.h +41 -0
- data/ext/pg_query/include/parser/parsetree.h +61 -0
- data/ext/pg_query/include/parser/scanner.h +152 -0
- data/ext/pg_query/include/parser/scansup.h +30 -0
- data/ext/pg_query/include/partitioning/partdefs.h +26 -0
- data/ext/pg_query/include/pg_config.h +989 -0
- data/ext/pg_query/include/pg_config_ext.h +8 -0
- data/ext/pg_query/include/pg_config_manual.h +350 -0
- data/ext/pg_query/include/pg_config_os.h +8 -0
- data/ext/pg_query/include/pg_getopt.h +56 -0
- data/ext/pg_query/include/pg_query.h +121 -0
- data/ext/pg_query/include/pg_query_enum_defs.c +2454 -0
- data/ext/pg_query/include/pg_query_fingerprint_conds.c +875 -0
- data/ext/pg_query/include/pg_query_fingerprint_defs.c +12413 -0
- data/ext/pg_query/include/pg_query_json_helper.c +61 -0
- data/ext/pg_query/include/pg_query_outfuncs_conds.c +686 -0
- data/ext/pg_query/include/pg_query_outfuncs_defs.c +2437 -0
- data/ext/pg_query/include/pg_query_readfuncs_conds.c +222 -0
- data/ext/pg_query/include/pg_query_readfuncs_defs.c +2878 -0
- data/ext/pg_query/include/pg_trace.h +17 -0
- data/ext/pg_query/include/pgstat.h +1487 -0
- data/ext/pg_query/include/pgtime.h +84 -0
- data/ext/pg_query/include/pl_gram.h +385 -0
- data/ext/pg_query/include/pl_reserved_kwlist.h +52 -0
- data/ext/pg_query/include/pl_reserved_kwlist_d.h +114 -0
- data/ext/pg_query/include/pl_unreserved_kwlist.h +112 -0
- data/ext/pg_query/include/pl_unreserved_kwlist_d.h +246 -0
- data/ext/pg_query/include/plerrcodes.h +990 -0
- data/ext/pg_query/include/plpgsql.h +1347 -0
- data/ext/pg_query/include/port.h +524 -0
- data/ext/pg_query/include/port/atomics.h +524 -0
- data/ext/pg_query/include/port/atomics/arch-arm.h +26 -0
- data/ext/pg_query/include/port/atomics/arch-ppc.h +254 -0
- data/ext/pg_query/include/port/atomics/arch-x86.h +252 -0
- data/ext/pg_query/include/port/atomics/fallback.h +170 -0
- data/ext/pg_query/include/port/atomics/generic-gcc.h +286 -0
- data/ext/pg_query/include/port/atomics/generic.h +401 -0
- data/ext/pg_query/include/port/pg_bitutils.h +226 -0
- data/ext/pg_query/include/port/pg_bswap.h +161 -0
- data/ext/pg_query/include/port/pg_crc32c.h +101 -0
- data/ext/pg_query/include/portability/instr_time.h +256 -0
- data/ext/pg_query/include/postgres.h +764 -0
- data/ext/pg_query/include/postgres_ext.h +74 -0
- data/ext/pg_query/include/postmaster/autovacuum.h +83 -0
- data/ext/pg_query/include/postmaster/bgworker.h +161 -0
- data/ext/pg_query/include/postmaster/bgworker_internals.h +64 -0
- data/ext/pg_query/include/postmaster/bgwriter.h +45 -0
- data/ext/pg_query/include/postmaster/fork_process.h +17 -0
- data/ext/pg_query/include/postmaster/interrupt.h +32 -0
- data/ext/pg_query/include/postmaster/pgarch.h +39 -0
- data/ext/pg_query/include/postmaster/postmaster.h +77 -0
- data/ext/pg_query/include/postmaster/syslogger.h +98 -0
- data/ext/pg_query/include/postmaster/walwriter.h +21 -0
- data/ext/pg_query/include/protobuf-c.h +1106 -0
- data/ext/pg_query/include/protobuf-c/protobuf-c.h +1106 -0
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +10846 -0
- data/ext/pg_query/include/protobuf/pg_query.pb.h +124718 -0
- data/ext/pg_query/include/regex/regex.h +184 -0
- data/ext/pg_query/include/replication/logicallauncher.h +31 -0
- data/ext/pg_query/include/replication/logicalproto.h +110 -0
- data/ext/pg_query/include/replication/logicalworker.h +19 -0
- data/ext/pg_query/include/replication/origin.h +73 -0
- data/ext/pg_query/include/replication/reorderbuffer.h +467 -0
- data/ext/pg_query/include/replication/slot.h +219 -0
- data/ext/pg_query/include/replication/syncrep.h +115 -0
- data/ext/pg_query/include/replication/walreceiver.h +340 -0
- data/ext/pg_query/include/replication/walsender.h +74 -0
- data/ext/pg_query/include/rewrite/prs2lock.h +46 -0
- data/ext/pg_query/include/rewrite/rewriteHandler.h +40 -0
- data/ext/pg_query/include/rewrite/rewriteManip.h +87 -0
- data/ext/pg_query/include/rewrite/rewriteSupport.h +26 -0
- data/ext/pg_query/include/storage/backendid.h +37 -0
- data/ext/pg_query/include/storage/block.h +121 -0
- data/ext/pg_query/include/storage/buf.h +46 -0
- data/ext/pg_query/include/storage/bufmgr.h +292 -0
- data/ext/pg_query/include/storage/bufpage.h +459 -0
- data/ext/pg_query/include/storage/condition_variable.h +62 -0
- data/ext/pg_query/include/storage/dsm.h +61 -0
- data/ext/pg_query/include/storage/dsm_impl.h +75 -0
- data/ext/pg_query/include/storage/fd.h +168 -0
- data/ext/pg_query/include/storage/ipc.h +81 -0
- data/ext/pg_query/include/storage/item.h +19 -0
- data/ext/pg_query/include/storage/itemid.h +184 -0
- data/ext/pg_query/include/storage/itemptr.h +206 -0
- data/ext/pg_query/include/storage/large_object.h +100 -0
- data/ext/pg_query/include/storage/latch.h +190 -0
- data/ext/pg_query/include/storage/lmgr.h +114 -0
- data/ext/pg_query/include/storage/lock.h +612 -0
- data/ext/pg_query/include/storage/lockdefs.h +59 -0
- data/ext/pg_query/include/storage/lwlock.h +232 -0
- data/ext/pg_query/include/storage/lwlocknames.h +51 -0
- data/ext/pg_query/include/storage/off.h +57 -0
- data/ext/pg_query/include/storage/pg_sema.h +61 -0
- data/ext/pg_query/include/storage/pg_shmem.h +90 -0
- data/ext/pg_query/include/storage/pmsignal.h +94 -0
- data/ext/pg_query/include/storage/predicate.h +87 -0
- data/ext/pg_query/include/storage/proc.h +333 -0
- data/ext/pg_query/include/storage/proclist_types.h +51 -0
- data/ext/pg_query/include/storage/procsignal.h +75 -0
- data/ext/pg_query/include/storage/relfilenode.h +99 -0
- data/ext/pg_query/include/storage/s_lock.h +1047 -0
- data/ext/pg_query/include/storage/sharedfileset.h +45 -0
- data/ext/pg_query/include/storage/shm_mq.h +85 -0
- data/ext/pg_query/include/storage/shm_toc.h +58 -0
- data/ext/pg_query/include/storage/shmem.h +81 -0
- data/ext/pg_query/include/storage/sinval.h +153 -0
- data/ext/pg_query/include/storage/sinvaladt.h +43 -0
- data/ext/pg_query/include/storage/smgr.h +109 -0
- data/ext/pg_query/include/storage/spin.h +77 -0
- data/ext/pg_query/include/storage/standby.h +91 -0
- data/ext/pg_query/include/storage/standbydefs.h +74 -0
- data/ext/pg_query/include/storage/sync.h +62 -0
- data/ext/pg_query/include/tcop/cmdtag.h +58 -0
- data/ext/pg_query/include/tcop/cmdtaglist.h +217 -0
- data/ext/pg_query/include/tcop/deparse_utility.h +108 -0
- data/ext/pg_query/include/tcop/dest.h +149 -0
- data/ext/pg_query/include/tcop/fastpath.h +21 -0
- data/ext/pg_query/include/tcop/pquery.h +45 -0
- data/ext/pg_query/include/tcop/tcopprot.h +89 -0
- data/ext/pg_query/include/tcop/utility.h +108 -0
- data/ext/pg_query/include/tsearch/ts_cache.h +98 -0
- data/ext/pg_query/include/utils/acl.h +312 -0
- data/ext/pg_query/include/utils/aclchk_internal.h +45 -0
- data/ext/pg_query/include/utils/array.h +458 -0
- data/ext/pg_query/include/utils/builtins.h +127 -0
- data/ext/pg_query/include/utils/bytea.h +27 -0
- data/ext/pg_query/include/utils/catcache.h +231 -0
- data/ext/pg_query/include/utils/date.h +90 -0
- data/ext/pg_query/include/utils/datetime.h +343 -0
- data/ext/pg_query/include/utils/datum.h +68 -0
- data/ext/pg_query/include/utils/dsa.h +123 -0
- data/ext/pg_query/include/utils/dynahash.h +19 -0
- data/ext/pg_query/include/utils/elog.h +439 -0
- data/ext/pg_query/include/utils/errcodes.h +352 -0
- data/ext/pg_query/include/utils/expandeddatum.h +159 -0
- data/ext/pg_query/include/utils/expandedrecord.h +231 -0
- data/ext/pg_query/include/utils/float.h +356 -0
- data/ext/pg_query/include/utils/fmgroids.h +2657 -0
- data/ext/pg_query/include/utils/fmgrprotos.h +2646 -0
- data/ext/pg_query/include/utils/fmgrtab.h +48 -0
- data/ext/pg_query/include/utils/guc.h +443 -0
- data/ext/pg_query/include/utils/guc_tables.h +272 -0
- data/ext/pg_query/include/utils/hsearch.h +149 -0
- data/ext/pg_query/include/utils/inval.h +64 -0
- data/ext/pg_query/include/utils/lsyscache.h +197 -0
- data/ext/pg_query/include/utils/memdebug.h +82 -0
- data/ext/pg_query/include/utils/memutils.h +225 -0
- data/ext/pg_query/include/utils/numeric.h +76 -0
- data/ext/pg_query/include/utils/palloc.h +136 -0
- data/ext/pg_query/include/utils/partcache.h +102 -0
- data/ext/pg_query/include/utils/pg_locale.h +119 -0
- data/ext/pg_query/include/utils/pg_lsn.h +29 -0
- data/ext/pg_query/include/utils/pidfile.h +56 -0
- data/ext/pg_query/include/utils/plancache.h +235 -0
- data/ext/pg_query/include/utils/portal.h +241 -0
- data/ext/pg_query/include/utils/probes.h +114 -0
- data/ext/pg_query/include/utils/ps_status.h +25 -0
- data/ext/pg_query/include/utils/queryenvironment.h +74 -0
- data/ext/pg_query/include/utils/regproc.h +28 -0
- data/ext/pg_query/include/utils/rel.h +644 -0
- data/ext/pg_query/include/utils/relcache.h +151 -0
- data/ext/pg_query/include/utils/reltrigger.h +81 -0
- data/ext/pg_query/include/utils/resowner.h +86 -0
- data/ext/pg_query/include/utils/rls.h +50 -0
- data/ext/pg_query/include/utils/ruleutils.h +44 -0
- data/ext/pg_query/include/utils/sharedtuplestore.h +61 -0
- data/ext/pg_query/include/utils/snapmgr.h +158 -0
- data/ext/pg_query/include/utils/snapshot.h +206 -0
- data/ext/pg_query/include/utils/sortsupport.h +276 -0
- data/ext/pg_query/include/utils/syscache.h +219 -0
- data/ext/pg_query/include/utils/timeout.h +88 -0
- data/ext/pg_query/include/utils/timestamp.h +116 -0
- data/ext/pg_query/include/utils/tuplesort.h +277 -0
- data/ext/pg_query/include/utils/tuplestore.h +91 -0
- data/ext/pg_query/include/utils/typcache.h +202 -0
- data/ext/pg_query/include/utils/tzparser.h +39 -0
- data/ext/pg_query/include/utils/varlena.h +39 -0
- data/ext/pg_query/include/utils/xml.h +84 -0
- data/ext/pg_query/include/xxhash.h +5445 -0
- data/ext/pg_query/include/xxhash/xxhash.h +5445 -0
- data/ext/pg_query/pg_query.c +104 -0
- data/ext/pg_query/pg_query.pb-c.c +37628 -0
- data/ext/pg_query/pg_query_deparse.c +9959 -0
- data/ext/pg_query/pg_query_fingerprint.c +295 -0
- data/ext/pg_query/pg_query_fingerprint.h +8 -0
- data/ext/pg_query/pg_query_internal.h +24 -0
- data/ext/pg_query/pg_query_json_plpgsql.c +738 -0
- data/ext/pg_query/pg_query_json_plpgsql.h +9 -0
- data/ext/pg_query/pg_query_normalize.c +439 -0
- data/ext/pg_query/pg_query_outfuncs.h +10 -0
- data/ext/pg_query/pg_query_outfuncs_json.c +297 -0
- data/ext/pg_query/pg_query_outfuncs_protobuf.c +237 -0
- data/ext/pg_query/pg_query_parse.c +148 -0
- data/ext/pg_query/pg_query_parse_plpgsql.c +460 -0
- data/ext/pg_query/pg_query_readfuncs.h +11 -0
- data/ext/pg_query/pg_query_readfuncs_protobuf.c +142 -0
- data/ext/pg_query/pg_query_ruby.c +108 -12
- data/ext/pg_query/pg_query_scan.c +173 -0
- data/ext/pg_query/pg_query_split.c +221 -0
- data/ext/pg_query/protobuf-c.c +3660 -0
- data/ext/pg_query/src_backend_catalog_namespace.c +1051 -0
- data/ext/pg_query/src_backend_catalog_pg_proc.c +142 -0
- data/ext/pg_query/src_backend_commands_define.c +117 -0
- data/ext/pg_query/src_backend_libpq_pqcomm.c +651 -0
- data/ext/pg_query/src_backend_nodes_bitmapset.c +513 -0
- data/ext/pg_query/src_backend_nodes_copyfuncs.c +6013 -0
- data/ext/pg_query/src_backend_nodes_equalfuncs.c +4003 -0
- data/ext/pg_query/src_backend_nodes_extensible.c +99 -0
- data/ext/pg_query/src_backend_nodes_list.c +922 -0
- data/ext/pg_query/src_backend_nodes_makefuncs.c +417 -0
- data/ext/pg_query/src_backend_nodes_nodeFuncs.c +1363 -0
- data/ext/pg_query/src_backend_nodes_value.c +84 -0
- data/ext/pg_query/src_backend_parser_gram.c +47456 -0
- data/ext/pg_query/src_backend_parser_parse_expr.c +313 -0
- data/ext/pg_query/src_backend_parser_parser.c +497 -0
- data/ext/pg_query/src_backend_parser_scan.c +7091 -0
- data/ext/pg_query/src_backend_parser_scansup.c +160 -0
- data/ext/pg_query/src_backend_postmaster_postmaster.c +2230 -0
- data/ext/pg_query/src_backend_storage_ipc_ipc.c +192 -0
- data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +370 -0
- data/ext/pg_query/src_backend_tcop_postgres.c +776 -0
- data/ext/pg_query/src_backend_utils_adt_datum.c +326 -0
- data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +98 -0
- data/ext/pg_query/src_backend_utils_adt_format_type.c +136 -0
- data/ext/pg_query/src_backend_utils_adt_ruleutils.c +1683 -0
- data/ext/pg_query/src_backend_utils_error_assert.c +74 -0
- data/ext/pg_query/src_backend_utils_error_elog.c +1748 -0
- data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +570 -0
- data/ext/pg_query/src_backend_utils_hash_dynahash.c +1086 -0
- data/ext/pg_query/src_backend_utils_init_globals.c +168 -0
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +839 -0
- data/ext/pg_query/src_backend_utils_misc_guc.c +1831 -0
- data/ext/pg_query/src_backend_utils_mmgr_aset.c +1560 -0
- data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +1006 -0
- data/ext/pg_query/src_common_encnames.c +158 -0
- data/ext/pg_query/src_common_keywords.c +39 -0
- data/ext/pg_query/src_common_kwlist_d.h +1081 -0
- data/ext/pg_query/src_common_kwlookup.c +91 -0
- data/ext/pg_query/src_common_psprintf.c +158 -0
- data/ext/pg_query/src_common_string.c +86 -0
- data/ext/pg_query/src_common_stringinfo.c +336 -0
- data/ext/pg_query/src_common_wchar.c +1651 -0
- data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +1133 -0
- data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +877 -0
- data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +6533 -0
- data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +107 -0
- data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +123 -0
- data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +671 -0
- data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +255 -0
- data/ext/pg_query/src_port_erand48.c +127 -0
- data/ext/pg_query/src_port_pg_bitutils.c +246 -0
- data/ext/pg_query/src_port_pgsleep.c +69 -0
- data/ext/pg_query/src_port_pgstrcasecmp.c +83 -0
- data/ext/pg_query/src_port_qsort.c +240 -0
- data/ext/pg_query/src_port_random.c +31 -0
- data/ext/pg_query/src_port_snprintf.c +1449 -0
- data/ext/pg_query/src_port_strerror.c +324 -0
- data/ext/pg_query/src_port_strnlen.c +39 -0
- data/ext/pg_query/xxhash.c +43 -0
- data/lib/pg_query.rb +7 -4
- data/lib/pg_query/constants.rb +21 -0
- data/lib/pg_query/deparse.rb +15 -1581
- data/lib/pg_query/filter_columns.rb +88 -85
- data/lib/pg_query/fingerprint.rb +122 -87
- data/lib/pg_query/json_field_names.rb +1402 -0
- data/lib/pg_query/node.rb +31 -0
- data/lib/pg_query/param_refs.rb +42 -37
- data/lib/pg_query/parse.rb +220 -203
- data/lib/pg_query/parse_error.rb +1 -1
- data/lib/pg_query/pg_query_pb.rb +3211 -0
- data/lib/pg_query/scan.rb +23 -0
- data/lib/pg_query/treewalker.rb +24 -40
- data/lib/pg_query/truncate.rb +71 -42
- data/lib/pg_query/version.rb +2 -2
- metadata +472 -11
- data/ext/pg_query/pg_query_ruby.h +0 -10
- data/lib/pg_query/deep_dup.rb +0 -16
- data/lib/pg_query/deparse/alter_table.rb +0 -42
- data/lib/pg_query/deparse/interval.rb +0 -105
- data/lib/pg_query/deparse/keywords.rb +0 -159
- data/lib/pg_query/deparse/rename.rb +0 -41
- data/lib/pg_query/legacy_parsetree.rb +0 -109
- data/lib/pg_query/node_types.rb +0 -296
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*-------------------------------------------------------------------------
|
|
2
|
+
*
|
|
3
|
+
* pg_shmem.h
|
|
4
|
+
* Platform-independent API for shared memory support.
|
|
5
|
+
*
|
|
6
|
+
* Every port is expected to support shared memory with approximately
|
|
7
|
+
* SysV-ish semantics; in particular, a memory block is not anonymous
|
|
8
|
+
* but has an ID, and we must be able to tell whether there are any
|
|
9
|
+
* remaining processes attached to a block of a specified ID.
|
|
10
|
+
*
|
|
11
|
+
* To simplify life for the SysV implementation, the ID is assumed to
|
|
12
|
+
* consist of two unsigned long values (these are key and ID in SysV
|
|
13
|
+
* terms). Other platforms may ignore the second value if they need
|
|
14
|
+
* only one ID number.
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
|
18
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
|
19
|
+
*
|
|
20
|
+
* src/include/storage/pg_shmem.h
|
|
21
|
+
*
|
|
22
|
+
*-------------------------------------------------------------------------
|
|
23
|
+
*/
|
|
24
|
+
#ifndef PG_SHMEM_H
|
|
25
|
+
#define PG_SHMEM_H
|
|
26
|
+
|
|
27
|
+
#include "storage/dsm_impl.h"
|
|
28
|
+
|
|
29
|
+
typedef struct PGShmemHeader /* standard header for all Postgres shmem */
|
|
30
|
+
{
|
|
31
|
+
int32 magic; /* magic # to identify Postgres segments */
|
|
32
|
+
#define PGShmemMagic 679834894
|
|
33
|
+
pid_t creatorPID; /* PID of creating process (set but unread) */
|
|
34
|
+
Size totalsize; /* total size of segment */
|
|
35
|
+
Size freeoffset; /* offset to first free space */
|
|
36
|
+
dsm_handle dsm_control; /* ID of dynamic shared memory control seg */
|
|
37
|
+
void *index; /* pointer to ShmemIndex table */
|
|
38
|
+
#ifndef WIN32 /* Windows doesn't have useful inode#s */
|
|
39
|
+
dev_t device; /* device data directory is on */
|
|
40
|
+
ino_t inode; /* inode number of data directory */
|
|
41
|
+
#endif
|
|
42
|
+
} PGShmemHeader;
|
|
43
|
+
|
|
44
|
+
/* GUC variables */
|
|
45
|
+
extern int shared_memory_type;
|
|
46
|
+
extern int huge_pages;
|
|
47
|
+
|
|
48
|
+
/* Possible values for huge_pages */
|
|
49
|
+
typedef enum
|
|
50
|
+
{
|
|
51
|
+
HUGE_PAGES_OFF,
|
|
52
|
+
HUGE_PAGES_ON,
|
|
53
|
+
HUGE_PAGES_TRY
|
|
54
|
+
} HugePagesType;
|
|
55
|
+
|
|
56
|
+
/* Possible values for shared_memory_type */
|
|
57
|
+
typedef enum
|
|
58
|
+
{
|
|
59
|
+
SHMEM_TYPE_WINDOWS,
|
|
60
|
+
SHMEM_TYPE_SYSV,
|
|
61
|
+
SHMEM_TYPE_MMAP
|
|
62
|
+
} PGShmemType;
|
|
63
|
+
|
|
64
|
+
#ifndef WIN32
|
|
65
|
+
extern unsigned long UsedShmemSegID;
|
|
66
|
+
#else
|
|
67
|
+
extern HANDLE UsedShmemSegID;
|
|
68
|
+
extern void *ShmemProtectiveRegion;
|
|
69
|
+
#endif
|
|
70
|
+
extern void *UsedShmemSegAddr;
|
|
71
|
+
|
|
72
|
+
#if !defined(WIN32) && !defined(EXEC_BACKEND)
|
|
73
|
+
#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_MMAP
|
|
74
|
+
#elif !defined(WIN32)
|
|
75
|
+
#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV
|
|
76
|
+
#else
|
|
77
|
+
#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_WINDOWS
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
#ifdef EXEC_BACKEND
|
|
81
|
+
extern void PGSharedMemoryReAttach(void);
|
|
82
|
+
extern void PGSharedMemoryNoReAttach(void);
|
|
83
|
+
#endif
|
|
84
|
+
|
|
85
|
+
extern PGShmemHeader *PGSharedMemoryCreate(Size size,
|
|
86
|
+
PGShmemHeader **shim);
|
|
87
|
+
extern bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2);
|
|
88
|
+
extern void PGSharedMemoryDetach(void);
|
|
89
|
+
|
|
90
|
+
#endif /* PG_SHMEM_H */
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*-------------------------------------------------------------------------
|
|
2
|
+
*
|
|
3
|
+
* pmsignal.h
|
|
4
|
+
* routines for signaling the postmaster from its child processes
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
|
8
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
|
9
|
+
*
|
|
10
|
+
* src/include/storage/pmsignal.h
|
|
11
|
+
*
|
|
12
|
+
*-------------------------------------------------------------------------
|
|
13
|
+
*/
|
|
14
|
+
#ifndef PMSIGNAL_H
|
|
15
|
+
#define PMSIGNAL_H
|
|
16
|
+
|
|
17
|
+
#include <signal.h>
|
|
18
|
+
|
|
19
|
+
#ifdef HAVE_SYS_PRCTL_H
|
|
20
|
+
#include "sys/prctl.h"
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
#ifdef HAVE_SYS_PROCCTL_H
|
|
24
|
+
#include "sys/procctl.h"
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* Reasons for signaling the postmaster. We can cope with simultaneous
|
|
29
|
+
* signals for different reasons. If the same reason is signaled multiple
|
|
30
|
+
* times in quick succession, however, the postmaster is likely to observe
|
|
31
|
+
* only one notification of it. This is okay for the present uses.
|
|
32
|
+
*/
|
|
33
|
+
typedef enum
|
|
34
|
+
{
|
|
35
|
+
PMSIGNAL_RECOVERY_STARTED, /* recovery has started */
|
|
36
|
+
PMSIGNAL_BEGIN_HOT_STANDBY, /* begin Hot Standby */
|
|
37
|
+
PMSIGNAL_WAKEN_ARCHIVER, /* send a NOTIFY signal to xlog archiver */
|
|
38
|
+
PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */
|
|
39
|
+
PMSIGNAL_START_AUTOVAC_LAUNCHER, /* start an autovacuum launcher */
|
|
40
|
+
PMSIGNAL_START_AUTOVAC_WORKER, /* start an autovacuum worker */
|
|
41
|
+
PMSIGNAL_BACKGROUND_WORKER_CHANGE, /* background worker state change */
|
|
42
|
+
PMSIGNAL_START_WALRECEIVER, /* start a walreceiver */
|
|
43
|
+
PMSIGNAL_ADVANCE_STATE_MACHINE, /* advance postmaster's state machine */
|
|
44
|
+
|
|
45
|
+
NUM_PMSIGNALS /* Must be last value of enum! */
|
|
46
|
+
} PMSignalReason;
|
|
47
|
+
|
|
48
|
+
/* PMSignalData is an opaque struct, details known only within pmsignal.c */
|
|
49
|
+
typedef struct PMSignalData PMSignalData;
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
* prototypes for functions in pmsignal.c
|
|
53
|
+
*/
|
|
54
|
+
extern Size PMSignalShmemSize(void);
|
|
55
|
+
extern void PMSignalShmemInit(void);
|
|
56
|
+
extern void SendPostmasterSignal(PMSignalReason reason);
|
|
57
|
+
extern bool CheckPostmasterSignal(PMSignalReason reason);
|
|
58
|
+
extern int AssignPostmasterChildSlot(void);
|
|
59
|
+
extern bool ReleasePostmasterChildSlot(int slot);
|
|
60
|
+
extern bool IsPostmasterChildWalSender(int slot);
|
|
61
|
+
extern void MarkPostmasterChildActive(void);
|
|
62
|
+
extern void MarkPostmasterChildInactive(void);
|
|
63
|
+
extern void MarkPostmasterChildWalSender(void);
|
|
64
|
+
extern bool PostmasterIsAliveInternal(void);
|
|
65
|
+
extern void PostmasterDeathSignalInit(void);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* Do we have a way to ask for a signal on parent death?
|
|
70
|
+
*
|
|
71
|
+
* If we do, pmsignal.c will set up a signal handler, that sets a flag when
|
|
72
|
+
* the parent dies. Checking the flag first makes PostmasterIsAlive() a lot
|
|
73
|
+
* cheaper in usual case that the postmaster is alive.
|
|
74
|
+
*/
|
|
75
|
+
#if (defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_PDEATHSIG)) || \
|
|
76
|
+
(defined(HAVE_SYS_PROCCTL_H) && defined(PROC_PDEATHSIG_CTL))
|
|
77
|
+
#define USE_POSTMASTER_DEATH_SIGNAL
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
#ifdef USE_POSTMASTER_DEATH_SIGNAL
|
|
81
|
+
extern volatile sig_atomic_t postmaster_possibly_dead;
|
|
82
|
+
|
|
83
|
+
static inline bool
|
|
84
|
+
PostmasterIsAlive(void)
|
|
85
|
+
{
|
|
86
|
+
if (likely(!postmaster_possibly_dead))
|
|
87
|
+
return true;
|
|
88
|
+
return PostmasterIsAliveInternal();
|
|
89
|
+
}
|
|
90
|
+
#else
|
|
91
|
+
#define PostmasterIsAlive() PostmasterIsAliveInternal()
|
|
92
|
+
#endif
|
|
93
|
+
|
|
94
|
+
#endif /* PMSIGNAL_H */
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*-------------------------------------------------------------------------
|
|
2
|
+
*
|
|
3
|
+
* predicate.h
|
|
4
|
+
* POSTGRES public predicate locking definitions.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
|
8
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
|
9
|
+
*
|
|
10
|
+
* src/include/storage/predicate.h
|
|
11
|
+
*
|
|
12
|
+
*-------------------------------------------------------------------------
|
|
13
|
+
*/
|
|
14
|
+
#ifndef PREDICATE_H
|
|
15
|
+
#define PREDICATE_H
|
|
16
|
+
|
|
17
|
+
#include "storage/lock.h"
|
|
18
|
+
#include "utils/relcache.h"
|
|
19
|
+
#include "utils/snapshot.h"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* GUC variables
|
|
24
|
+
*/
|
|
25
|
+
extern int max_predicate_locks_per_xact;
|
|
26
|
+
extern int max_predicate_locks_per_relation;
|
|
27
|
+
extern int max_predicate_locks_per_page;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/* Number of SLRU buffers to use for Serial SLRU */
|
|
31
|
+
#define NUM_SERIAL_BUFFERS 16
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* A handle used for sharing SERIALIZABLEXACT objects between the participants
|
|
35
|
+
* in a parallel query.
|
|
36
|
+
*/
|
|
37
|
+
typedef void *SerializableXactHandle;
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* function prototypes
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/* housekeeping for shared memory predicate lock structures */
|
|
44
|
+
extern void InitPredicateLocks(void);
|
|
45
|
+
extern Size PredicateLockShmemSize(void);
|
|
46
|
+
|
|
47
|
+
extern void CheckPointPredicate(void);
|
|
48
|
+
|
|
49
|
+
/* predicate lock reporting */
|
|
50
|
+
extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno);
|
|
51
|
+
|
|
52
|
+
/* predicate lock maintenance */
|
|
53
|
+
extern Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot);
|
|
54
|
+
extern void SetSerializableTransactionSnapshot(Snapshot snapshot,
|
|
55
|
+
VirtualTransactionId *sourcevxid,
|
|
56
|
+
int sourcepid);
|
|
57
|
+
extern void RegisterPredicateLockingXid(TransactionId xid);
|
|
58
|
+
extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
|
|
59
|
+
extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
|
|
60
|
+
extern void PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot,
|
|
61
|
+
TransactionId insert_xid);
|
|
62
|
+
extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
|
|
63
|
+
extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
|
|
64
|
+
extern void TransferPredicateLocksToHeapRelation(Relation relation);
|
|
65
|
+
extern void ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe);
|
|
66
|
+
|
|
67
|
+
/* conflict detection (may also trigger rollback) */
|
|
68
|
+
extern bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot);
|
|
69
|
+
extern void CheckForSerializableConflictOut(Relation relation, TransactionId xid, Snapshot snapshot);
|
|
70
|
+
extern void CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno);
|
|
71
|
+
extern void CheckTableForSerializableConflictIn(Relation relation);
|
|
72
|
+
|
|
73
|
+
/* final rollback checking */
|
|
74
|
+
extern void PreCommit_CheckForSerializationFailure(void);
|
|
75
|
+
|
|
76
|
+
/* two-phase commit support */
|
|
77
|
+
extern void AtPrepare_PredicateLocks(void);
|
|
78
|
+
extern void PostPrepare_PredicateLocks(TransactionId xid);
|
|
79
|
+
extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
|
|
80
|
+
extern void predicatelock_twophase_recover(TransactionId xid, uint16 info,
|
|
81
|
+
void *recdata, uint32 len);
|
|
82
|
+
|
|
83
|
+
/* parallel query support */
|
|
84
|
+
extern SerializableXactHandle ShareSerializableXact(void);
|
|
85
|
+
extern void AttachSerializableXact(SerializableXactHandle handle);
|
|
86
|
+
|
|
87
|
+
#endif /* PREDICATE_H */
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/*-------------------------------------------------------------------------
|
|
2
|
+
*
|
|
3
|
+
* proc.h
|
|
4
|
+
* per-process shared memory data structures
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
|
8
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
|
9
|
+
*
|
|
10
|
+
* src/include/storage/proc.h
|
|
11
|
+
*
|
|
12
|
+
*-------------------------------------------------------------------------
|
|
13
|
+
*/
|
|
14
|
+
#ifndef _PROC_H_
|
|
15
|
+
#define _PROC_H_
|
|
16
|
+
|
|
17
|
+
#include "access/clog.h"
|
|
18
|
+
#include "access/xlogdefs.h"
|
|
19
|
+
#include "lib/ilist.h"
|
|
20
|
+
#include "storage/latch.h"
|
|
21
|
+
#include "storage/lock.h"
|
|
22
|
+
#include "storage/pg_sema.h"
|
|
23
|
+
#include "storage/proclist_types.h"
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Each backend advertises up to PGPROC_MAX_CACHED_SUBXIDS TransactionIds
|
|
27
|
+
* for non-aborted subtransactions of its current top transaction. These
|
|
28
|
+
* have to be treated as running XIDs by other backends.
|
|
29
|
+
*
|
|
30
|
+
* We also keep track of whether the cache overflowed (ie, the transaction has
|
|
31
|
+
* generated at least one subtransaction that didn't fit in the cache).
|
|
32
|
+
* If none of the caches have overflowed, we can assume that an XID that's not
|
|
33
|
+
* listed anywhere in the PGPROC array is not a running transaction. Else we
|
|
34
|
+
* have to look at pg_subtrans.
|
|
35
|
+
*/
|
|
36
|
+
#define PGPROC_MAX_CACHED_SUBXIDS 64 /* XXX guessed-at value */
|
|
37
|
+
|
|
38
|
+
struct XidCache
|
|
39
|
+
{
|
|
40
|
+
TransactionId xids[PGPROC_MAX_CACHED_SUBXIDS];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* Flags for PGXACT->vacuumFlags
|
|
45
|
+
*
|
|
46
|
+
* Note: If you modify these flags, you need to modify PROCARRAY_XXX flags
|
|
47
|
+
* in src/include/storage/procarray.h.
|
|
48
|
+
*
|
|
49
|
+
* PROC_RESERVED may later be assigned for use in vacuumFlags, but its value is
|
|
50
|
+
* used for PROCARRAY_SLOTS_XMIN in procarray.h, so GetOldestXmin won't be able
|
|
51
|
+
* to match and ignore processes with this flag set.
|
|
52
|
+
*/
|
|
53
|
+
#define PROC_IS_AUTOVACUUM 0x01 /* is it an autovac worker? */
|
|
54
|
+
#define PROC_IN_VACUUM 0x02 /* currently running lazy vacuum */
|
|
55
|
+
#define PROC_IN_ANALYZE 0x04 /* currently running analyze */
|
|
56
|
+
#define PROC_VACUUM_FOR_WRAPAROUND 0x08 /* set by autovac only */
|
|
57
|
+
#define PROC_IN_LOGICAL_DECODING 0x10 /* currently doing logical
|
|
58
|
+
* decoding outside xact */
|
|
59
|
+
#define PROC_RESERVED 0x20 /* reserved for procarray */
|
|
60
|
+
|
|
61
|
+
/* flags reset at EOXact */
|
|
62
|
+
#define PROC_VACUUM_STATE_MASK \
|
|
63
|
+
(PROC_IN_VACUUM | PROC_IN_ANALYZE | PROC_VACUUM_FOR_WRAPAROUND)
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* We allow a small number of "weak" relation locks (AccessShareLock,
|
|
67
|
+
* RowShareLock, RowExclusiveLock) to be recorded in the PGPROC structure
|
|
68
|
+
* rather than the main lock table. This eases contention on the lock
|
|
69
|
+
* manager LWLocks. See storage/lmgr/README for additional details.
|
|
70
|
+
*/
|
|
71
|
+
#define FP_LOCK_SLOTS_PER_BACKEND 16
|
|
72
|
+
|
|
73
|
+
/*
|
|
74
|
+
* An invalid pgprocno. Must be larger than the maximum number of PGPROC
|
|
75
|
+
* structures we could possibly have. See comments for MAX_BACKENDS.
|
|
76
|
+
*/
|
|
77
|
+
#define INVALID_PGPROCNO PG_INT32_MAX
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* Each backend has a PGPROC struct in shared memory. There is also a list of
|
|
81
|
+
* currently-unused PGPROC structs that will be reallocated to new backends.
|
|
82
|
+
*
|
|
83
|
+
* links: list link for any list the PGPROC is in. When waiting for a lock,
|
|
84
|
+
* the PGPROC is linked into that lock's waitProcs queue. A recycled PGPROC
|
|
85
|
+
* is linked into ProcGlobal's freeProcs list.
|
|
86
|
+
*
|
|
87
|
+
* Note: twophase.c also sets up a dummy PGPROC struct for each currently
|
|
88
|
+
* prepared transaction. These PGPROCs appear in the ProcArray data structure
|
|
89
|
+
* so that the prepared transactions appear to be still running and are
|
|
90
|
+
* correctly shown as holding locks. A prepared transaction PGPROC can be
|
|
91
|
+
* distinguished from a real one at need by the fact that it has pid == 0.
|
|
92
|
+
* The semaphore and lock-activity fields in a prepared-xact PGPROC are unused,
|
|
93
|
+
* but its myProcLocks[] lists are valid.
|
|
94
|
+
*/
|
|
95
|
+
struct PGPROC
|
|
96
|
+
{
|
|
97
|
+
/* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */
|
|
98
|
+
SHM_QUEUE links; /* list link if process is in a list */
|
|
99
|
+
PGPROC **procgloballist; /* procglobal list that owns this PGPROC */
|
|
100
|
+
|
|
101
|
+
PGSemaphore sem; /* ONE semaphore to sleep on */
|
|
102
|
+
int waitStatus; /* STATUS_WAITING, STATUS_OK or STATUS_ERROR */
|
|
103
|
+
|
|
104
|
+
Latch procLatch; /* generic latch for process */
|
|
105
|
+
|
|
106
|
+
LocalTransactionId lxid; /* local id of top-level transaction currently
|
|
107
|
+
* being executed by this proc, if running;
|
|
108
|
+
* else InvalidLocalTransactionId */
|
|
109
|
+
int pid; /* Backend's process ID; 0 if prepared xact */
|
|
110
|
+
int pgprocno;
|
|
111
|
+
|
|
112
|
+
/* These fields are zero while a backend is still starting up: */
|
|
113
|
+
BackendId backendId; /* This backend's backend ID (if assigned) */
|
|
114
|
+
Oid databaseId; /* OID of database this backend is using */
|
|
115
|
+
Oid roleId; /* OID of role using this backend */
|
|
116
|
+
|
|
117
|
+
Oid tempNamespaceId; /* OID of temp schema this backend is
|
|
118
|
+
* using */
|
|
119
|
+
|
|
120
|
+
bool isBackgroundWorker; /* true if background worker. */
|
|
121
|
+
|
|
122
|
+
/*
|
|
123
|
+
* While in hot standby mode, shows that a conflict signal has been sent
|
|
124
|
+
* for the current transaction. Set/cleared while holding ProcArrayLock,
|
|
125
|
+
* though not required. Accessed without lock, if needed.
|
|
126
|
+
*/
|
|
127
|
+
bool recoveryConflictPending;
|
|
128
|
+
|
|
129
|
+
/* Info about LWLock the process is currently waiting for, if any. */
|
|
130
|
+
bool lwWaiting; /* true if waiting for an LW lock */
|
|
131
|
+
uint8 lwWaitMode; /* lwlock mode being waited for */
|
|
132
|
+
proclist_node lwWaitLink; /* position in LW lock wait list */
|
|
133
|
+
|
|
134
|
+
/* Support for condition variables. */
|
|
135
|
+
proclist_node cvWaitLink; /* position in CV wait list */
|
|
136
|
+
|
|
137
|
+
/* Info about lock the process is currently waiting for, if any. */
|
|
138
|
+
/* waitLock and waitProcLock are NULL if not currently waiting. */
|
|
139
|
+
LOCK *waitLock; /* Lock object we're sleeping on ... */
|
|
140
|
+
PROCLOCK *waitProcLock; /* Per-holder info for awaited lock */
|
|
141
|
+
LOCKMODE waitLockMode; /* type of lock we're waiting for */
|
|
142
|
+
LOCKMASK heldLocks; /* bitmask for lock types already held on this
|
|
143
|
+
* lock object by this backend */
|
|
144
|
+
|
|
145
|
+
bool delayChkpt; /* true if this proc delays checkpoint start */
|
|
146
|
+
|
|
147
|
+
/*
|
|
148
|
+
* Info to allow us to wait for synchronous replication, if needed.
|
|
149
|
+
* waitLSN is InvalidXLogRecPtr if not waiting; set only by user backend.
|
|
150
|
+
* syncRepState must not be touched except by owning process or WALSender.
|
|
151
|
+
* syncRepLinks used only while holding SyncRepLock.
|
|
152
|
+
*/
|
|
153
|
+
XLogRecPtr waitLSN; /* waiting for this LSN or higher */
|
|
154
|
+
int syncRepState; /* wait state for sync rep */
|
|
155
|
+
SHM_QUEUE syncRepLinks; /* list link if process is in syncrep queue */
|
|
156
|
+
|
|
157
|
+
/*
|
|
158
|
+
* All PROCLOCK objects for locks held or awaited by this backend are
|
|
159
|
+
* linked into one of these lists, according to the partition number of
|
|
160
|
+
* their lock.
|
|
161
|
+
*/
|
|
162
|
+
SHM_QUEUE myProcLocks[NUM_LOCK_PARTITIONS];
|
|
163
|
+
|
|
164
|
+
struct XidCache subxids; /* cache for subtransaction XIDs */
|
|
165
|
+
|
|
166
|
+
/* Support for group XID clearing. */
|
|
167
|
+
/* true, if member of ProcArray group waiting for XID clear */
|
|
168
|
+
bool procArrayGroupMember;
|
|
169
|
+
/* next ProcArray group member waiting for XID clear */
|
|
170
|
+
pg_atomic_uint32 procArrayGroupNext;
|
|
171
|
+
|
|
172
|
+
/*
|
|
173
|
+
* latest transaction id among the transaction's main XID and
|
|
174
|
+
* subtransactions
|
|
175
|
+
*/
|
|
176
|
+
TransactionId procArrayGroupMemberXid;
|
|
177
|
+
|
|
178
|
+
uint32 wait_event_info; /* proc's wait information */
|
|
179
|
+
|
|
180
|
+
/* Support for group transaction status update. */
|
|
181
|
+
bool clogGroupMember; /* true, if member of clog group */
|
|
182
|
+
pg_atomic_uint32 clogGroupNext; /* next clog group member */
|
|
183
|
+
TransactionId clogGroupMemberXid; /* transaction id of clog group member */
|
|
184
|
+
XidStatus clogGroupMemberXidStatus; /* transaction status of clog
|
|
185
|
+
* group member */
|
|
186
|
+
int clogGroupMemberPage; /* clog page corresponding to
|
|
187
|
+
* transaction id of clog group member */
|
|
188
|
+
XLogRecPtr clogGroupMemberLsn; /* WAL location of commit record for clog
|
|
189
|
+
* group member */
|
|
190
|
+
|
|
191
|
+
/* Lock manager data, recording fast-path locks taken by this backend. */
|
|
192
|
+
LWLock fpInfoLock; /* protects per-backend fast-path state */
|
|
193
|
+
uint64 fpLockBits; /* lock modes held for each fast-path slot */
|
|
194
|
+
Oid fpRelId[FP_LOCK_SLOTS_PER_BACKEND]; /* slots for rel oids */
|
|
195
|
+
bool fpVXIDLock; /* are we holding a fast-path VXID lock? */
|
|
196
|
+
LocalTransactionId fpLocalTransactionId; /* lxid for fast-path VXID
|
|
197
|
+
* lock */
|
|
198
|
+
|
|
199
|
+
/*
|
|
200
|
+
* Support for lock groups. Use LockHashPartitionLockByProc on the group
|
|
201
|
+
* leader to get the LWLock protecting these fields.
|
|
202
|
+
*/
|
|
203
|
+
PGPROC *lockGroupLeader; /* lock group leader, if I'm a member */
|
|
204
|
+
dlist_head lockGroupMembers; /* list of members, if I'm a leader */
|
|
205
|
+
dlist_node lockGroupLink; /* my member link, if I'm a member */
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/* NOTE: "typedef struct PGPROC PGPROC" appears in storage/lock.h. */
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
extern PGDLLIMPORT PGPROC *MyProc;
|
|
212
|
+
extern PGDLLIMPORT struct PGXACT *MyPgXact;
|
|
213
|
+
|
|
214
|
+
/*
|
|
215
|
+
* Prior to PostgreSQL 9.2, the fields below were stored as part of the
|
|
216
|
+
* PGPROC. However, benchmarking revealed that packing these particular
|
|
217
|
+
* members into a separate array as tightly as possible sped up GetSnapshotData
|
|
218
|
+
* considerably on systems with many CPU cores, by reducing the number of
|
|
219
|
+
* cache lines needing to be fetched. Thus, think very carefully before adding
|
|
220
|
+
* anything else here.
|
|
221
|
+
*/
|
|
222
|
+
typedef struct PGXACT
|
|
223
|
+
{
|
|
224
|
+
TransactionId xid; /* id of top-level transaction currently being
|
|
225
|
+
* executed by this proc, if running and XID
|
|
226
|
+
* is assigned; else InvalidTransactionId */
|
|
227
|
+
|
|
228
|
+
TransactionId xmin; /* minimal running XID as it was when we were
|
|
229
|
+
* starting our xact, excluding LAZY VACUUM:
|
|
230
|
+
* vacuum must not remove tuples deleted by
|
|
231
|
+
* xid >= xmin ! */
|
|
232
|
+
|
|
233
|
+
uint8 vacuumFlags; /* vacuum-related flags, see above */
|
|
234
|
+
bool overflowed;
|
|
235
|
+
|
|
236
|
+
uint8 nxids;
|
|
237
|
+
} PGXACT;
|
|
238
|
+
|
|
239
|
+
/*
|
|
240
|
+
* There is one ProcGlobal struct for the whole database cluster.
|
|
241
|
+
*/
|
|
242
|
+
typedef struct PROC_HDR
|
|
243
|
+
{
|
|
244
|
+
/* Array of PGPROC structures (not including dummies for prepared txns) */
|
|
245
|
+
PGPROC *allProcs;
|
|
246
|
+
/* Array of PGXACT structures (not including dummies for prepared txns) */
|
|
247
|
+
PGXACT *allPgXact;
|
|
248
|
+
/* Length of allProcs array */
|
|
249
|
+
uint32 allProcCount;
|
|
250
|
+
/* Head of list of free PGPROC structures */
|
|
251
|
+
PGPROC *freeProcs;
|
|
252
|
+
/* Head of list of autovacuum's free PGPROC structures */
|
|
253
|
+
PGPROC *autovacFreeProcs;
|
|
254
|
+
/* Head of list of bgworker free PGPROC structures */
|
|
255
|
+
PGPROC *bgworkerFreeProcs;
|
|
256
|
+
/* Head of list of walsender free PGPROC structures */
|
|
257
|
+
PGPROC *walsenderFreeProcs;
|
|
258
|
+
/* First pgproc waiting for group XID clear */
|
|
259
|
+
pg_atomic_uint32 procArrayGroupFirst;
|
|
260
|
+
/* First pgproc waiting for group transaction status update */
|
|
261
|
+
pg_atomic_uint32 clogGroupFirst;
|
|
262
|
+
/* WALWriter process's latch */
|
|
263
|
+
Latch *walwriterLatch;
|
|
264
|
+
/* Checkpointer process's latch */
|
|
265
|
+
Latch *checkpointerLatch;
|
|
266
|
+
/* Current shared estimate of appropriate spins_per_delay value */
|
|
267
|
+
int spins_per_delay;
|
|
268
|
+
/* The proc of the Startup process, since not in ProcArray */
|
|
269
|
+
PGPROC *startupProc;
|
|
270
|
+
int startupProcPid;
|
|
271
|
+
/* Buffer id of the buffer that Startup process waits for pin on, or -1 */
|
|
272
|
+
int startupBufferPinWaitBufId;
|
|
273
|
+
} PROC_HDR;
|
|
274
|
+
|
|
275
|
+
extern PGDLLIMPORT PROC_HDR *ProcGlobal;
|
|
276
|
+
|
|
277
|
+
extern PGPROC *PreparedXactProcs;
|
|
278
|
+
|
|
279
|
+
/* Accessor for PGPROC given a pgprocno. */
|
|
280
|
+
#define GetPGProcByNumber(n) (&ProcGlobal->allProcs[(n)])
|
|
281
|
+
|
|
282
|
+
/*
|
|
283
|
+
* We set aside some extra PGPROC structures for auxiliary processes,
|
|
284
|
+
* ie things that aren't full-fledged backends but need shmem access.
|
|
285
|
+
*
|
|
286
|
+
* Background writer, checkpointer and WAL writer run during normal operation.
|
|
287
|
+
* Startup process and WAL receiver also consume 2 slots, but WAL writer is
|
|
288
|
+
* launched only after startup has exited, so we only need 4 slots.
|
|
289
|
+
*/
|
|
290
|
+
#define NUM_AUXILIARY_PROCS 4
|
|
291
|
+
|
|
292
|
+
/* configurable options */
|
|
293
|
+
extern PGDLLIMPORT int DeadlockTimeout;
|
|
294
|
+
extern PGDLLIMPORT int StatementTimeout;
|
|
295
|
+
extern PGDLLIMPORT int LockTimeout;
|
|
296
|
+
extern PGDLLIMPORT int IdleInTransactionSessionTimeout;
|
|
297
|
+
extern bool log_lock_waits;
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
/*
|
|
301
|
+
* Function Prototypes
|
|
302
|
+
*/
|
|
303
|
+
extern int ProcGlobalSemas(void);
|
|
304
|
+
extern Size ProcGlobalShmemSize(void);
|
|
305
|
+
extern void InitProcGlobal(void);
|
|
306
|
+
extern void InitProcess(void);
|
|
307
|
+
extern void InitProcessPhase2(void);
|
|
308
|
+
extern void InitAuxiliaryProcess(void);
|
|
309
|
+
|
|
310
|
+
extern void PublishStartupProcessInformation(void);
|
|
311
|
+
extern void SetStartupBufferPinWaitBufId(int bufid);
|
|
312
|
+
extern int GetStartupBufferPinWaitBufId(void);
|
|
313
|
+
|
|
314
|
+
extern bool HaveNFreeProcs(int n);
|
|
315
|
+
extern void ProcReleaseLocks(bool isCommit);
|
|
316
|
+
|
|
317
|
+
extern void ProcQueueInit(PROC_QUEUE *queue);
|
|
318
|
+
extern int ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable);
|
|
319
|
+
extern PGPROC *ProcWakeup(PGPROC *proc, int waitStatus);
|
|
320
|
+
extern void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock);
|
|
321
|
+
extern void CheckDeadLockAlert(void);
|
|
322
|
+
extern bool IsWaitingForLock(void);
|
|
323
|
+
extern void LockErrorCleanup(void);
|
|
324
|
+
|
|
325
|
+
extern void ProcWaitForSignal(uint32 wait_event_info);
|
|
326
|
+
extern void ProcSendSignal(int pid);
|
|
327
|
+
|
|
328
|
+
extern PGPROC *AuxiliaryPidGetProc(int pid);
|
|
329
|
+
|
|
330
|
+
extern void BecomeLockGroupLeader(void);
|
|
331
|
+
extern bool BecomeLockGroupMember(PGPROC *leader, int pid);
|
|
332
|
+
|
|
333
|
+
#endif /* _PROC_H_ */
|