pg_query 1.1.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +163 -52
- data/README.md +80 -69
- data/Rakefile +82 -1
- data/ext/pg_query/extconf.rb +3 -31
- 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 +988 -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 +9953 -0
- data/ext/pg_query/pg_query_fingerprint.c +292 -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 +437 -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 +16 -1117
- data/lib/pg_query/filter_columns.rb +86 -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 -200
- 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 +64 -43
- data/lib/pg_query/version.rb +2 -2
- metadata +473 -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/legacy_parsetree.rb +0 -109
- data/lib/pg_query/node_types.rb +0 -284
@@ -0,0 +1,184 @@
|
|
1
|
+
#ifndef _REGEX_H_
|
2
|
+
#define _REGEX_H_ /* never again */
|
3
|
+
/*
|
4
|
+
* regular expressions
|
5
|
+
*
|
6
|
+
* Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
|
7
|
+
*
|
8
|
+
* Development of this software was funded, in part, by Cray Research Inc.,
|
9
|
+
* UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
|
10
|
+
* Corporation, none of whom are responsible for the results. The author
|
11
|
+
* thanks all of them.
|
12
|
+
*
|
13
|
+
* Redistribution and use in source and binary forms -- with or without
|
14
|
+
* modification -- are permitted for any purpose, provided that
|
15
|
+
* redistributions in source form retain this entire copyright notice and
|
16
|
+
* indicate the origin and nature of any modifications.
|
17
|
+
*
|
18
|
+
* I'd appreciate being given credit for this package in the documentation
|
19
|
+
* of software which uses it, but that is not a requirement.
|
20
|
+
*
|
21
|
+
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22
|
+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23
|
+
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
24
|
+
* HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
27
|
+
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
28
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
29
|
+
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
30
|
+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*
|
32
|
+
* src/include/regex/regex.h
|
33
|
+
*/
|
34
|
+
|
35
|
+
/*
|
36
|
+
* Add your own defines, if needed, here.
|
37
|
+
*/
|
38
|
+
#include "mb/pg_wchar.h"
|
39
|
+
|
40
|
+
/*
|
41
|
+
* interface types etc.
|
42
|
+
*/
|
43
|
+
|
44
|
+
/*
|
45
|
+
* regoff_t has to be large enough to hold either off_t or ssize_t,
|
46
|
+
* and must be signed; it's only a guess that long is suitable.
|
47
|
+
*/
|
48
|
+
typedef long regoff_t;
|
49
|
+
|
50
|
+
/*
|
51
|
+
* other interface types
|
52
|
+
*/
|
53
|
+
|
54
|
+
/* the biggie, a compiled RE (or rather, a front end to same) */
|
55
|
+
typedef struct
|
56
|
+
{
|
57
|
+
int re_magic; /* magic number */
|
58
|
+
size_t re_nsub; /* number of subexpressions */
|
59
|
+
long re_info; /* information about RE */
|
60
|
+
#define REG_UBACKREF 000001
|
61
|
+
#define REG_ULOOKAROUND 000002
|
62
|
+
#define REG_UBOUNDS 000004
|
63
|
+
#define REG_UBRACES 000010
|
64
|
+
#define REG_UBSALNUM 000020
|
65
|
+
#define REG_UPBOTCH 000040
|
66
|
+
#define REG_UBBS 000100
|
67
|
+
#define REG_UNONPOSIX 000200
|
68
|
+
#define REG_UUNSPEC 000400
|
69
|
+
#define REG_UUNPORT 001000
|
70
|
+
#define REG_ULOCALE 002000
|
71
|
+
#define REG_UEMPTYMATCH 004000
|
72
|
+
#define REG_UIMPOSSIBLE 010000
|
73
|
+
#define REG_USHORTEST 020000
|
74
|
+
int re_csize; /* sizeof(character) */
|
75
|
+
char *re_endp; /* backward compatibility kludge */
|
76
|
+
Oid re_collation; /* Collation that defines LC_CTYPE behavior */
|
77
|
+
/* the rest is opaque pointers to hidden innards */
|
78
|
+
char *re_guts; /* `char *' is more portable than `void *' */
|
79
|
+
char *re_fns;
|
80
|
+
} regex_t;
|
81
|
+
|
82
|
+
/* result reporting (may acquire more fields later) */
|
83
|
+
typedef struct
|
84
|
+
{
|
85
|
+
regoff_t rm_so; /* start of substring */
|
86
|
+
regoff_t rm_eo; /* end of substring */
|
87
|
+
} regmatch_t;
|
88
|
+
|
89
|
+
/* supplementary control and reporting */
|
90
|
+
typedef struct
|
91
|
+
{
|
92
|
+
regmatch_t rm_extend; /* see REG_EXPECT */
|
93
|
+
} rm_detail_t;
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
/*
|
98
|
+
* regex compilation flags
|
99
|
+
*/
|
100
|
+
#define REG_BASIC 000000 /* BREs (convenience) */
|
101
|
+
#define REG_EXTENDED 000001 /* EREs */
|
102
|
+
#define REG_ADVF 000002 /* advanced features in EREs */
|
103
|
+
#define REG_ADVANCED 000003 /* AREs (which are also EREs) */
|
104
|
+
#define REG_QUOTE 000004 /* no special characters, none */
|
105
|
+
#define REG_NOSPEC REG_QUOTE /* historical synonym */
|
106
|
+
#define REG_ICASE 000010 /* ignore case */
|
107
|
+
#define REG_NOSUB 000020 /* don't care about subexpressions */
|
108
|
+
#define REG_EXPANDED 000040 /* expanded format, white space & comments */
|
109
|
+
#define REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */
|
110
|
+
#define REG_NLANCH 000200 /* ^ matches after \n, $ before */
|
111
|
+
#define REG_NEWLINE 000300 /* newlines are line terminators */
|
112
|
+
#define REG_PEND 000400 /* ugh -- backward-compatibility hack */
|
113
|
+
#define REG_EXPECT 001000 /* report details on partial/limited matches */
|
114
|
+
#define REG_BOSONLY 002000 /* temporary kludge for BOS-only matches */
|
115
|
+
#define REG_DUMP 004000 /* none of your business :-) */
|
116
|
+
#define REG_FAKE 010000 /* none of your business :-) */
|
117
|
+
#define REG_PROGRESS 020000 /* none of your business :-) */
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
/*
|
122
|
+
* regex execution flags
|
123
|
+
*/
|
124
|
+
#define REG_NOTBOL 0001 /* BOS is not BOL */
|
125
|
+
#define REG_NOTEOL 0002 /* EOS is not EOL */
|
126
|
+
#define REG_STARTEND 0004 /* backward compatibility kludge */
|
127
|
+
#define REG_FTRACE 0010 /* none of your business */
|
128
|
+
#define REG_MTRACE 0020 /* none of your business */
|
129
|
+
#define REG_SMALL 0040 /* none of your business */
|
130
|
+
|
131
|
+
|
132
|
+
/*
|
133
|
+
* error reporting
|
134
|
+
* Be careful if modifying the list of error codes -- the table used by
|
135
|
+
* regerror() is generated automatically from this file!
|
136
|
+
*/
|
137
|
+
#define REG_OKAY 0 /* no errors detected */
|
138
|
+
#define REG_NOMATCH 1 /* failed to match */
|
139
|
+
#define REG_BADPAT 2 /* invalid regexp */
|
140
|
+
#define REG_ECOLLATE 3 /* invalid collating element */
|
141
|
+
#define REG_ECTYPE 4 /* invalid character class */
|
142
|
+
#define REG_EESCAPE 5 /* invalid escape \ sequence */
|
143
|
+
#define REG_ESUBREG 6 /* invalid backreference number */
|
144
|
+
#define REG_EBRACK 7 /* brackets [] not balanced */
|
145
|
+
#define REG_EPAREN 8 /* parentheses () not balanced */
|
146
|
+
#define REG_EBRACE 9 /* braces {} not balanced */
|
147
|
+
#define REG_BADBR 10 /* invalid repetition count(s) */
|
148
|
+
#define REG_ERANGE 11 /* invalid character range */
|
149
|
+
#define REG_ESPACE 12 /* out of memory */
|
150
|
+
#define REG_BADRPT 13 /* quantifier operand invalid */
|
151
|
+
#define REG_ASSERT 15 /* "can't happen" -- you found a bug */
|
152
|
+
#define REG_INVARG 16 /* invalid argument to regex function */
|
153
|
+
#define REG_MIXED 17 /* character widths of regex and string differ */
|
154
|
+
#define REG_BADOPT 18 /* invalid embedded option */
|
155
|
+
#define REG_ETOOBIG 19 /* regular expression is too complex */
|
156
|
+
#define REG_ECOLORS 20 /* too many colors */
|
157
|
+
#define REG_CANCEL 21 /* operation cancelled */
|
158
|
+
/* two specials for debugging and testing */
|
159
|
+
#define REG_ATOI 101 /* convert error-code name to number */
|
160
|
+
#define REG_ITOA 102 /* convert error-code number to name */
|
161
|
+
/* non-error result codes for pg_regprefix */
|
162
|
+
#define REG_PREFIX (-1) /* identified a common prefix */
|
163
|
+
#define REG_EXACT (-2) /* identified an exact match */
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
/*
|
168
|
+
* the prototypes for exported functions
|
169
|
+
*/
|
170
|
+
|
171
|
+
/* regcomp.c */
|
172
|
+
extern int pg_regcomp(regex_t *, const pg_wchar *, size_t, int, Oid);
|
173
|
+
extern int pg_regexec(regex_t *, const pg_wchar *, size_t, size_t, rm_detail_t *, size_t, regmatch_t[], int);
|
174
|
+
extern int pg_regprefix(regex_t *, pg_wchar **, size_t *);
|
175
|
+
extern void pg_regfree(regex_t *);
|
176
|
+
extern size_t pg_regerror(int, const regex_t *, char *, size_t);
|
177
|
+
|
178
|
+
/* regexp.c */
|
179
|
+
extern regex_t *RE_compile_and_cache(text *text_re, int cflags, Oid collation);
|
180
|
+
extern bool RE_compile_and_execute(text *text_re, char *dat, int dat_len,
|
181
|
+
int cflags, Oid collation,
|
182
|
+
int nmatch, regmatch_t *pmatch);
|
183
|
+
|
184
|
+
#endif /* _REGEX_H_ */
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* logicallauncher.h
|
4
|
+
* Exports for logical replication launcher.
|
5
|
+
*
|
6
|
+
* Portions Copyright (c) 2016-2020, PostgreSQL Global Development Group
|
7
|
+
*
|
8
|
+
* src/include/replication/logicallauncher.h
|
9
|
+
*
|
10
|
+
*-------------------------------------------------------------------------
|
11
|
+
*/
|
12
|
+
#ifndef LOGICALLAUNCHER_H
|
13
|
+
#define LOGICALLAUNCHER_H
|
14
|
+
|
15
|
+
extern int max_logical_replication_workers;
|
16
|
+
extern int max_sync_workers_per_subscription;
|
17
|
+
|
18
|
+
extern void ApplyLauncherRegister(void);
|
19
|
+
extern void ApplyLauncherMain(Datum main_arg);
|
20
|
+
|
21
|
+
extern Size ApplyLauncherShmemSize(void);
|
22
|
+
extern void ApplyLauncherShmemInit(void);
|
23
|
+
|
24
|
+
extern void ApplyLauncherWakeupAtCommit(void);
|
25
|
+
extern bool XactManipulatesLogicalReplicationWorkers(void);
|
26
|
+
extern void AtEOXact_ApplyLauncher(bool isCommit);
|
27
|
+
extern void AtEOSubXact_ApplyLauncher(bool isCommit, int nestDepth);
|
28
|
+
|
29
|
+
extern bool IsLogicalLauncher(void);
|
30
|
+
|
31
|
+
#endif /* LOGICALLAUNCHER_H */
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* logicalproto.h
|
4
|
+
* logical replication protocol
|
5
|
+
*
|
6
|
+
* Copyright (c) 2015-2020, PostgreSQL Global Development Group
|
7
|
+
*
|
8
|
+
* IDENTIFICATION
|
9
|
+
* src/include/replication/logicalproto.h
|
10
|
+
*
|
11
|
+
*-------------------------------------------------------------------------
|
12
|
+
*/
|
13
|
+
#ifndef LOGICAL_PROTO_H
|
14
|
+
#define LOGICAL_PROTO_H
|
15
|
+
|
16
|
+
#include "replication/reorderbuffer.h"
|
17
|
+
#include "utils/rel.h"
|
18
|
+
|
19
|
+
/*
|
20
|
+
* Protocol capabilities
|
21
|
+
*
|
22
|
+
* LOGICALREP_PROTO_VERSION_NUM is our native protocol and the greatest version
|
23
|
+
* we can support. LOGICALREP_PROTO_MIN_VERSION_NUM is the oldest version we
|
24
|
+
* have backwards compatibility for. The client requests protocol version at
|
25
|
+
* connect time.
|
26
|
+
*/
|
27
|
+
#define LOGICALREP_PROTO_MIN_VERSION_NUM 1
|
28
|
+
#define LOGICALREP_PROTO_VERSION_NUM 1
|
29
|
+
|
30
|
+
/* Tuple coming via logical replication. */
|
31
|
+
typedef struct LogicalRepTupleData
|
32
|
+
{
|
33
|
+
/* column values in text format, or NULL for a null value: */
|
34
|
+
char *values[MaxTupleAttributeNumber];
|
35
|
+
/* markers for changed/unchanged column values: */
|
36
|
+
bool changed[MaxTupleAttributeNumber];
|
37
|
+
} LogicalRepTupleData;
|
38
|
+
|
39
|
+
typedef uint32 LogicalRepRelId;
|
40
|
+
|
41
|
+
/* Relation information */
|
42
|
+
typedef struct LogicalRepRelation
|
43
|
+
{
|
44
|
+
/* Info coming from the remote side. */
|
45
|
+
LogicalRepRelId remoteid; /* unique id of the relation */
|
46
|
+
char *nspname; /* schema name */
|
47
|
+
char *relname; /* relation name */
|
48
|
+
int natts; /* number of columns */
|
49
|
+
char **attnames; /* column names */
|
50
|
+
Oid *atttyps; /* column types */
|
51
|
+
char replident; /* replica identity */
|
52
|
+
char relkind; /* remote relation kind */
|
53
|
+
Bitmapset *attkeys; /* Bitmap of key columns */
|
54
|
+
} LogicalRepRelation;
|
55
|
+
|
56
|
+
/* Type mapping info */
|
57
|
+
typedef struct LogicalRepTyp
|
58
|
+
{
|
59
|
+
Oid remoteid; /* unique id of the remote type */
|
60
|
+
char *nspname; /* schema name of remote type */
|
61
|
+
char *typname; /* name of the remote type */
|
62
|
+
} LogicalRepTyp;
|
63
|
+
|
64
|
+
/* Transaction info */
|
65
|
+
typedef struct LogicalRepBeginData
|
66
|
+
{
|
67
|
+
XLogRecPtr final_lsn;
|
68
|
+
TimestampTz committime;
|
69
|
+
TransactionId xid;
|
70
|
+
} LogicalRepBeginData;
|
71
|
+
|
72
|
+
typedef struct LogicalRepCommitData
|
73
|
+
{
|
74
|
+
XLogRecPtr commit_lsn;
|
75
|
+
XLogRecPtr end_lsn;
|
76
|
+
TimestampTz committime;
|
77
|
+
} LogicalRepCommitData;
|
78
|
+
|
79
|
+
extern void logicalrep_write_begin(StringInfo out, ReorderBufferTXN *txn);
|
80
|
+
extern void logicalrep_read_begin(StringInfo in,
|
81
|
+
LogicalRepBeginData *begin_data);
|
82
|
+
extern void logicalrep_write_commit(StringInfo out, ReorderBufferTXN *txn,
|
83
|
+
XLogRecPtr commit_lsn);
|
84
|
+
extern void logicalrep_read_commit(StringInfo in,
|
85
|
+
LogicalRepCommitData *commit_data);
|
86
|
+
extern void logicalrep_write_origin(StringInfo out, const char *origin,
|
87
|
+
XLogRecPtr origin_lsn);
|
88
|
+
extern char *logicalrep_read_origin(StringInfo in, XLogRecPtr *origin_lsn);
|
89
|
+
extern void logicalrep_write_insert(StringInfo out, Relation rel,
|
90
|
+
HeapTuple newtuple);
|
91
|
+
extern LogicalRepRelId logicalrep_read_insert(StringInfo in, LogicalRepTupleData *newtup);
|
92
|
+
extern void logicalrep_write_update(StringInfo out, Relation rel, HeapTuple oldtuple,
|
93
|
+
HeapTuple newtuple);
|
94
|
+
extern LogicalRepRelId logicalrep_read_update(StringInfo in,
|
95
|
+
bool *has_oldtuple, LogicalRepTupleData *oldtup,
|
96
|
+
LogicalRepTupleData *newtup);
|
97
|
+
extern void logicalrep_write_delete(StringInfo out, Relation rel,
|
98
|
+
HeapTuple oldtuple);
|
99
|
+
extern LogicalRepRelId logicalrep_read_delete(StringInfo in,
|
100
|
+
LogicalRepTupleData *oldtup);
|
101
|
+
extern void logicalrep_write_truncate(StringInfo out, int nrelids, Oid relids[],
|
102
|
+
bool cascade, bool restart_seqs);
|
103
|
+
extern List *logicalrep_read_truncate(StringInfo in,
|
104
|
+
bool *cascade, bool *restart_seqs);
|
105
|
+
extern void logicalrep_write_rel(StringInfo out, Relation rel);
|
106
|
+
extern LogicalRepRelation *logicalrep_read_rel(StringInfo in);
|
107
|
+
extern void logicalrep_write_typ(StringInfo out, Oid typoid);
|
108
|
+
extern void logicalrep_read_typ(StringInfo out, LogicalRepTyp *ltyp);
|
109
|
+
|
110
|
+
#endif /* LOGICAL_PROTO_H */
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* logicalworker.h
|
4
|
+
* Exports for logical replication workers.
|
5
|
+
*
|
6
|
+
* Portions Copyright (c) 2016-2020, PostgreSQL Global Development Group
|
7
|
+
*
|
8
|
+
* src/include/replication/logicalworker.h
|
9
|
+
*
|
10
|
+
*-------------------------------------------------------------------------
|
11
|
+
*/
|
12
|
+
#ifndef LOGICALWORKER_H
|
13
|
+
#define LOGICALWORKER_H
|
14
|
+
|
15
|
+
extern void ApplyWorkerMain(Datum main_arg);
|
16
|
+
|
17
|
+
extern bool IsLogicalWorker(void);
|
18
|
+
|
19
|
+
#endif /* LOGICALWORKER_H */
|
@@ -0,0 +1,73 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
* origin.h
|
3
|
+
* Exports from replication/logical/origin.c
|
4
|
+
*
|
5
|
+
* Copyright (c) 2013-2020, PostgreSQL Global Development Group
|
6
|
+
*
|
7
|
+
* src/include/replication/origin.h
|
8
|
+
*-------------------------------------------------------------------------
|
9
|
+
*/
|
10
|
+
#ifndef PG_ORIGIN_H
|
11
|
+
#define PG_ORIGIN_H
|
12
|
+
|
13
|
+
#include "access/xlog.h"
|
14
|
+
#include "access/xlogdefs.h"
|
15
|
+
#include "access/xlogreader.h"
|
16
|
+
#include "catalog/pg_replication_origin.h"
|
17
|
+
|
18
|
+
typedef struct xl_replorigin_set
|
19
|
+
{
|
20
|
+
XLogRecPtr remote_lsn;
|
21
|
+
RepOriginId node_id;
|
22
|
+
bool force;
|
23
|
+
} xl_replorigin_set;
|
24
|
+
|
25
|
+
typedef struct xl_replorigin_drop
|
26
|
+
{
|
27
|
+
RepOriginId node_id;
|
28
|
+
} xl_replorigin_drop;
|
29
|
+
|
30
|
+
#define XLOG_REPLORIGIN_SET 0x00
|
31
|
+
#define XLOG_REPLORIGIN_DROP 0x10
|
32
|
+
|
33
|
+
#define InvalidRepOriginId 0
|
34
|
+
#define DoNotReplicateId PG_UINT16_MAX
|
35
|
+
|
36
|
+
extern PGDLLIMPORT RepOriginId replorigin_session_origin;
|
37
|
+
extern PGDLLIMPORT XLogRecPtr replorigin_session_origin_lsn;
|
38
|
+
extern PGDLLIMPORT TimestampTz replorigin_session_origin_timestamp;
|
39
|
+
|
40
|
+
/* API for querying & manipulating replication origins */
|
41
|
+
extern RepOriginId replorigin_by_name(char *name, bool missing_ok);
|
42
|
+
extern RepOriginId replorigin_create(char *name);
|
43
|
+
extern void replorigin_drop(RepOriginId roident, bool nowait);
|
44
|
+
extern bool replorigin_by_oid(RepOriginId roident, bool missing_ok,
|
45
|
+
char **roname);
|
46
|
+
|
47
|
+
/* API for querying & manipulating replication progress tracking */
|
48
|
+
extern void replorigin_advance(RepOriginId node,
|
49
|
+
XLogRecPtr remote_commit,
|
50
|
+
XLogRecPtr local_commit,
|
51
|
+
bool go_backward, bool wal_log);
|
52
|
+
extern XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush);
|
53
|
+
|
54
|
+
extern void replorigin_session_advance(XLogRecPtr remote_commit,
|
55
|
+
XLogRecPtr local_commit);
|
56
|
+
extern void replorigin_session_setup(RepOriginId node);
|
57
|
+
extern void replorigin_session_reset(void);
|
58
|
+
extern XLogRecPtr replorigin_session_get_progress(bool flush);
|
59
|
+
|
60
|
+
/* Checkpoint/Startup integration */
|
61
|
+
extern void CheckPointReplicationOrigin(void);
|
62
|
+
extern void StartupReplicationOrigin(void);
|
63
|
+
|
64
|
+
/* WAL logging */
|
65
|
+
void replorigin_redo(XLogReaderState *record);
|
66
|
+
void replorigin_desc(StringInfo buf, XLogReaderState *record);
|
67
|
+
const char *replorigin_identify(uint8 info);
|
68
|
+
|
69
|
+
/* shared memory allocation */
|
70
|
+
extern Size ReplicationOriginShmemSize(void);
|
71
|
+
extern void ReplicationOriginShmemInit(void);
|
72
|
+
|
73
|
+
#endif /* PG_ORIGIN_H */
|
@@ -0,0 +1,467 @@
|
|
1
|
+
/*
|
2
|
+
* reorderbuffer.h
|
3
|
+
* PostgreSQL logical replay/reorder buffer management.
|
4
|
+
*
|
5
|
+
* Copyright (c) 2012-2020, PostgreSQL Global Development Group
|
6
|
+
*
|
7
|
+
* src/include/replication/reorderbuffer.h
|
8
|
+
*/
|
9
|
+
#ifndef REORDERBUFFER_H
|
10
|
+
#define REORDERBUFFER_H
|
11
|
+
|
12
|
+
#include "access/htup_details.h"
|
13
|
+
#include "lib/ilist.h"
|
14
|
+
#include "storage/sinval.h"
|
15
|
+
#include "utils/hsearch.h"
|
16
|
+
#include "utils/relcache.h"
|
17
|
+
#include "utils/snapshot.h"
|
18
|
+
#include "utils/timestamp.h"
|
19
|
+
|
20
|
+
extern PGDLLIMPORT int logical_decoding_work_mem;
|
21
|
+
|
22
|
+
/* an individual tuple, stored in one chunk of memory */
|
23
|
+
typedef struct ReorderBufferTupleBuf
|
24
|
+
{
|
25
|
+
/* position in preallocated list */
|
26
|
+
slist_node node;
|
27
|
+
|
28
|
+
/* tuple header, the interesting bit for users of logical decoding */
|
29
|
+
HeapTupleData tuple;
|
30
|
+
|
31
|
+
/* pre-allocated size of tuple buffer, different from tuple size */
|
32
|
+
Size alloc_tuple_size;
|
33
|
+
|
34
|
+
/* actual tuple data follows */
|
35
|
+
} ReorderBufferTupleBuf;
|
36
|
+
|
37
|
+
/* pointer to the data stored in a TupleBuf */
|
38
|
+
#define ReorderBufferTupleBufData(p) \
|
39
|
+
((HeapTupleHeader) MAXALIGN(((char *) p) + sizeof(ReorderBufferTupleBuf)))
|
40
|
+
|
41
|
+
/*
|
42
|
+
* Types of the change passed to a 'change' callback.
|
43
|
+
*
|
44
|
+
* For efficiency and simplicity reasons we want to keep Snapshots, CommandIds
|
45
|
+
* and ComboCids in the same list with the user visible INSERT/UPDATE/DELETE
|
46
|
+
* changes. Users of the decoding facilities will never see changes with
|
47
|
+
* *_INTERNAL_* actions.
|
48
|
+
*
|
49
|
+
* The INTERNAL_SPEC_INSERT and INTERNAL_SPEC_CONFIRM changes concern
|
50
|
+
* "speculative insertions", and their confirmation respectively. They're
|
51
|
+
* used by INSERT .. ON CONFLICT .. UPDATE. Users of logical decoding don't
|
52
|
+
* have to care about these.
|
53
|
+
*/
|
54
|
+
enum ReorderBufferChangeType
|
55
|
+
{
|
56
|
+
REORDER_BUFFER_CHANGE_INSERT,
|
57
|
+
REORDER_BUFFER_CHANGE_UPDATE,
|
58
|
+
REORDER_BUFFER_CHANGE_DELETE,
|
59
|
+
REORDER_BUFFER_CHANGE_MESSAGE,
|
60
|
+
REORDER_BUFFER_CHANGE_INTERNAL_SNAPSHOT,
|
61
|
+
REORDER_BUFFER_CHANGE_INTERNAL_COMMAND_ID,
|
62
|
+
REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID,
|
63
|
+
REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT,
|
64
|
+
REORDER_BUFFER_CHANGE_INTERNAL_SPEC_CONFIRM,
|
65
|
+
REORDER_BUFFER_CHANGE_TRUNCATE
|
66
|
+
};
|
67
|
+
|
68
|
+
/* forward declaration */
|
69
|
+
struct ReorderBufferTXN;
|
70
|
+
|
71
|
+
/*
|
72
|
+
* a single 'change', can be an insert (with one tuple), an update (old, new),
|
73
|
+
* or a delete (old).
|
74
|
+
*
|
75
|
+
* The same struct is also used internally for other purposes but that should
|
76
|
+
* never be visible outside reorderbuffer.c.
|
77
|
+
*/
|
78
|
+
typedef struct ReorderBufferChange
|
79
|
+
{
|
80
|
+
XLogRecPtr lsn;
|
81
|
+
|
82
|
+
/* The type of change. */
|
83
|
+
enum ReorderBufferChangeType action;
|
84
|
+
|
85
|
+
/* Transaction this change belongs to. */
|
86
|
+
struct ReorderBufferTXN *txn;
|
87
|
+
|
88
|
+
RepOriginId origin_id;
|
89
|
+
|
90
|
+
/*
|
91
|
+
* Context data for the change. Which part of the union is valid depends
|
92
|
+
* on action.
|
93
|
+
*/
|
94
|
+
union
|
95
|
+
{
|
96
|
+
/* Old, new tuples when action == *_INSERT|UPDATE|DELETE */
|
97
|
+
struct
|
98
|
+
{
|
99
|
+
/* relation that has been changed */
|
100
|
+
RelFileNode relnode;
|
101
|
+
|
102
|
+
/* no previously reassembled toast chunks are necessary anymore */
|
103
|
+
bool clear_toast_afterwards;
|
104
|
+
|
105
|
+
/* valid for DELETE || UPDATE */
|
106
|
+
ReorderBufferTupleBuf *oldtuple;
|
107
|
+
/* valid for INSERT || UPDATE */
|
108
|
+
ReorderBufferTupleBuf *newtuple;
|
109
|
+
} tp;
|
110
|
+
|
111
|
+
/*
|
112
|
+
* Truncate data for REORDER_BUFFER_CHANGE_TRUNCATE representing one
|
113
|
+
* set of relations to be truncated.
|
114
|
+
*/
|
115
|
+
struct
|
116
|
+
{
|
117
|
+
Size nrelids;
|
118
|
+
bool cascade;
|
119
|
+
bool restart_seqs;
|
120
|
+
Oid *relids;
|
121
|
+
} truncate;
|
122
|
+
|
123
|
+
/* Message with arbitrary data. */
|
124
|
+
struct
|
125
|
+
{
|
126
|
+
char *prefix;
|
127
|
+
Size message_size;
|
128
|
+
char *message;
|
129
|
+
} msg;
|
130
|
+
|
131
|
+
/* New snapshot, set when action == *_INTERNAL_SNAPSHOT */
|
132
|
+
Snapshot snapshot;
|
133
|
+
|
134
|
+
/*
|
135
|
+
* New command id for existing snapshot in a catalog changing tx. Set
|
136
|
+
* when action == *_INTERNAL_COMMAND_ID.
|
137
|
+
*/
|
138
|
+
CommandId command_id;
|
139
|
+
|
140
|
+
/*
|
141
|
+
* New cid mapping for catalog changing transaction, set when action
|
142
|
+
* == *_INTERNAL_TUPLECID.
|
143
|
+
*/
|
144
|
+
struct
|
145
|
+
{
|
146
|
+
RelFileNode node;
|
147
|
+
ItemPointerData tid;
|
148
|
+
CommandId cmin;
|
149
|
+
CommandId cmax;
|
150
|
+
CommandId combocid;
|
151
|
+
} tuplecid;
|
152
|
+
} data;
|
153
|
+
|
154
|
+
/*
|
155
|
+
* While in use this is how a change is linked into a transactions,
|
156
|
+
* otherwise it's the preallocated list.
|
157
|
+
*/
|
158
|
+
dlist_node node;
|
159
|
+
} ReorderBufferChange;
|
160
|
+
|
161
|
+
/* ReorderBufferTXN txn_flags */
|
162
|
+
#define RBTXN_HAS_CATALOG_CHANGES 0x0001
|
163
|
+
#define RBTXN_IS_SUBXACT 0x0002
|
164
|
+
#define RBTXN_IS_SERIALIZED 0x0004
|
165
|
+
|
166
|
+
/* Does the transaction have catalog changes? */
|
167
|
+
#define rbtxn_has_catalog_changes(txn) \
|
168
|
+
( \
|
169
|
+
((txn)->txn_flags & RBTXN_HAS_CATALOG_CHANGES) != 0 \
|
170
|
+
)
|
171
|
+
|
172
|
+
/* Is the transaction known as a subxact? */
|
173
|
+
#define rbtxn_is_known_subxact(txn) \
|
174
|
+
( \
|
175
|
+
((txn)->txn_flags & RBTXN_IS_SUBXACT) != 0 \
|
176
|
+
)
|
177
|
+
|
178
|
+
/* Has this transaction been spilled to disk? */
|
179
|
+
#define rbtxn_is_serialized(txn) \
|
180
|
+
( \
|
181
|
+
((txn)->txn_flags & RBTXN_IS_SERIALIZED) != 0 \
|
182
|
+
)
|
183
|
+
|
184
|
+
typedef struct ReorderBufferTXN
|
185
|
+
{
|
186
|
+
/* See above */
|
187
|
+
bits32 txn_flags;
|
188
|
+
|
189
|
+
/* The transaction's transaction id, can be a toplevel or sub xid. */
|
190
|
+
TransactionId xid;
|
191
|
+
|
192
|
+
/* Xid of top-level transaction, if known */
|
193
|
+
TransactionId toplevel_xid;
|
194
|
+
|
195
|
+
/*
|
196
|
+
* LSN of the first data carrying, WAL record with knowledge about this
|
197
|
+
* xid. This is allowed to *not* be first record adorned with this xid, if
|
198
|
+
* the previous records aren't relevant for logical decoding.
|
199
|
+
*/
|
200
|
+
XLogRecPtr first_lsn;
|
201
|
+
|
202
|
+
/* ----
|
203
|
+
* LSN of the record that lead to this xact to be committed or
|
204
|
+
* aborted. This can be a
|
205
|
+
* * plain commit record
|
206
|
+
* * plain commit record, of a parent transaction
|
207
|
+
* * prepared transaction commit
|
208
|
+
* * plain abort record
|
209
|
+
* * prepared transaction abort
|
210
|
+
*
|
211
|
+
* This can also become set to earlier values than transaction end when
|
212
|
+
* a transaction is spilled to disk; specifically it's set to the LSN of
|
213
|
+
* the latest change written to disk so far.
|
214
|
+
* ----
|
215
|
+
*/
|
216
|
+
XLogRecPtr final_lsn;
|
217
|
+
|
218
|
+
/*
|
219
|
+
* LSN pointing to the end of the commit record + 1.
|
220
|
+
*/
|
221
|
+
XLogRecPtr end_lsn;
|
222
|
+
|
223
|
+
/*
|
224
|
+
* LSN of the last lsn at which snapshot information reside, so we can
|
225
|
+
* restart decoding from there and fully recover this transaction from
|
226
|
+
* WAL.
|
227
|
+
*/
|
228
|
+
XLogRecPtr restart_decoding_lsn;
|
229
|
+
|
230
|
+
/* origin of the change that caused this transaction */
|
231
|
+
RepOriginId origin_id;
|
232
|
+
XLogRecPtr origin_lsn;
|
233
|
+
|
234
|
+
/*
|
235
|
+
* Commit time, only known when we read the actual commit record.
|
236
|
+
*/
|
237
|
+
TimestampTz commit_time;
|
238
|
+
|
239
|
+
/*
|
240
|
+
* The base snapshot is used to decode all changes until either this
|
241
|
+
* transaction modifies the catalog, or another catalog-modifying
|
242
|
+
* transaction commits.
|
243
|
+
*/
|
244
|
+
Snapshot base_snapshot;
|
245
|
+
XLogRecPtr base_snapshot_lsn;
|
246
|
+
dlist_node base_snapshot_node; /* link in txns_by_base_snapshot_lsn */
|
247
|
+
|
248
|
+
/*
|
249
|
+
* How many ReorderBufferChange's do we have in this txn.
|
250
|
+
*
|
251
|
+
* Changes in subtransactions are *not* included but tracked separately.
|
252
|
+
*/
|
253
|
+
uint64 nentries;
|
254
|
+
|
255
|
+
/*
|
256
|
+
* How many of the above entries are stored in memory in contrast to being
|
257
|
+
* spilled to disk.
|
258
|
+
*/
|
259
|
+
uint64 nentries_mem;
|
260
|
+
|
261
|
+
/*
|
262
|
+
* List of ReorderBufferChange structs, including new Snapshots and new
|
263
|
+
* CommandIds
|
264
|
+
*/
|
265
|
+
dlist_head changes;
|
266
|
+
|
267
|
+
/*
|
268
|
+
* List of (relation, ctid) => (cmin, cmax) mappings for catalog tuples.
|
269
|
+
* Those are always assigned to the toplevel transaction. (Keep track of
|
270
|
+
* #entries to create a hash of the right size)
|
271
|
+
*/
|
272
|
+
dlist_head tuplecids;
|
273
|
+
uint64 ntuplecids;
|
274
|
+
|
275
|
+
/*
|
276
|
+
* On-demand built hash for looking up the above values.
|
277
|
+
*/
|
278
|
+
HTAB *tuplecid_hash;
|
279
|
+
|
280
|
+
/*
|
281
|
+
* Hash containing (potentially partial) toast entries. NULL if no toast
|
282
|
+
* tuples have been found for the current change.
|
283
|
+
*/
|
284
|
+
HTAB *toast_hash;
|
285
|
+
|
286
|
+
/*
|
287
|
+
* non-hierarchical list of subtransactions that are *not* aborted. Only
|
288
|
+
* used in toplevel transactions.
|
289
|
+
*/
|
290
|
+
dlist_head subtxns;
|
291
|
+
uint32 nsubtxns;
|
292
|
+
|
293
|
+
/*
|
294
|
+
* Stored cache invalidations. This is not a linked list because we get
|
295
|
+
* all the invalidations at once.
|
296
|
+
*/
|
297
|
+
uint32 ninvalidations;
|
298
|
+
SharedInvalidationMessage *invalidations;
|
299
|
+
|
300
|
+
/* ---
|
301
|
+
* Position in one of three lists:
|
302
|
+
* * list of subtransactions if we are *known* to be subxact
|
303
|
+
* * list of toplevel xacts (can be an as-yet unknown subxact)
|
304
|
+
* * list of preallocated ReorderBufferTXNs (if unused)
|
305
|
+
* ---
|
306
|
+
*/
|
307
|
+
dlist_node node;
|
308
|
+
|
309
|
+
/*
|
310
|
+
* Size of this transaction (changes currently in memory, in bytes).
|
311
|
+
*/
|
312
|
+
Size size;
|
313
|
+
} ReorderBufferTXN;
|
314
|
+
|
315
|
+
/* so we can define the callbacks used inside struct ReorderBuffer itself */
|
316
|
+
typedef struct ReorderBuffer ReorderBuffer;
|
317
|
+
|
318
|
+
/* change callback signature */
|
319
|
+
typedef void (*ReorderBufferApplyChangeCB) (ReorderBuffer *rb,
|
320
|
+
ReorderBufferTXN *txn,
|
321
|
+
Relation relation,
|
322
|
+
ReorderBufferChange *change);
|
323
|
+
|
324
|
+
/* truncate callback signature */
|
325
|
+
typedef void (*ReorderBufferApplyTruncateCB) (ReorderBuffer *rb,
|
326
|
+
ReorderBufferTXN *txn,
|
327
|
+
int nrelations,
|
328
|
+
Relation relations[],
|
329
|
+
ReorderBufferChange *change);
|
330
|
+
|
331
|
+
/* begin callback signature */
|
332
|
+
typedef void (*ReorderBufferBeginCB) (ReorderBuffer *rb,
|
333
|
+
ReorderBufferTXN *txn);
|
334
|
+
|
335
|
+
/* commit callback signature */
|
336
|
+
typedef void (*ReorderBufferCommitCB) (ReorderBuffer *rb,
|
337
|
+
ReorderBufferTXN *txn,
|
338
|
+
XLogRecPtr commit_lsn);
|
339
|
+
|
340
|
+
/* message callback signature */
|
341
|
+
typedef void (*ReorderBufferMessageCB) (ReorderBuffer *rb,
|
342
|
+
ReorderBufferTXN *txn,
|
343
|
+
XLogRecPtr message_lsn,
|
344
|
+
bool transactional,
|
345
|
+
const char *prefix, Size sz,
|
346
|
+
const char *message);
|
347
|
+
|
348
|
+
struct ReorderBuffer
|
349
|
+
{
|
350
|
+
/*
|
351
|
+
* xid => ReorderBufferTXN lookup table
|
352
|
+
*/
|
353
|
+
HTAB *by_txn;
|
354
|
+
|
355
|
+
/*
|
356
|
+
* Transactions that could be a toplevel xact, ordered by LSN of the first
|
357
|
+
* record bearing that xid.
|
358
|
+
*/
|
359
|
+
dlist_head toplevel_by_lsn;
|
360
|
+
|
361
|
+
/*
|
362
|
+
* Transactions and subtransactions that have a base snapshot, ordered by
|
363
|
+
* LSN of the record which caused us to first obtain the base snapshot.
|
364
|
+
* This is not the same as toplevel_by_lsn, because we only set the base
|
365
|
+
* snapshot on the first logical-decoding-relevant record (eg. heap
|
366
|
+
* writes), whereas the initial LSN could be set by other operations.
|
367
|
+
*/
|
368
|
+
dlist_head txns_by_base_snapshot_lsn;
|
369
|
+
|
370
|
+
/*
|
371
|
+
* one-entry sized cache for by_txn. Very frequently the same txn gets
|
372
|
+
* looked up over and over again.
|
373
|
+
*/
|
374
|
+
TransactionId by_txn_last_xid;
|
375
|
+
ReorderBufferTXN *by_txn_last_txn;
|
376
|
+
|
377
|
+
/*
|
378
|
+
* Callbacks to be called when a transactions commits.
|
379
|
+
*/
|
380
|
+
ReorderBufferBeginCB begin;
|
381
|
+
ReorderBufferApplyChangeCB apply_change;
|
382
|
+
ReorderBufferApplyTruncateCB apply_truncate;
|
383
|
+
ReorderBufferCommitCB commit;
|
384
|
+
ReorderBufferMessageCB message;
|
385
|
+
|
386
|
+
/*
|
387
|
+
* Pointer that will be passed untouched to the callbacks.
|
388
|
+
*/
|
389
|
+
void *private_data;
|
390
|
+
|
391
|
+
/*
|
392
|
+
* Saved output plugin option
|
393
|
+
*/
|
394
|
+
bool output_rewrites;
|
395
|
+
|
396
|
+
/*
|
397
|
+
* Private memory context.
|
398
|
+
*/
|
399
|
+
MemoryContext context;
|
400
|
+
|
401
|
+
/*
|
402
|
+
* Memory contexts for specific types objects
|
403
|
+
*/
|
404
|
+
MemoryContext change_context;
|
405
|
+
MemoryContext txn_context;
|
406
|
+
MemoryContext tup_context;
|
407
|
+
|
408
|
+
XLogRecPtr current_restart_decoding_lsn;
|
409
|
+
|
410
|
+
/* buffer for disk<->memory conversions */
|
411
|
+
char *outbuf;
|
412
|
+
Size outbufsize;
|
413
|
+
|
414
|
+
/* memory accounting */
|
415
|
+
Size size;
|
416
|
+
};
|
417
|
+
|
418
|
+
|
419
|
+
ReorderBuffer *ReorderBufferAllocate(void);
|
420
|
+
void ReorderBufferFree(ReorderBuffer *);
|
421
|
+
|
422
|
+
ReorderBufferTupleBuf *ReorderBufferGetTupleBuf(ReorderBuffer *, Size tuple_len);
|
423
|
+
void ReorderBufferReturnTupleBuf(ReorderBuffer *, ReorderBufferTupleBuf *tuple);
|
424
|
+
ReorderBufferChange *ReorderBufferGetChange(ReorderBuffer *);
|
425
|
+
void ReorderBufferReturnChange(ReorderBuffer *, ReorderBufferChange *);
|
426
|
+
|
427
|
+
Oid *ReorderBufferGetRelids(ReorderBuffer *, int nrelids);
|
428
|
+
void ReorderBufferReturnRelids(ReorderBuffer *, Oid *relids);
|
429
|
+
|
430
|
+
void ReorderBufferQueueChange(ReorderBuffer *, TransactionId, XLogRecPtr lsn, ReorderBufferChange *);
|
431
|
+
void ReorderBufferQueueMessage(ReorderBuffer *, TransactionId, Snapshot snapshot, XLogRecPtr lsn,
|
432
|
+
bool transactional, const char *prefix,
|
433
|
+
Size message_size, const char *message);
|
434
|
+
void ReorderBufferCommit(ReorderBuffer *, TransactionId,
|
435
|
+
XLogRecPtr commit_lsn, XLogRecPtr end_lsn,
|
436
|
+
TimestampTz commit_time, RepOriginId origin_id, XLogRecPtr origin_lsn);
|
437
|
+
void ReorderBufferAssignChild(ReorderBuffer *, TransactionId, TransactionId, XLogRecPtr commit_lsn);
|
438
|
+
void ReorderBufferCommitChild(ReorderBuffer *, TransactionId, TransactionId,
|
439
|
+
XLogRecPtr commit_lsn, XLogRecPtr end_lsn);
|
440
|
+
void ReorderBufferAbort(ReorderBuffer *, TransactionId, XLogRecPtr lsn);
|
441
|
+
void ReorderBufferAbortOld(ReorderBuffer *, TransactionId xid);
|
442
|
+
void ReorderBufferForget(ReorderBuffer *, TransactionId, XLogRecPtr lsn);
|
443
|
+
|
444
|
+
void ReorderBufferSetBaseSnapshot(ReorderBuffer *, TransactionId, XLogRecPtr lsn, struct SnapshotData *snap);
|
445
|
+
void ReorderBufferAddSnapshot(ReorderBuffer *, TransactionId, XLogRecPtr lsn, struct SnapshotData *snap);
|
446
|
+
void ReorderBufferAddNewCommandId(ReorderBuffer *, TransactionId, XLogRecPtr lsn,
|
447
|
+
CommandId cid);
|
448
|
+
void ReorderBufferAddNewTupleCids(ReorderBuffer *, TransactionId, XLogRecPtr lsn,
|
449
|
+
RelFileNode node, ItemPointerData pt,
|
450
|
+
CommandId cmin, CommandId cmax, CommandId combocid);
|
451
|
+
void ReorderBufferAddInvalidations(ReorderBuffer *, TransactionId, XLogRecPtr lsn,
|
452
|
+
Size nmsgs, SharedInvalidationMessage *msgs);
|
453
|
+
void ReorderBufferImmediateInvalidation(ReorderBuffer *, uint32 ninvalidations,
|
454
|
+
SharedInvalidationMessage *invalidations);
|
455
|
+
void ReorderBufferProcessXid(ReorderBuffer *, TransactionId xid, XLogRecPtr lsn);
|
456
|
+
void ReorderBufferXidSetCatalogChanges(ReorderBuffer *, TransactionId xid, XLogRecPtr lsn);
|
457
|
+
bool ReorderBufferXidHasCatalogChanges(ReorderBuffer *, TransactionId xid);
|
458
|
+
bool ReorderBufferXidHasBaseSnapshot(ReorderBuffer *, TransactionId xid);
|
459
|
+
|
460
|
+
ReorderBufferTXN *ReorderBufferGetOldestTXN(ReorderBuffer *);
|
461
|
+
TransactionId ReorderBufferGetOldestXmin(ReorderBuffer *rb);
|
462
|
+
|
463
|
+
void ReorderBufferSetRestartPoint(ReorderBuffer *, XLogRecPtr ptr);
|
464
|
+
|
465
|
+
void StartupReorderBuffer(void);
|
466
|
+
|
467
|
+
#endif
|