gitlab-pg_query 1.3.1 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- 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,247 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* tupmacs.h
|
4
|
+
* Tuple macros used by both index tuples and heap tuples.
|
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/access/tupmacs.h
|
11
|
+
*
|
12
|
+
*-------------------------------------------------------------------------
|
13
|
+
*/
|
14
|
+
#ifndef TUPMACS_H
|
15
|
+
#define TUPMACS_H
|
16
|
+
|
17
|
+
#include "catalog/pg_type_d.h" /* for TYPALIGN macros */
|
18
|
+
|
19
|
+
|
20
|
+
/*
|
21
|
+
* Check a tuple's null bitmap to determine whether the attribute is null.
|
22
|
+
* Note that a 0 in the null bitmap indicates a null, while 1 indicates
|
23
|
+
* non-null.
|
24
|
+
*/
|
25
|
+
#define att_isnull(ATT, BITS) (!((BITS)[(ATT) >> 3] & (1 << ((ATT) & 0x07))))
|
26
|
+
|
27
|
+
/*
|
28
|
+
* Given a Form_pg_attribute and a pointer into a tuple's data area,
|
29
|
+
* return the correct value or pointer.
|
30
|
+
*
|
31
|
+
* We return a Datum value in all cases. If the attribute has "byval" false,
|
32
|
+
* we return the same pointer into the tuple data area that we're passed.
|
33
|
+
* Otherwise, we return the correct number of bytes fetched from the data
|
34
|
+
* area and extended to Datum form.
|
35
|
+
*
|
36
|
+
* On machines where Datum is 8 bytes, we support fetching 8-byte byval
|
37
|
+
* attributes; otherwise, only 1, 2, and 4-byte values are supported.
|
38
|
+
*
|
39
|
+
* Note that T must already be properly aligned for this to work correctly.
|
40
|
+
*/
|
41
|
+
#define fetchatt(A,T) fetch_att(T, (A)->attbyval, (A)->attlen)
|
42
|
+
|
43
|
+
/*
|
44
|
+
* Same, but work from byval/len parameters rather than Form_pg_attribute.
|
45
|
+
*/
|
46
|
+
#if SIZEOF_DATUM == 8
|
47
|
+
|
48
|
+
#define fetch_att(T,attbyval,attlen) \
|
49
|
+
( \
|
50
|
+
(attbyval) ? \
|
51
|
+
( \
|
52
|
+
(attlen) == (int) sizeof(Datum) ? \
|
53
|
+
*((Datum *)(T)) \
|
54
|
+
: \
|
55
|
+
( \
|
56
|
+
(attlen) == (int) sizeof(int32) ? \
|
57
|
+
Int32GetDatum(*((int32 *)(T))) \
|
58
|
+
: \
|
59
|
+
( \
|
60
|
+
(attlen) == (int) sizeof(int16) ? \
|
61
|
+
Int16GetDatum(*((int16 *)(T))) \
|
62
|
+
: \
|
63
|
+
( \
|
64
|
+
AssertMacro((attlen) == 1), \
|
65
|
+
CharGetDatum(*((char *)(T))) \
|
66
|
+
) \
|
67
|
+
) \
|
68
|
+
) \
|
69
|
+
) \
|
70
|
+
: \
|
71
|
+
PointerGetDatum((char *) (T)) \
|
72
|
+
)
|
73
|
+
#else /* SIZEOF_DATUM != 8 */
|
74
|
+
|
75
|
+
#define fetch_att(T,attbyval,attlen) \
|
76
|
+
( \
|
77
|
+
(attbyval) ? \
|
78
|
+
( \
|
79
|
+
(attlen) == (int) sizeof(int32) ? \
|
80
|
+
Int32GetDatum(*((int32 *)(T))) \
|
81
|
+
: \
|
82
|
+
( \
|
83
|
+
(attlen) == (int) sizeof(int16) ? \
|
84
|
+
Int16GetDatum(*((int16 *)(T))) \
|
85
|
+
: \
|
86
|
+
( \
|
87
|
+
AssertMacro((attlen) == 1), \
|
88
|
+
CharGetDatum(*((char *)(T))) \
|
89
|
+
) \
|
90
|
+
) \
|
91
|
+
) \
|
92
|
+
: \
|
93
|
+
PointerGetDatum((char *) (T)) \
|
94
|
+
)
|
95
|
+
#endif /* SIZEOF_DATUM == 8 */
|
96
|
+
|
97
|
+
/*
|
98
|
+
* att_align_datum aligns the given offset as needed for a datum of alignment
|
99
|
+
* requirement attalign and typlen attlen. attdatum is the Datum variable
|
100
|
+
* we intend to pack into a tuple (it's only accessed if we are dealing with
|
101
|
+
* a varlena type). Note that this assumes the Datum will be stored as-is;
|
102
|
+
* callers that are intending to convert non-short varlena datums to short
|
103
|
+
* format have to account for that themselves.
|
104
|
+
*/
|
105
|
+
#define att_align_datum(cur_offset, attalign, attlen, attdatum) \
|
106
|
+
( \
|
107
|
+
((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \
|
108
|
+
(uintptr_t) (cur_offset) : \
|
109
|
+
att_align_nominal(cur_offset, attalign) \
|
110
|
+
)
|
111
|
+
|
112
|
+
/*
|
113
|
+
* att_align_pointer performs the same calculation as att_align_datum,
|
114
|
+
* but is used when walking a tuple. attptr is the current actual data
|
115
|
+
* pointer; when accessing a varlena field we have to "peek" to see if we
|
116
|
+
* are looking at a pad byte or the first byte of a 1-byte-header datum.
|
117
|
+
* (A zero byte must be either a pad byte, or the first byte of a correctly
|
118
|
+
* aligned 4-byte length word; in either case we can align safely. A non-zero
|
119
|
+
* byte must be either a 1-byte length word, or the first byte of a correctly
|
120
|
+
* aligned 4-byte length word; in either case we need not align.)
|
121
|
+
*
|
122
|
+
* Note: some callers pass a "char *" pointer for cur_offset. This is
|
123
|
+
* a bit of a hack but should work all right as long as uintptr_t is the
|
124
|
+
* correct width.
|
125
|
+
*/
|
126
|
+
#define att_align_pointer(cur_offset, attalign, attlen, attptr) \
|
127
|
+
( \
|
128
|
+
((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \
|
129
|
+
(uintptr_t) (cur_offset) : \
|
130
|
+
att_align_nominal(cur_offset, attalign) \
|
131
|
+
)
|
132
|
+
|
133
|
+
/*
|
134
|
+
* att_align_nominal aligns the given offset as needed for a datum of alignment
|
135
|
+
* requirement attalign, ignoring any consideration of packed varlena datums.
|
136
|
+
* There are three main use cases for using this macro directly:
|
137
|
+
* * we know that the att in question is not varlena (attlen != -1);
|
138
|
+
* in this case it is cheaper than the above macros and just as good.
|
139
|
+
* * we need to estimate alignment padding cost abstractly, ie without
|
140
|
+
* reference to a real tuple. We must assume the worst case that
|
141
|
+
* all varlenas are aligned.
|
142
|
+
* * within arrays, we unconditionally align varlenas (XXX this should be
|
143
|
+
* revisited, probably).
|
144
|
+
*
|
145
|
+
* The attalign cases are tested in what is hopefully something like their
|
146
|
+
* frequency of occurrence.
|
147
|
+
*/
|
148
|
+
#define att_align_nominal(cur_offset, attalign) \
|
149
|
+
( \
|
150
|
+
((attalign) == TYPALIGN_INT) ? INTALIGN(cur_offset) : \
|
151
|
+
(((attalign) == TYPALIGN_CHAR) ? (uintptr_t) (cur_offset) : \
|
152
|
+
(((attalign) == TYPALIGN_DOUBLE) ? DOUBLEALIGN(cur_offset) : \
|
153
|
+
( \
|
154
|
+
AssertMacro((attalign) == TYPALIGN_SHORT), \
|
155
|
+
SHORTALIGN(cur_offset) \
|
156
|
+
))) \
|
157
|
+
)
|
158
|
+
|
159
|
+
/*
|
160
|
+
* att_addlength_datum increments the given offset by the space needed for
|
161
|
+
* the given Datum variable. attdatum is only accessed if we are dealing
|
162
|
+
* with a variable-length attribute.
|
163
|
+
*/
|
164
|
+
#define att_addlength_datum(cur_offset, attlen, attdatum) \
|
165
|
+
att_addlength_pointer(cur_offset, attlen, DatumGetPointer(attdatum))
|
166
|
+
|
167
|
+
/*
|
168
|
+
* att_addlength_pointer performs the same calculation as att_addlength_datum,
|
169
|
+
* but is used when walking a tuple --- attptr is the pointer to the field
|
170
|
+
* within the tuple.
|
171
|
+
*
|
172
|
+
* Note: some callers pass a "char *" pointer for cur_offset. This is
|
173
|
+
* actually perfectly OK, but probably should be cleaned up along with
|
174
|
+
* the same practice for att_align_pointer.
|
175
|
+
*/
|
176
|
+
#define att_addlength_pointer(cur_offset, attlen, attptr) \
|
177
|
+
( \
|
178
|
+
((attlen) > 0) ? \
|
179
|
+
( \
|
180
|
+
(cur_offset) + (attlen) \
|
181
|
+
) \
|
182
|
+
: (((attlen) == -1) ? \
|
183
|
+
( \
|
184
|
+
(cur_offset) + VARSIZE_ANY(attptr) \
|
185
|
+
) \
|
186
|
+
: \
|
187
|
+
( \
|
188
|
+
AssertMacro((attlen) == -2), \
|
189
|
+
(cur_offset) + (strlen((char *) (attptr)) + 1) \
|
190
|
+
)) \
|
191
|
+
)
|
192
|
+
|
193
|
+
/*
|
194
|
+
* store_att_byval is a partial inverse of fetch_att: store a given Datum
|
195
|
+
* value into a tuple data area at the specified address. However, it only
|
196
|
+
* handles the byval case, because in typical usage the caller needs to
|
197
|
+
* distinguish by-val and by-ref cases anyway, and so a do-it-all macro
|
198
|
+
* wouldn't be convenient.
|
199
|
+
*/
|
200
|
+
#if SIZEOF_DATUM == 8
|
201
|
+
|
202
|
+
#define store_att_byval(T,newdatum,attlen) \
|
203
|
+
do { \
|
204
|
+
switch (attlen) \
|
205
|
+
{ \
|
206
|
+
case sizeof(char): \
|
207
|
+
*(char *) (T) = DatumGetChar(newdatum); \
|
208
|
+
break; \
|
209
|
+
case sizeof(int16): \
|
210
|
+
*(int16 *) (T) = DatumGetInt16(newdatum); \
|
211
|
+
break; \
|
212
|
+
case sizeof(int32): \
|
213
|
+
*(int32 *) (T) = DatumGetInt32(newdatum); \
|
214
|
+
break; \
|
215
|
+
case sizeof(Datum): \
|
216
|
+
*(Datum *) (T) = (newdatum); \
|
217
|
+
break; \
|
218
|
+
default: \
|
219
|
+
elog(ERROR, "unsupported byval length: %d", \
|
220
|
+
(int) (attlen)); \
|
221
|
+
break; \
|
222
|
+
} \
|
223
|
+
} while (0)
|
224
|
+
#else /* SIZEOF_DATUM != 8 */
|
225
|
+
|
226
|
+
#define store_att_byval(T,newdatum,attlen) \
|
227
|
+
do { \
|
228
|
+
switch (attlen) \
|
229
|
+
{ \
|
230
|
+
case sizeof(char): \
|
231
|
+
*(char *) (T) = DatumGetChar(newdatum); \
|
232
|
+
break; \
|
233
|
+
case sizeof(int16): \
|
234
|
+
*(int16 *) (T) = DatumGetInt16(newdatum); \
|
235
|
+
break; \
|
236
|
+
case sizeof(int32): \
|
237
|
+
*(int32 *) (T) = DatumGetInt32(newdatum); \
|
238
|
+
break; \
|
239
|
+
default: \
|
240
|
+
elog(ERROR, "unsupported byval length: %d", \
|
241
|
+
(int) (attlen)); \
|
242
|
+
break; \
|
243
|
+
} \
|
244
|
+
} while (0)
|
245
|
+
#endif /* SIZEOF_DATUM == 8 */
|
246
|
+
|
247
|
+
#endif
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* twophase.h
|
4
|
+
* Two-phase-commit related declarations.
|
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/access/twophase.h
|
11
|
+
*
|
12
|
+
*-------------------------------------------------------------------------
|
13
|
+
*/
|
14
|
+
#ifndef TWOPHASE_H
|
15
|
+
#define TWOPHASE_H
|
16
|
+
|
17
|
+
#include "access/xact.h"
|
18
|
+
#include "access/xlogdefs.h"
|
19
|
+
#include "datatype/timestamp.h"
|
20
|
+
#include "storage/lock.h"
|
21
|
+
|
22
|
+
/*
|
23
|
+
* GlobalTransactionData is defined in twophase.c; other places have no
|
24
|
+
* business knowing the internal definition.
|
25
|
+
*/
|
26
|
+
typedef struct GlobalTransactionData *GlobalTransaction;
|
27
|
+
|
28
|
+
/* GUC variable */
|
29
|
+
extern PGDLLIMPORT int max_prepared_xacts;
|
30
|
+
|
31
|
+
extern Size TwoPhaseShmemSize(void);
|
32
|
+
extern void TwoPhaseShmemInit(void);
|
33
|
+
|
34
|
+
extern void AtAbort_Twophase(void);
|
35
|
+
extern void PostPrepare_Twophase(void);
|
36
|
+
|
37
|
+
extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid, bool lock_held);
|
38
|
+
extern BackendId TwoPhaseGetDummyBackendId(TransactionId xid, bool lock_held);
|
39
|
+
|
40
|
+
extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid,
|
41
|
+
TimestampTz prepared_at,
|
42
|
+
Oid owner, Oid databaseid);
|
43
|
+
|
44
|
+
extern void StartPrepare(GlobalTransaction gxact);
|
45
|
+
extern void EndPrepare(GlobalTransaction gxact);
|
46
|
+
extern bool StandbyTransactionIdIsPrepared(TransactionId xid);
|
47
|
+
|
48
|
+
extern TransactionId PrescanPreparedTransactions(TransactionId **xids_p,
|
49
|
+
int *nxids_p);
|
50
|
+
extern void StandbyRecoverPreparedTransactions(void);
|
51
|
+
extern void RecoverPreparedTransactions(void);
|
52
|
+
|
53
|
+
extern void CheckPointTwoPhase(XLogRecPtr redo_horizon);
|
54
|
+
|
55
|
+
extern void FinishPreparedTransaction(const char *gid, bool isCommit);
|
56
|
+
|
57
|
+
extern void PrepareRedoAdd(char *buf, XLogRecPtr start_lsn,
|
58
|
+
XLogRecPtr end_lsn, RepOriginId origin_id);
|
59
|
+
extern void PrepareRedoRemove(TransactionId xid, bool giveWarning);
|
60
|
+
extern void restoreTwoPhaseData(void);
|
61
|
+
#endif /* TWOPHASE_H */
|
@@ -0,0 +1,463 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* xact.h
|
4
|
+
* postgres transaction system 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/access/xact.h
|
11
|
+
*
|
12
|
+
*-------------------------------------------------------------------------
|
13
|
+
*/
|
14
|
+
#ifndef XACT_H
|
15
|
+
#define XACT_H
|
16
|
+
|
17
|
+
#include "access/transam.h"
|
18
|
+
#include "access/xlogreader.h"
|
19
|
+
#include "lib/stringinfo.h"
|
20
|
+
#include "nodes/pg_list.h"
|
21
|
+
#include "storage/relfilenode.h"
|
22
|
+
#include "storage/sinval.h"
|
23
|
+
#include "utils/datetime.h"
|
24
|
+
|
25
|
+
/*
|
26
|
+
* Maximum size of Global Transaction ID (including '\0').
|
27
|
+
*
|
28
|
+
* Note that the max value of GIDSIZE must fit in the uint16 gidlen,
|
29
|
+
* specified in TwoPhaseFileHeader.
|
30
|
+
*/
|
31
|
+
#define GIDSIZE 200
|
32
|
+
|
33
|
+
/*
|
34
|
+
* Xact isolation levels
|
35
|
+
*/
|
36
|
+
#define XACT_READ_UNCOMMITTED 0
|
37
|
+
#define XACT_READ_COMMITTED 1
|
38
|
+
#define XACT_REPEATABLE_READ 2
|
39
|
+
#define XACT_SERIALIZABLE 3
|
40
|
+
|
41
|
+
extern int DefaultXactIsoLevel;
|
42
|
+
extern PGDLLIMPORT int XactIsoLevel;
|
43
|
+
|
44
|
+
/*
|
45
|
+
* We implement three isolation levels internally.
|
46
|
+
* The two stronger ones use one snapshot per database transaction;
|
47
|
+
* the others use one snapshot per statement.
|
48
|
+
* Serializable uses predicate locks in addition to snapshots.
|
49
|
+
* These macros should be used to check which isolation level is selected.
|
50
|
+
*/
|
51
|
+
#define IsolationUsesXactSnapshot() (XactIsoLevel >= XACT_REPEATABLE_READ)
|
52
|
+
#define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE)
|
53
|
+
|
54
|
+
/* Xact read-only state */
|
55
|
+
extern bool DefaultXactReadOnly;
|
56
|
+
extern bool XactReadOnly;
|
57
|
+
|
58
|
+
/* flag for logging statements in this transaction */
|
59
|
+
extern bool xact_is_sampled;
|
60
|
+
|
61
|
+
/*
|
62
|
+
* Xact is deferrable -- only meaningful (currently) for read only
|
63
|
+
* SERIALIZABLE transactions
|
64
|
+
*/
|
65
|
+
extern bool DefaultXactDeferrable;
|
66
|
+
extern bool XactDeferrable;
|
67
|
+
|
68
|
+
typedef enum
|
69
|
+
{
|
70
|
+
SYNCHRONOUS_COMMIT_OFF, /* asynchronous commit */
|
71
|
+
SYNCHRONOUS_COMMIT_LOCAL_FLUSH, /* wait for local flush only */
|
72
|
+
SYNCHRONOUS_COMMIT_REMOTE_WRITE, /* wait for local flush and remote
|
73
|
+
* write */
|
74
|
+
SYNCHRONOUS_COMMIT_REMOTE_FLUSH, /* wait for local and remote flush */
|
75
|
+
SYNCHRONOUS_COMMIT_REMOTE_APPLY /* wait for local and remote flush
|
76
|
+
and remote apply */
|
77
|
+
} SyncCommitLevel;
|
78
|
+
|
79
|
+
/* Define the default setting for synchronous_commit */
|
80
|
+
#define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH
|
81
|
+
|
82
|
+
/* Synchronous commit level */
|
83
|
+
extern int synchronous_commit;
|
84
|
+
|
85
|
+
/*
|
86
|
+
* Miscellaneous flag bits to record events which occur on the top level
|
87
|
+
* transaction. These flags are only persisted in MyXactFlags and are intended
|
88
|
+
* so we remember to do certain things later in the transaction. This is
|
89
|
+
* globally accessible, so can be set from anywhere in the code which requires
|
90
|
+
* recording flags.
|
91
|
+
*/
|
92
|
+
extern int MyXactFlags;
|
93
|
+
|
94
|
+
/*
|
95
|
+
* XACT_FLAGS_ACCESSEDTEMPNAMESPACE - set when a temporary object is accessed.
|
96
|
+
* We don't allow PREPARE TRANSACTION in that case.
|
97
|
+
*/
|
98
|
+
#define XACT_FLAGS_ACCESSEDTEMPNAMESPACE (1U << 0)
|
99
|
+
|
100
|
+
/*
|
101
|
+
* XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK - records whether the top level xact
|
102
|
+
* logged any Access Exclusive Locks.
|
103
|
+
*/
|
104
|
+
#define XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK (1U << 1)
|
105
|
+
|
106
|
+
/*
|
107
|
+
* start- and end-of-transaction callbacks for dynamically loaded modules
|
108
|
+
*/
|
109
|
+
typedef enum
|
110
|
+
{
|
111
|
+
XACT_EVENT_COMMIT,
|
112
|
+
XACT_EVENT_PARALLEL_COMMIT,
|
113
|
+
XACT_EVENT_ABORT,
|
114
|
+
XACT_EVENT_PARALLEL_ABORT,
|
115
|
+
XACT_EVENT_PREPARE,
|
116
|
+
XACT_EVENT_PRE_COMMIT,
|
117
|
+
XACT_EVENT_PARALLEL_PRE_COMMIT,
|
118
|
+
XACT_EVENT_PRE_PREPARE
|
119
|
+
} XactEvent;
|
120
|
+
|
121
|
+
typedef void (*XactCallback) (XactEvent event, void *arg);
|
122
|
+
|
123
|
+
typedef enum
|
124
|
+
{
|
125
|
+
SUBXACT_EVENT_START_SUB,
|
126
|
+
SUBXACT_EVENT_COMMIT_SUB,
|
127
|
+
SUBXACT_EVENT_ABORT_SUB,
|
128
|
+
SUBXACT_EVENT_PRE_COMMIT_SUB
|
129
|
+
} SubXactEvent;
|
130
|
+
|
131
|
+
typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
|
132
|
+
SubTransactionId parentSubid, void *arg);
|
133
|
+
|
134
|
+
|
135
|
+
/* ----------------
|
136
|
+
* transaction-related XLOG entries
|
137
|
+
* ----------------
|
138
|
+
*/
|
139
|
+
|
140
|
+
/*
|
141
|
+
* XLOG allows to store some information in high 4 bits of log record xl_info
|
142
|
+
* field. We use 3 for the opcode, and one about an optional flag variable.
|
143
|
+
*/
|
144
|
+
#define XLOG_XACT_COMMIT 0x00
|
145
|
+
#define XLOG_XACT_PREPARE 0x10
|
146
|
+
#define XLOG_XACT_ABORT 0x20
|
147
|
+
#define XLOG_XACT_COMMIT_PREPARED 0x30
|
148
|
+
#define XLOG_XACT_ABORT_PREPARED 0x40
|
149
|
+
#define XLOG_XACT_ASSIGNMENT 0x50
|
150
|
+
/* free opcode 0x60 */
|
151
|
+
/* free opcode 0x70 */
|
152
|
+
|
153
|
+
/* mask for filtering opcodes out of xl_info */
|
154
|
+
#define XLOG_XACT_OPMASK 0x70
|
155
|
+
|
156
|
+
/* does this record have a 'xinfo' field or not */
|
157
|
+
#define XLOG_XACT_HAS_INFO 0x80
|
158
|
+
|
159
|
+
/*
|
160
|
+
* The following flags, stored in xinfo, determine which information is
|
161
|
+
* contained in commit/abort records.
|
162
|
+
*/
|
163
|
+
#define XACT_XINFO_HAS_DBINFO (1U << 0)
|
164
|
+
#define XACT_XINFO_HAS_SUBXACTS (1U << 1)
|
165
|
+
#define XACT_XINFO_HAS_RELFILENODES (1U << 2)
|
166
|
+
#define XACT_XINFO_HAS_INVALS (1U << 3)
|
167
|
+
#define XACT_XINFO_HAS_TWOPHASE (1U << 4)
|
168
|
+
#define XACT_XINFO_HAS_ORIGIN (1U << 5)
|
169
|
+
#define XACT_XINFO_HAS_AE_LOCKS (1U << 6)
|
170
|
+
#define XACT_XINFO_HAS_GID (1U << 7)
|
171
|
+
|
172
|
+
/*
|
173
|
+
* Also stored in xinfo, these indicating a variety of additional actions that
|
174
|
+
* need to occur when emulating transaction effects during recovery.
|
175
|
+
*
|
176
|
+
* They are named XactCompletion... to differentiate them from
|
177
|
+
* EOXact... routines which run at the end of the original transaction
|
178
|
+
* completion.
|
179
|
+
*/
|
180
|
+
#define XACT_COMPLETION_APPLY_FEEDBACK (1U << 29)
|
181
|
+
#define XACT_COMPLETION_UPDATE_RELCACHE_FILE (1U << 30)
|
182
|
+
#define XACT_COMPLETION_FORCE_SYNC_COMMIT (1U << 31)
|
183
|
+
|
184
|
+
/* Access macros for above flags */
|
185
|
+
#define XactCompletionApplyFeedback(xinfo) \
|
186
|
+
((xinfo & XACT_COMPLETION_APPLY_FEEDBACK) != 0)
|
187
|
+
#define XactCompletionRelcacheInitFileInval(xinfo) \
|
188
|
+
((xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) != 0)
|
189
|
+
#define XactCompletionForceSyncCommit(xinfo) \
|
190
|
+
((xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) != 0)
|
191
|
+
|
192
|
+
typedef struct xl_xact_assignment
|
193
|
+
{
|
194
|
+
TransactionId xtop; /* assigned XID's top-level XID */
|
195
|
+
int nsubxacts; /* number of subtransaction XIDs */
|
196
|
+
TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]; /* assigned subxids */
|
197
|
+
} xl_xact_assignment;
|
198
|
+
|
199
|
+
#define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub)
|
200
|
+
|
201
|
+
/*
|
202
|
+
* Commit and abort records can contain a lot of information. But a large
|
203
|
+
* portion of the records won't need all possible pieces of information. So we
|
204
|
+
* only include what's needed.
|
205
|
+
*
|
206
|
+
* A minimal commit/abort record only consists of a xl_xact_commit/abort
|
207
|
+
* struct. The presence of additional information is indicated by bits set in
|
208
|
+
* 'xl_xact_xinfo->xinfo'. The presence of the xinfo field itself is signaled
|
209
|
+
* by a set XLOG_XACT_HAS_INFO bit in the xl_info field.
|
210
|
+
*
|
211
|
+
* NB: All the individual data chunks should be sized to multiples of
|
212
|
+
* sizeof(int) and only require int32 alignment. If they require bigger
|
213
|
+
* alignment, they need to be copied upon reading.
|
214
|
+
*/
|
215
|
+
|
216
|
+
/* sub-records for commit/abort */
|
217
|
+
|
218
|
+
typedef struct xl_xact_xinfo
|
219
|
+
{
|
220
|
+
/*
|
221
|
+
* Even though we right now only require 1 byte of space in xinfo we use
|
222
|
+
* four so following records don't have to care about alignment. Commit
|
223
|
+
* records can be large, so copying large portions isn't attractive.
|
224
|
+
*/
|
225
|
+
uint32 xinfo;
|
226
|
+
} xl_xact_xinfo;
|
227
|
+
|
228
|
+
typedef struct xl_xact_dbinfo
|
229
|
+
{
|
230
|
+
Oid dbId; /* MyDatabaseId */
|
231
|
+
Oid tsId; /* MyDatabaseTableSpace */
|
232
|
+
} xl_xact_dbinfo;
|
233
|
+
|
234
|
+
typedef struct xl_xact_subxacts
|
235
|
+
{
|
236
|
+
int nsubxacts; /* number of subtransaction XIDs */
|
237
|
+
TransactionId subxacts[FLEXIBLE_ARRAY_MEMBER];
|
238
|
+
} xl_xact_subxacts;
|
239
|
+
#define MinSizeOfXactSubxacts offsetof(xl_xact_subxacts, subxacts)
|
240
|
+
|
241
|
+
typedef struct xl_xact_relfilenodes
|
242
|
+
{
|
243
|
+
int nrels; /* number of relations */
|
244
|
+
RelFileNode xnodes[FLEXIBLE_ARRAY_MEMBER];
|
245
|
+
} xl_xact_relfilenodes;
|
246
|
+
#define MinSizeOfXactRelfilenodes offsetof(xl_xact_relfilenodes, xnodes)
|
247
|
+
|
248
|
+
typedef struct xl_xact_invals
|
249
|
+
{
|
250
|
+
int nmsgs; /* number of shared inval msgs */
|
251
|
+
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER];
|
252
|
+
} xl_xact_invals;
|
253
|
+
#define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
|
254
|
+
|
255
|
+
typedef struct xl_xact_twophase
|
256
|
+
{
|
257
|
+
TransactionId xid;
|
258
|
+
} xl_xact_twophase;
|
259
|
+
|
260
|
+
typedef struct xl_xact_origin
|
261
|
+
{
|
262
|
+
XLogRecPtr origin_lsn;
|
263
|
+
TimestampTz origin_timestamp;
|
264
|
+
} xl_xact_origin;
|
265
|
+
|
266
|
+
typedef struct xl_xact_commit
|
267
|
+
{
|
268
|
+
TimestampTz xact_time; /* time of commit */
|
269
|
+
|
270
|
+
/* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
|
271
|
+
/* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
|
272
|
+
/* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
|
273
|
+
/* xl_xact_relfilenodes follows if XINFO_HAS_RELFILENODES */
|
274
|
+
/* xl_xact_invals follows if XINFO_HAS_INVALS */
|
275
|
+
/* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
|
276
|
+
/* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
|
277
|
+
/* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
|
278
|
+
} xl_xact_commit;
|
279
|
+
#define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz))
|
280
|
+
|
281
|
+
typedef struct xl_xact_abort
|
282
|
+
{
|
283
|
+
TimestampTz xact_time; /* time of abort */
|
284
|
+
|
285
|
+
/* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
|
286
|
+
/* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
|
287
|
+
/* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
|
288
|
+
/* xl_xact_relfilenodes follows if XINFO_HAS_RELFILENODES */
|
289
|
+
/* No invalidation messages needed. */
|
290
|
+
/* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
|
291
|
+
/* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
|
292
|
+
/* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
|
293
|
+
} xl_xact_abort;
|
294
|
+
#define MinSizeOfXactAbort sizeof(xl_xact_abort)
|
295
|
+
|
296
|
+
typedef struct xl_xact_prepare
|
297
|
+
{
|
298
|
+
uint32 magic; /* format identifier */
|
299
|
+
uint32 total_len; /* actual file length */
|
300
|
+
TransactionId xid; /* original transaction XID */
|
301
|
+
Oid database; /* OID of database it was in */
|
302
|
+
TimestampTz prepared_at; /* time of preparation */
|
303
|
+
Oid owner; /* user running the transaction */
|
304
|
+
int32 nsubxacts; /* number of following subxact XIDs */
|
305
|
+
int32 ncommitrels; /* number of delete-on-commit rels */
|
306
|
+
int32 nabortrels; /* number of delete-on-abort rels */
|
307
|
+
int32 ninvalmsgs; /* number of cache invalidation messages */
|
308
|
+
bool initfileinval; /* does relcache init file need invalidation? */
|
309
|
+
uint16 gidlen; /* length of the GID - GID follows the header */
|
310
|
+
XLogRecPtr origin_lsn; /* lsn of this record at origin node */
|
311
|
+
TimestampTz origin_timestamp; /* time of prepare at origin node */
|
312
|
+
} xl_xact_prepare;
|
313
|
+
|
314
|
+
/*
|
315
|
+
* Commit/Abort records in the above form are a bit verbose to parse, so
|
316
|
+
* there's a deconstructed versions generated by ParseCommit/AbortRecord() for
|
317
|
+
* easier consumption.
|
318
|
+
*/
|
319
|
+
typedef struct xl_xact_parsed_commit
|
320
|
+
{
|
321
|
+
TimestampTz xact_time;
|
322
|
+
uint32 xinfo;
|
323
|
+
|
324
|
+
Oid dbId; /* MyDatabaseId */
|
325
|
+
Oid tsId; /* MyDatabaseTableSpace */
|
326
|
+
|
327
|
+
int nsubxacts;
|
328
|
+
TransactionId *subxacts;
|
329
|
+
|
330
|
+
int nrels;
|
331
|
+
RelFileNode *xnodes;
|
332
|
+
|
333
|
+
int nmsgs;
|
334
|
+
SharedInvalidationMessage *msgs;
|
335
|
+
|
336
|
+
TransactionId twophase_xid; /* only for 2PC */
|
337
|
+
char twophase_gid[GIDSIZE]; /* only for 2PC */
|
338
|
+
int nabortrels; /* only for 2PC */
|
339
|
+
RelFileNode *abortnodes; /* only for 2PC */
|
340
|
+
|
341
|
+
XLogRecPtr origin_lsn;
|
342
|
+
TimestampTz origin_timestamp;
|
343
|
+
} xl_xact_parsed_commit;
|
344
|
+
|
345
|
+
typedef xl_xact_parsed_commit xl_xact_parsed_prepare;
|
346
|
+
|
347
|
+
typedef struct xl_xact_parsed_abort
|
348
|
+
{
|
349
|
+
TimestampTz xact_time;
|
350
|
+
uint32 xinfo;
|
351
|
+
|
352
|
+
Oid dbId; /* MyDatabaseId */
|
353
|
+
Oid tsId; /* MyDatabaseTableSpace */
|
354
|
+
|
355
|
+
int nsubxacts;
|
356
|
+
TransactionId *subxacts;
|
357
|
+
|
358
|
+
int nrels;
|
359
|
+
RelFileNode *xnodes;
|
360
|
+
|
361
|
+
TransactionId twophase_xid; /* only for 2PC */
|
362
|
+
char twophase_gid[GIDSIZE]; /* only for 2PC */
|
363
|
+
|
364
|
+
XLogRecPtr origin_lsn;
|
365
|
+
TimestampTz origin_timestamp;
|
366
|
+
} xl_xact_parsed_abort;
|
367
|
+
|
368
|
+
|
369
|
+
/* ----------------
|
370
|
+
* extern definitions
|
371
|
+
* ----------------
|
372
|
+
*/
|
373
|
+
extern bool IsTransactionState(void);
|
374
|
+
extern bool IsAbortedTransactionBlockState(void);
|
375
|
+
extern TransactionId GetTopTransactionId(void);
|
376
|
+
extern TransactionId GetTopTransactionIdIfAny(void);
|
377
|
+
extern TransactionId GetCurrentTransactionId(void);
|
378
|
+
extern TransactionId GetCurrentTransactionIdIfAny(void);
|
379
|
+
extern TransactionId GetStableLatestTransactionId(void);
|
380
|
+
extern SubTransactionId GetCurrentSubTransactionId(void);
|
381
|
+
extern FullTransactionId GetTopFullTransactionId(void);
|
382
|
+
extern FullTransactionId GetTopFullTransactionIdIfAny(void);
|
383
|
+
extern FullTransactionId GetCurrentFullTransactionId(void);
|
384
|
+
extern FullTransactionId GetCurrentFullTransactionIdIfAny(void);
|
385
|
+
extern void MarkCurrentTransactionIdLoggedIfAny(void);
|
386
|
+
extern bool SubTransactionIsActive(SubTransactionId subxid);
|
387
|
+
extern CommandId GetCurrentCommandId(bool used);
|
388
|
+
extern void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts);
|
389
|
+
extern TimestampTz GetCurrentTransactionStartTimestamp(void);
|
390
|
+
extern TimestampTz GetCurrentStatementStartTimestamp(void);
|
391
|
+
extern TimestampTz GetCurrentTransactionStopTimestamp(void);
|
392
|
+
extern void SetCurrentStatementStartTimestamp(void);
|
393
|
+
extern int GetCurrentTransactionNestLevel(void);
|
394
|
+
extern bool TransactionIdIsCurrentTransactionId(TransactionId xid);
|
395
|
+
extern void CommandCounterIncrement(void);
|
396
|
+
extern void ForceSyncCommit(void);
|
397
|
+
extern void StartTransactionCommand(void);
|
398
|
+
extern void SaveTransactionCharacteristics(void);
|
399
|
+
extern void RestoreTransactionCharacteristics(void);
|
400
|
+
extern void CommitTransactionCommand(void);
|
401
|
+
extern void AbortCurrentTransaction(void);
|
402
|
+
extern void BeginTransactionBlock(void);
|
403
|
+
extern bool EndTransactionBlock(bool chain);
|
404
|
+
extern bool PrepareTransactionBlock(const char *gid);
|
405
|
+
extern void UserAbortTransactionBlock(bool chain);
|
406
|
+
extern void BeginImplicitTransactionBlock(void);
|
407
|
+
extern void EndImplicitTransactionBlock(void);
|
408
|
+
extern void ReleaseSavepoint(const char *name);
|
409
|
+
extern void DefineSavepoint(const char *name);
|
410
|
+
extern void RollbackToSavepoint(const char *name);
|
411
|
+
extern void BeginInternalSubTransaction(const char *name);
|
412
|
+
extern void ReleaseCurrentSubTransaction(void);
|
413
|
+
extern void RollbackAndReleaseCurrentSubTransaction(void);
|
414
|
+
extern bool IsSubTransaction(void);
|
415
|
+
extern Size EstimateTransactionStateSpace(void);
|
416
|
+
extern void SerializeTransactionState(Size maxsize, char *start_address);
|
417
|
+
extern void StartParallelWorkerTransaction(char *tstatespace);
|
418
|
+
extern void EndParallelWorkerTransaction(void);
|
419
|
+
extern bool IsTransactionBlock(void);
|
420
|
+
extern bool IsTransactionOrTransactionBlock(void);
|
421
|
+
extern char TransactionBlockStatusCode(void);
|
422
|
+
extern void AbortOutOfAnyTransaction(void);
|
423
|
+
extern void PreventInTransactionBlock(bool isTopLevel, const char *stmtType);
|
424
|
+
extern void RequireTransactionBlock(bool isTopLevel, const char *stmtType);
|
425
|
+
extern void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType);
|
426
|
+
extern bool IsInTransactionBlock(bool isTopLevel);
|
427
|
+
extern void RegisterXactCallback(XactCallback callback, void *arg);
|
428
|
+
extern void UnregisterXactCallback(XactCallback callback, void *arg);
|
429
|
+
extern void RegisterSubXactCallback(SubXactCallback callback, void *arg);
|
430
|
+
extern void UnregisterSubXactCallback(SubXactCallback callback, void *arg);
|
431
|
+
|
432
|
+
extern int xactGetCommittedChildren(TransactionId **ptr);
|
433
|
+
|
434
|
+
extern XLogRecPtr XactLogCommitRecord(TimestampTz commit_time,
|
435
|
+
int nsubxacts, TransactionId *subxacts,
|
436
|
+
int nrels, RelFileNode *rels,
|
437
|
+
int nmsgs, SharedInvalidationMessage *msgs,
|
438
|
+
bool relcacheInval, bool forceSync,
|
439
|
+
int xactflags,
|
440
|
+
TransactionId twophase_xid,
|
441
|
+
const char *twophase_gid);
|
442
|
+
|
443
|
+
extern XLogRecPtr XactLogAbortRecord(TimestampTz abort_time,
|
444
|
+
int nsubxacts, TransactionId *subxacts,
|
445
|
+
int nrels, RelFileNode *rels,
|
446
|
+
int xactflags, TransactionId twophase_xid,
|
447
|
+
const char *twophase_gid);
|
448
|
+
extern void xact_redo(XLogReaderState *record);
|
449
|
+
|
450
|
+
/* xactdesc.c */
|
451
|
+
extern void xact_desc(StringInfo buf, XLogReaderState *record);
|
452
|
+
extern const char *xact_identify(uint8 info);
|
453
|
+
|
454
|
+
/* also in xactdesc.c, so they can be shared between front/backend code */
|
455
|
+
extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed);
|
456
|
+
extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed);
|
457
|
+
extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed);
|
458
|
+
|
459
|
+
extern void EnterParallelMode(void);
|
460
|
+
extern void ExitParallelMode(void);
|
461
|
+
extern bool IsInParallelMode(void);
|
462
|
+
|
463
|
+
#endif /* XACT_H */
|