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,127 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* builtins.h
|
4
|
+
* Declarations for operations on built-in types.
|
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/utils/builtins.h
|
11
|
+
*
|
12
|
+
*-------------------------------------------------------------------------
|
13
|
+
*/
|
14
|
+
#ifndef BUILTINS_H
|
15
|
+
#define BUILTINS_H
|
16
|
+
|
17
|
+
#include "fmgr.h"
|
18
|
+
#include "nodes/nodes.h"
|
19
|
+
#include "utils/fmgrprotos.h"
|
20
|
+
|
21
|
+
/* Sign + the most decimal digits an 8-byte number could have */
|
22
|
+
#define MAXINT8LEN 20
|
23
|
+
|
24
|
+
/* bool.c */
|
25
|
+
extern bool parse_bool(const char *value, bool *result);
|
26
|
+
extern bool parse_bool_with_len(const char *value, size_t len, bool *result);
|
27
|
+
|
28
|
+
/* domains.c */
|
29
|
+
extern void domain_check(Datum value, bool isnull, Oid domainType,
|
30
|
+
void **extra, MemoryContext mcxt);
|
31
|
+
extern int errdatatype(Oid datatypeOid);
|
32
|
+
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
|
33
|
+
|
34
|
+
/* encode.c */
|
35
|
+
extern uint64 hex_encode(const char *src, size_t len, char *dst);
|
36
|
+
extern uint64 hex_decode(const char *src, size_t len, char *dst);
|
37
|
+
|
38
|
+
/* int.c */
|
39
|
+
extern int2vector *buildint2vector(const int16 *int2s, int n);
|
40
|
+
|
41
|
+
/* name.c */
|
42
|
+
extern int namecpy(Name n1, const NameData *n2);
|
43
|
+
extern int namestrcpy(Name name, const char *str);
|
44
|
+
extern int namestrcmp(Name name, const char *str);
|
45
|
+
|
46
|
+
/* numutils.c */
|
47
|
+
extern int32 pg_atoi(const char *s, int size, int c);
|
48
|
+
extern int16 pg_strtoint16(const char *s);
|
49
|
+
extern int32 pg_strtoint32(const char *s);
|
50
|
+
extern void pg_itoa(int16 i, char *a);
|
51
|
+
extern int pg_ultoa_n(uint32 l, char *a);
|
52
|
+
extern int pg_ulltoa_n(uint64 l, char *a);
|
53
|
+
extern void pg_ltoa(int32 l, char *a);
|
54
|
+
extern void pg_lltoa(int64 ll, char *a);
|
55
|
+
extern char *pg_ultostr_zeropad(char *str, uint32 value, int32 minwidth);
|
56
|
+
extern char *pg_ultostr(char *str, uint32 value);
|
57
|
+
extern uint64 pg_strtouint64(const char *str, char **endptr, int base);
|
58
|
+
|
59
|
+
/* oid.c */
|
60
|
+
extern oidvector *buildoidvector(const Oid *oids, int n);
|
61
|
+
extern Oid oidparse(Node *node);
|
62
|
+
extern int oid_cmp(const void *p1, const void *p2);
|
63
|
+
|
64
|
+
/* regexp.c */
|
65
|
+
extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive,
|
66
|
+
Oid collation, bool *exact);
|
67
|
+
|
68
|
+
/* ruleutils.c */
|
69
|
+
extern __thread bool quote_all_identifiers;
|
70
|
+
extern const char *quote_identifier(const char *ident);
|
71
|
+
extern char *quote_qualified_identifier(const char *qualifier,
|
72
|
+
const char *ident);
|
73
|
+
extern void generate_operator_clause(fmStringInfo buf,
|
74
|
+
const char *leftop, Oid leftoptype,
|
75
|
+
Oid opoid,
|
76
|
+
const char *rightop, Oid rightoptype);
|
77
|
+
|
78
|
+
/* varchar.c */
|
79
|
+
extern int bpchartruelen(char *s, int len);
|
80
|
+
|
81
|
+
/* popular functions from varlena.c */
|
82
|
+
extern text *cstring_to_text(const char *s);
|
83
|
+
extern text *cstring_to_text_with_len(const char *s, int len);
|
84
|
+
extern char *text_to_cstring(const text *t);
|
85
|
+
extern void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len);
|
86
|
+
|
87
|
+
#define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s))
|
88
|
+
#define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d))
|
89
|
+
|
90
|
+
/* xid.c */
|
91
|
+
extern int xidComparator(const void *arg1, const void *arg2);
|
92
|
+
|
93
|
+
/* inet_cidr_ntop.c */
|
94
|
+
extern char *pg_inet_cidr_ntop(int af, const void *src, int bits,
|
95
|
+
char *dst, size_t size);
|
96
|
+
|
97
|
+
/* inet_net_pton.c */
|
98
|
+
extern int pg_inet_net_pton(int af, const char *src,
|
99
|
+
void *dst, size_t size);
|
100
|
+
|
101
|
+
/* network.c */
|
102
|
+
extern double convert_network_to_scalar(Datum value, Oid typid, bool *failure);
|
103
|
+
extern Datum network_scan_first(Datum in);
|
104
|
+
extern Datum network_scan_last(Datum in);
|
105
|
+
extern void clean_ipv6_addr(int addr_family, char *addr);
|
106
|
+
|
107
|
+
/* numeric.c */
|
108
|
+
extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS);
|
109
|
+
|
110
|
+
/* format_type.c */
|
111
|
+
|
112
|
+
/* Control flags for format_type_extended */
|
113
|
+
#define FORMAT_TYPE_TYPEMOD_GIVEN 0x01 /* typemod defined by caller */
|
114
|
+
#define FORMAT_TYPE_ALLOW_INVALID 0x02 /* allow invalid types */
|
115
|
+
#define FORMAT_TYPE_FORCE_QUALIFY 0x04 /* force qualification of type */
|
116
|
+
extern char *format_type_extended(Oid type_oid, int32 typemod, bits16 flags);
|
117
|
+
|
118
|
+
extern char *format_type_be(Oid type_oid);
|
119
|
+
extern char *format_type_be_qualified(Oid type_oid);
|
120
|
+
extern char *format_type_with_typemod(Oid type_oid, int32 typemod);
|
121
|
+
|
122
|
+
extern int32 type_maximum_size(Oid type_oid, int32 typemod);
|
123
|
+
|
124
|
+
/* quote.c */
|
125
|
+
extern char *quote_literal_cstr(const char *rawstr);
|
126
|
+
|
127
|
+
#endif /* BUILTINS_H */
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* bytea.h
|
4
|
+
* Declarations for BYTEA data type support.
|
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/utils/bytea.h
|
11
|
+
*
|
12
|
+
*-------------------------------------------------------------------------
|
13
|
+
*/
|
14
|
+
#ifndef BYTEA_H
|
15
|
+
#define BYTEA_H
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
typedef enum
|
20
|
+
{
|
21
|
+
BYTEA_OUTPUT_ESCAPE,
|
22
|
+
BYTEA_OUTPUT_HEX
|
23
|
+
} ByteaOutputType;
|
24
|
+
|
25
|
+
extern int bytea_output; /* ByteaOutputType, but int for GUC enum */
|
26
|
+
|
27
|
+
#endif /* BYTEA_H */
|
@@ -0,0 +1,231 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* catcache.h
|
4
|
+
* Low-level catalog cache definitions.
|
5
|
+
*
|
6
|
+
* NOTE: every catalog cache must have a corresponding unique index on
|
7
|
+
* the system table that it caches --- ie, the index must match the keys
|
8
|
+
* used to do lookups in this cache. All cache fetches are done with
|
9
|
+
* indexscans (under normal conditions). The index should be unique to
|
10
|
+
* guarantee that there can only be one matching row for a key combination.
|
11
|
+
*
|
12
|
+
*
|
13
|
+
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
14
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
15
|
+
*
|
16
|
+
* src/include/utils/catcache.h
|
17
|
+
*
|
18
|
+
*-------------------------------------------------------------------------
|
19
|
+
*/
|
20
|
+
#ifndef CATCACHE_H
|
21
|
+
#define CATCACHE_H
|
22
|
+
|
23
|
+
#include "access/htup.h"
|
24
|
+
#include "access/skey.h"
|
25
|
+
#include "lib/ilist.h"
|
26
|
+
#include "utils/relcache.h"
|
27
|
+
|
28
|
+
/*
|
29
|
+
* struct catctup: individual tuple in the cache.
|
30
|
+
* struct catclist: list of tuples matching a partial key.
|
31
|
+
* struct catcache: information for managing a cache.
|
32
|
+
* struct catcacheheader: information for managing all the caches.
|
33
|
+
*/
|
34
|
+
|
35
|
+
#define CATCACHE_MAXKEYS 4
|
36
|
+
|
37
|
+
|
38
|
+
/* function computing a datum's hash */
|
39
|
+
typedef uint32 (*CCHashFN) (Datum datum);
|
40
|
+
|
41
|
+
/* function computing equality of two datums */
|
42
|
+
typedef bool (*CCFastEqualFN) (Datum a, Datum b);
|
43
|
+
|
44
|
+
typedef struct catcache
|
45
|
+
{
|
46
|
+
int id; /* cache identifier --- see syscache.h */
|
47
|
+
int cc_nbuckets; /* # of hash buckets in this cache */
|
48
|
+
TupleDesc cc_tupdesc; /* tuple descriptor (copied from reldesc) */
|
49
|
+
dlist_head *cc_bucket; /* hash buckets */
|
50
|
+
CCHashFN cc_hashfunc[CATCACHE_MAXKEYS]; /* hash function for each key */
|
51
|
+
CCFastEqualFN cc_fastequal[CATCACHE_MAXKEYS]; /* fast equal function for
|
52
|
+
* each key */
|
53
|
+
int cc_keyno[CATCACHE_MAXKEYS]; /* AttrNumber of each key */
|
54
|
+
dlist_head cc_lists; /* list of CatCList structs */
|
55
|
+
int cc_ntup; /* # of tuples currently in this cache */
|
56
|
+
int cc_nkeys; /* # of keys (1..CATCACHE_MAXKEYS) */
|
57
|
+
const char *cc_relname; /* name of relation the tuples come from */
|
58
|
+
Oid cc_reloid; /* OID of relation the tuples come from */
|
59
|
+
Oid cc_indexoid; /* OID of index matching cache keys */
|
60
|
+
bool cc_relisshared; /* is relation shared across databases? */
|
61
|
+
slist_node cc_next; /* list link */
|
62
|
+
ScanKeyData cc_skey[CATCACHE_MAXKEYS]; /* precomputed key info for heap
|
63
|
+
* scans */
|
64
|
+
|
65
|
+
/*
|
66
|
+
* Keep these at the end, so that compiling catcache.c with CATCACHE_STATS
|
67
|
+
* doesn't break ABI for other modules
|
68
|
+
*/
|
69
|
+
#ifdef CATCACHE_STATS
|
70
|
+
long cc_searches; /* total # searches against this cache */
|
71
|
+
long cc_hits; /* # of matches against existing entry */
|
72
|
+
long cc_neg_hits; /* # of matches against negative entry */
|
73
|
+
long cc_newloads; /* # of successful loads of new entry */
|
74
|
+
|
75
|
+
/*
|
76
|
+
* cc_searches - (cc_hits + cc_neg_hits + cc_newloads) is number of failed
|
77
|
+
* searches, each of which will result in loading a negative entry
|
78
|
+
*/
|
79
|
+
long cc_invals; /* # of entries invalidated from cache */
|
80
|
+
long cc_lsearches; /* total # list-searches */
|
81
|
+
long cc_lhits; /* # of matches against existing lists */
|
82
|
+
#endif
|
83
|
+
} CatCache;
|
84
|
+
|
85
|
+
|
86
|
+
typedef struct catctup
|
87
|
+
{
|
88
|
+
int ct_magic; /* for identifying CatCTup entries */
|
89
|
+
#define CT_MAGIC 0x57261502
|
90
|
+
|
91
|
+
uint32 hash_value; /* hash value for this tuple's keys */
|
92
|
+
|
93
|
+
/*
|
94
|
+
* Lookup keys for the entry. By-reference datums point into the tuple for
|
95
|
+
* positive cache entries, and are separately allocated for negative ones.
|
96
|
+
*/
|
97
|
+
Datum keys[CATCACHE_MAXKEYS];
|
98
|
+
|
99
|
+
/*
|
100
|
+
* Each tuple in a cache is a member of a dlist that stores the elements
|
101
|
+
* of its hash bucket. We keep each dlist in LRU order to speed repeated
|
102
|
+
* lookups.
|
103
|
+
*/
|
104
|
+
dlist_node cache_elem; /* list member of per-bucket list */
|
105
|
+
|
106
|
+
/*
|
107
|
+
* A tuple marked "dead" must not be returned by subsequent searches.
|
108
|
+
* However, it won't be physically deleted from the cache until its
|
109
|
+
* refcount goes to zero. (If it's a member of a CatCList, the list's
|
110
|
+
* refcount must go to zero, too; also, remember to mark the list dead at
|
111
|
+
* the same time the tuple is marked.)
|
112
|
+
*
|
113
|
+
* A negative cache entry is an assertion that there is no tuple matching
|
114
|
+
* a particular key. This is just as useful as a normal entry so far as
|
115
|
+
* avoiding catalog searches is concerned. Management of positive and
|
116
|
+
* negative entries is identical.
|
117
|
+
*/
|
118
|
+
int refcount; /* number of active references */
|
119
|
+
bool dead; /* dead but not yet removed? */
|
120
|
+
bool negative; /* negative cache entry? */
|
121
|
+
HeapTupleData tuple; /* tuple management header */
|
122
|
+
|
123
|
+
/*
|
124
|
+
* The tuple may also be a member of at most one CatCList. (If a single
|
125
|
+
* catcache is list-searched with varying numbers of keys, we may have to
|
126
|
+
* make multiple entries for the same tuple because of this restriction.
|
127
|
+
* Currently, that's not expected to be common, so we accept the potential
|
128
|
+
* inefficiency.)
|
129
|
+
*/
|
130
|
+
struct catclist *c_list; /* containing CatCList, or NULL if none */
|
131
|
+
|
132
|
+
CatCache *my_cache; /* link to owning catcache */
|
133
|
+
/* properly aligned tuple data follows, unless a negative entry */
|
134
|
+
} CatCTup;
|
135
|
+
|
136
|
+
|
137
|
+
/*
|
138
|
+
* A CatCList describes the result of a partial search, ie, a search using
|
139
|
+
* only the first K key columns of an N-key cache. We store the keys used
|
140
|
+
* into the keys attribute to represent the stored key set. The CatCList
|
141
|
+
* object contains links to cache entries for all the table rows satisfying
|
142
|
+
* the partial key. (Note: none of these will be negative cache entries.)
|
143
|
+
*
|
144
|
+
* A CatCList is only a member of a per-cache list; we do not currently
|
145
|
+
* divide them into hash buckets.
|
146
|
+
*
|
147
|
+
* A list marked "dead" must not be returned by subsequent searches.
|
148
|
+
* However, it won't be physically deleted from the cache until its
|
149
|
+
* refcount goes to zero. (A list should be marked dead if any of its
|
150
|
+
* member entries are dead.)
|
151
|
+
*
|
152
|
+
* If "ordered" is true then the member tuples appear in the order of the
|
153
|
+
* cache's underlying index. This will be true in normal operation, but
|
154
|
+
* might not be true during bootstrap or recovery operations. (namespace.c
|
155
|
+
* is able to save some cycles when it is true.)
|
156
|
+
*/
|
157
|
+
typedef struct catclist
|
158
|
+
{
|
159
|
+
int cl_magic; /* for identifying CatCList entries */
|
160
|
+
#define CL_MAGIC 0x52765103
|
161
|
+
|
162
|
+
uint32 hash_value; /* hash value for lookup keys */
|
163
|
+
|
164
|
+
dlist_node cache_elem; /* list member of per-catcache list */
|
165
|
+
|
166
|
+
/*
|
167
|
+
* Lookup keys for the entry, with the first nkeys elements being valid.
|
168
|
+
* All by-reference are separately allocated.
|
169
|
+
*/
|
170
|
+
Datum keys[CATCACHE_MAXKEYS];
|
171
|
+
|
172
|
+
int refcount; /* number of active references */
|
173
|
+
bool dead; /* dead but not yet removed? */
|
174
|
+
bool ordered; /* members listed in index order? */
|
175
|
+
short nkeys; /* number of lookup keys specified */
|
176
|
+
int n_members; /* number of member tuples */
|
177
|
+
CatCache *my_cache; /* link to owning catcache */
|
178
|
+
CatCTup *members[FLEXIBLE_ARRAY_MEMBER]; /* members */
|
179
|
+
} CatCList;
|
180
|
+
|
181
|
+
|
182
|
+
typedef struct catcacheheader
|
183
|
+
{
|
184
|
+
slist_head ch_caches; /* head of list of CatCache structs */
|
185
|
+
int ch_ntup; /* # of tuples in all caches */
|
186
|
+
} CatCacheHeader;
|
187
|
+
|
188
|
+
|
189
|
+
/* this extern duplicates utils/memutils.h... */
|
190
|
+
extern PGDLLIMPORT MemoryContext CacheMemoryContext;
|
191
|
+
|
192
|
+
extern void CreateCacheMemoryContext(void);
|
193
|
+
|
194
|
+
extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid,
|
195
|
+
int nkeys, const int *key,
|
196
|
+
int nbuckets);
|
197
|
+
extern void InitCatCachePhase2(CatCache *cache, bool touch_index);
|
198
|
+
|
199
|
+
extern HeapTuple SearchCatCache(CatCache *cache,
|
200
|
+
Datum v1, Datum v2, Datum v3, Datum v4);
|
201
|
+
extern HeapTuple SearchCatCache1(CatCache *cache,
|
202
|
+
Datum v1);
|
203
|
+
extern HeapTuple SearchCatCache2(CatCache *cache,
|
204
|
+
Datum v1, Datum v2);
|
205
|
+
extern HeapTuple SearchCatCache3(CatCache *cache,
|
206
|
+
Datum v1, Datum v2, Datum v3);
|
207
|
+
extern HeapTuple SearchCatCache4(CatCache *cache,
|
208
|
+
Datum v1, Datum v2, Datum v3, Datum v4);
|
209
|
+
extern void ReleaseCatCache(HeapTuple tuple);
|
210
|
+
|
211
|
+
extern uint32 GetCatCacheHashValue(CatCache *cache,
|
212
|
+
Datum v1, Datum v2,
|
213
|
+
Datum v3, Datum v4);
|
214
|
+
|
215
|
+
extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys,
|
216
|
+
Datum v1, Datum v2,
|
217
|
+
Datum v3);
|
218
|
+
extern void ReleaseCatCacheList(CatCList *list);
|
219
|
+
|
220
|
+
extern void ResetCatalogCaches(void);
|
221
|
+
extern void CatalogCacheFlushCatalog(Oid catId);
|
222
|
+
extern void CatCacheInvalidate(CatCache *cache, uint32 hashValue);
|
223
|
+
extern void PrepareToInvalidateCacheTuple(Relation relation,
|
224
|
+
HeapTuple tuple,
|
225
|
+
HeapTuple newtuple,
|
226
|
+
void (*function) (int, uint32, Oid));
|
227
|
+
|
228
|
+
extern void PrintCatCacheLeakWarning(HeapTuple tuple);
|
229
|
+
extern void PrintCatCacheListLeakWarning(CatCList *list);
|
230
|
+
|
231
|
+
#endif /* CATCACHE_H */
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* date.h
|
4
|
+
* Definitions for the SQL "date" and "time" types.
|
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/utils/date.h
|
11
|
+
*
|
12
|
+
*-------------------------------------------------------------------------
|
13
|
+
*/
|
14
|
+
#ifndef DATE_H
|
15
|
+
#define DATE_H
|
16
|
+
|
17
|
+
#include <math.h>
|
18
|
+
|
19
|
+
#include "datatype/timestamp.h"
|
20
|
+
#include "fmgr.h"
|
21
|
+
#include "pgtime.h"
|
22
|
+
|
23
|
+
typedef int32 DateADT;
|
24
|
+
|
25
|
+
typedef int64 TimeADT;
|
26
|
+
|
27
|
+
typedef struct
|
28
|
+
{
|
29
|
+
TimeADT time; /* all time units other than months and years */
|
30
|
+
int32 zone; /* numeric time zone, in seconds */
|
31
|
+
} TimeTzADT;
|
32
|
+
|
33
|
+
/*
|
34
|
+
* Infinity and minus infinity must be the max and min values of DateADT.
|
35
|
+
*/
|
36
|
+
#define DATEVAL_NOBEGIN ((DateADT) PG_INT32_MIN)
|
37
|
+
#define DATEVAL_NOEND ((DateADT) PG_INT32_MAX)
|
38
|
+
|
39
|
+
#define DATE_NOBEGIN(j) ((j) = DATEVAL_NOBEGIN)
|
40
|
+
#define DATE_IS_NOBEGIN(j) ((j) == DATEVAL_NOBEGIN)
|
41
|
+
#define DATE_NOEND(j) ((j) = DATEVAL_NOEND)
|
42
|
+
#define DATE_IS_NOEND(j) ((j) == DATEVAL_NOEND)
|
43
|
+
#define DATE_NOT_FINITE(j) (DATE_IS_NOBEGIN(j) || DATE_IS_NOEND(j))
|
44
|
+
|
45
|
+
/*
|
46
|
+
* Macros for fmgr-callable functions.
|
47
|
+
*
|
48
|
+
* For TimeADT, we make use of the same support routines as for int64.
|
49
|
+
* Therefore TimeADT is pass-by-reference if and only if int64 is!
|
50
|
+
*/
|
51
|
+
#define MAX_TIME_PRECISION 6
|
52
|
+
|
53
|
+
#define DatumGetDateADT(X) ((DateADT) DatumGetInt32(X))
|
54
|
+
#define DatumGetTimeADT(X) ((TimeADT) DatumGetInt64(X))
|
55
|
+
#define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
|
56
|
+
|
57
|
+
#define DateADTGetDatum(X) Int32GetDatum(X)
|
58
|
+
#define TimeADTGetDatum(X) Int64GetDatum(X)
|
59
|
+
#define TimeTzADTPGetDatum(X) PointerGetDatum(X)
|
60
|
+
|
61
|
+
#define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n))
|
62
|
+
#define PG_GETARG_TIMEADT(n) DatumGetTimeADT(PG_GETARG_DATUM(n))
|
63
|
+
#define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n))
|
64
|
+
|
65
|
+
#define PG_RETURN_DATEADT(x) return DateADTGetDatum(x)
|
66
|
+
#define PG_RETURN_TIMEADT(x) return TimeADTGetDatum(x)
|
67
|
+
#define PG_RETURN_TIMETZADT_P(x) return TimeTzADTPGetDatum(x)
|
68
|
+
|
69
|
+
|
70
|
+
/* date.c */
|
71
|
+
extern int32 anytime_typmod_check(bool istz, int32 typmod);
|
72
|
+
extern double date2timestamp_no_overflow(DateADT dateVal);
|
73
|
+
extern Timestamp date2timestamp_opt_overflow(DateADT dateVal, int *overflow);
|
74
|
+
extern TimestampTz date2timestamptz_opt_overflow(DateADT dateVal, int *overflow);
|
75
|
+
extern int32 date_cmp_timestamp_internal(DateADT dateVal, Timestamp dt2);
|
76
|
+
extern int32 date_cmp_timestamptz_internal(DateADT dateVal, TimestampTz dt2);
|
77
|
+
|
78
|
+
extern void EncodeSpecialDate(DateADT dt, char *str);
|
79
|
+
extern DateADT GetSQLCurrentDate(void);
|
80
|
+
extern TimeTzADT *GetSQLCurrentTime(int32 typmod);
|
81
|
+
extern TimeADT GetSQLLocalTime(int32 typmod);
|
82
|
+
extern int time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec);
|
83
|
+
extern int timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp);
|
84
|
+
extern int tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result);
|
85
|
+
extern int tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result);
|
86
|
+
extern bool time_overflows(int hour, int min, int sec, fsec_t fsec);
|
87
|
+
extern bool float_time_overflows(int hour, int min, double sec);
|
88
|
+
extern void AdjustTimeForTypmod(TimeADT *time, int32 typmod);
|
89
|
+
|
90
|
+
#endif /* DATE_H */
|