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,107 @@
|
|
1
|
+
/*--------------------------------------------------------------------
|
2
|
+
* Symbols referenced in this file:
|
3
|
+
* - plpgsql_variable_conflict
|
4
|
+
* - plpgsql_print_strict_params
|
5
|
+
*--------------------------------------------------------------------
|
6
|
+
*/
|
7
|
+
|
8
|
+
/*-------------------------------------------------------------------------
|
9
|
+
*
|
10
|
+
* pl_handler.c - Handler for the PL/pgSQL
|
11
|
+
* procedural language
|
12
|
+
*
|
13
|
+
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
14
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
15
|
+
*
|
16
|
+
*
|
17
|
+
* IDENTIFICATION
|
18
|
+
* src/pl/plpgsql/src/pl_handler.c
|
19
|
+
*
|
20
|
+
*-------------------------------------------------------------------------
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include "postgres.h"
|
24
|
+
|
25
|
+
#include "access/htup_details.h"
|
26
|
+
#include "catalog/pg_proc.h"
|
27
|
+
#include "catalog/pg_type.h"
|
28
|
+
#include "funcapi.h"
|
29
|
+
#include "miscadmin.h"
|
30
|
+
#include "plpgsql.h"
|
31
|
+
#include "utils/builtins.h"
|
32
|
+
#include "utils/guc.h"
|
33
|
+
#include "utils/lsyscache.h"
|
34
|
+
#include "utils/syscache.h"
|
35
|
+
#include "utils/varlena.h"
|
36
|
+
|
37
|
+
static bool plpgsql_extra_checks_check_hook(char **newvalue, void **extra, GucSource source);
|
38
|
+
static void plpgsql_extra_warnings_assign_hook(const char *newvalue, void *extra);
|
39
|
+
static void plpgsql_extra_errors_assign_hook(const char *newvalue, void *extra);
|
40
|
+
|
41
|
+
;
|
42
|
+
|
43
|
+
/* Custom GUC variable */
|
44
|
+
|
45
|
+
|
46
|
+
__thread int plpgsql_variable_conflict = PLPGSQL_RESOLVE_ERROR;
|
47
|
+
|
48
|
+
|
49
|
+
__thread bool plpgsql_print_strict_params = false;
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
/* Hook for plugins */
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
/*
|
71
|
+
* _PG_init() - library load-time initialization
|
72
|
+
*
|
73
|
+
* DO NOT make this static nor change its name!
|
74
|
+
*/
|
75
|
+
|
76
|
+
|
77
|
+
/* ----------
|
78
|
+
* plpgsql_call_handler
|
79
|
+
*
|
80
|
+
* The PostgreSQL function manager and trigger manager
|
81
|
+
* call this function for execution of PL/pgSQL procedures.
|
82
|
+
* ----------
|
83
|
+
*/
|
84
|
+
;
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
/* ----------
|
89
|
+
* plpgsql_inline_handler
|
90
|
+
*
|
91
|
+
* Called by PostgreSQL to execute an anonymous code block
|
92
|
+
* ----------
|
93
|
+
*/
|
94
|
+
;
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
/* ----------
|
99
|
+
* plpgsql_validator
|
100
|
+
*
|
101
|
+
* This function attempts to validate a PL/pgSQL function at
|
102
|
+
* CREATE FUNCTION time.
|
103
|
+
* ----------
|
104
|
+
*/
|
105
|
+
;
|
106
|
+
|
107
|
+
|
@@ -0,0 +1,123 @@
|
|
1
|
+
/*--------------------------------------------------------------------
|
2
|
+
* Symbols referenced in this file:
|
3
|
+
* - ReservedPLKeywords
|
4
|
+
* - ReservedPLKeywords_kw_string
|
5
|
+
* - ReservedPLKeywords_kw_offsets
|
6
|
+
* - ReservedPLKeywords_hash_func
|
7
|
+
*--------------------------------------------------------------------
|
8
|
+
*/
|
9
|
+
|
10
|
+
/*-------------------------------------------------------------------------
|
11
|
+
*
|
12
|
+
* pl_reserved_kwlist_d.h
|
13
|
+
* List of keywords represented as a ScanKeywordList.
|
14
|
+
*
|
15
|
+
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
16
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
17
|
+
*
|
18
|
+
* NOTES
|
19
|
+
* ******************************
|
20
|
+
* *** DO NOT EDIT THIS FILE! ***
|
21
|
+
* ******************************
|
22
|
+
*
|
23
|
+
* It has been GENERATED by src/tools/gen_keywordlist.pl
|
24
|
+
*
|
25
|
+
*-------------------------------------------------------------------------
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef PL_RESERVED_KWLIST_D_H
|
29
|
+
#define PL_RESERVED_KWLIST_D_H
|
30
|
+
|
31
|
+
#include "common/kwlookup.h"
|
32
|
+
|
33
|
+
static const char ReservedPLKeywords_kw_string[] =
|
34
|
+
"all\0"
|
35
|
+
"begin\0"
|
36
|
+
"by\0"
|
37
|
+
"case\0"
|
38
|
+
"declare\0"
|
39
|
+
"else\0"
|
40
|
+
"end\0"
|
41
|
+
"execute\0"
|
42
|
+
"for\0"
|
43
|
+
"foreach\0"
|
44
|
+
"from\0"
|
45
|
+
"if\0"
|
46
|
+
"in\0"
|
47
|
+
"into\0"
|
48
|
+
"loop\0"
|
49
|
+
"not\0"
|
50
|
+
"null\0"
|
51
|
+
"or\0"
|
52
|
+
"strict\0"
|
53
|
+
"then\0"
|
54
|
+
"to\0"
|
55
|
+
"using\0"
|
56
|
+
"when\0"
|
57
|
+
"while";
|
58
|
+
|
59
|
+
static const uint16 ReservedPLKeywords_kw_offsets[] = {
|
60
|
+
0,
|
61
|
+
4,
|
62
|
+
10,
|
63
|
+
13,
|
64
|
+
18,
|
65
|
+
26,
|
66
|
+
31,
|
67
|
+
35,
|
68
|
+
43,
|
69
|
+
47,
|
70
|
+
55,
|
71
|
+
60,
|
72
|
+
63,
|
73
|
+
66,
|
74
|
+
71,
|
75
|
+
76,
|
76
|
+
80,
|
77
|
+
85,
|
78
|
+
88,
|
79
|
+
95,
|
80
|
+
100,
|
81
|
+
103,
|
82
|
+
109,
|
83
|
+
114,
|
84
|
+
};
|
85
|
+
|
86
|
+
#define RESERVEDPLKEYWORDS_NUM_KEYWORDS 24
|
87
|
+
|
88
|
+
static int
|
89
|
+
ReservedPLKeywords_hash_func(const void *key, size_t keylen)
|
90
|
+
{
|
91
|
+
static const int8 h[49] = {
|
92
|
+
-2, 127, 7, 127, 0, 127, 127, 127,
|
93
|
+
18, 5, 127, 27, 127, 0, 127, 127,
|
94
|
+
0, 39, 32, 22, 10, 127, 19, -26,
|
95
|
+
127, -11, 0, 12, 127, 127, -1, 28,
|
96
|
+
20, 0, 23, 127, 0, 14, -8, 127,
|
97
|
+
127, 127, 13, 5, 127, -23, 1, 0,
|
98
|
+
127,
|
99
|
+
};
|
100
|
+
|
101
|
+
const unsigned char *k = (const unsigned char *) key;
|
102
|
+
uint32 a = 0;
|
103
|
+
uint32 b = 1;
|
104
|
+
|
105
|
+
while (keylen--)
|
106
|
+
{
|
107
|
+
unsigned char c = *k++ | 0x20;
|
108
|
+
|
109
|
+
a = a * 31 + c;
|
110
|
+
b = b * 127 + c;
|
111
|
+
}
|
112
|
+
return h[a % 49] + h[b % 49];
|
113
|
+
}
|
114
|
+
|
115
|
+
static const ScanKeywordList ReservedPLKeywords = {
|
116
|
+
ReservedPLKeywords_kw_string,
|
117
|
+
ReservedPLKeywords_kw_offsets,
|
118
|
+
ReservedPLKeywords_hash_func,
|
119
|
+
RESERVEDPLKEYWORDS_NUM_KEYWORDS,
|
120
|
+
7
|
121
|
+
};
|
122
|
+
|
123
|
+
#endif /* PL_RESERVED_KWLIST_D_H */
|
@@ -0,0 +1,671 @@
|
|
1
|
+
/*--------------------------------------------------------------------
|
2
|
+
* Symbols referenced in this file:
|
3
|
+
* - plpgsql_scanner_init
|
4
|
+
* - plpgsql_IdentifierLookup
|
5
|
+
* - yyscanner
|
6
|
+
* - core_yy
|
7
|
+
* - ReservedPLKeywordTokens
|
8
|
+
* - scanorig
|
9
|
+
* - plpgsql_yytoken
|
10
|
+
* - num_pushbacks
|
11
|
+
* - location_lineno_init
|
12
|
+
* - cur_line_start
|
13
|
+
* - cur_line_num
|
14
|
+
* - cur_line_end
|
15
|
+
* - plpgsql_yylex
|
16
|
+
* - internal_yylex
|
17
|
+
* - pushback_token
|
18
|
+
* - pushback_auxdata
|
19
|
+
* - push_back_token
|
20
|
+
* - UnreservedPLKeywordTokens
|
21
|
+
* - plpgsql_yyleng
|
22
|
+
* - plpgsql_location_to_lineno
|
23
|
+
* - plpgsql_scanner_errposition
|
24
|
+
* - plpgsql_yyerror
|
25
|
+
* - plpgsql_push_back_token
|
26
|
+
* - plpgsql_token_is_unreserved_keyword
|
27
|
+
* - plpgsql_peek
|
28
|
+
* - plpgsql_append_source_text
|
29
|
+
* - plpgsql_peek2
|
30
|
+
* - plpgsql_scanner_finish
|
31
|
+
* - plpgsql_latest_lineno
|
32
|
+
*--------------------------------------------------------------------
|
33
|
+
*/
|
34
|
+
|
35
|
+
/*-------------------------------------------------------------------------
|
36
|
+
*
|
37
|
+
* pl_scanner.c
|
38
|
+
* lexical scanning for PL/pgSQL
|
39
|
+
*
|
40
|
+
*
|
41
|
+
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
42
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
43
|
+
*
|
44
|
+
*
|
45
|
+
* IDENTIFICATION
|
46
|
+
* src/pl/plpgsql/src/pl_scanner.c
|
47
|
+
*
|
48
|
+
*-------------------------------------------------------------------------
|
49
|
+
*/
|
50
|
+
#include "postgres.h"
|
51
|
+
|
52
|
+
#include "mb/pg_wchar.h"
|
53
|
+
#include "parser/scanner.h"
|
54
|
+
|
55
|
+
#include "plpgsql.h"
|
56
|
+
#include "pl_gram.h" /* must be after parser/scanner.h */
|
57
|
+
|
58
|
+
|
59
|
+
/* Klugy flag to tell scanner how to look up identifiers */
|
60
|
+
__thread IdentifierLookup plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
|
61
|
+
|
62
|
+
|
63
|
+
/*
|
64
|
+
* A word about keywords:
|
65
|
+
*
|
66
|
+
* We keep reserved and unreserved keywords in separate headers. Be careful
|
67
|
+
* not to put the same word in both headers. Also be sure that pl_gram.y's
|
68
|
+
* unreserved_keyword production agrees with the unreserved header. The
|
69
|
+
* reserved keywords are passed to the core scanner, so they will be
|
70
|
+
* recognized before (and instead of) any variable name. Unreserved words
|
71
|
+
* are checked for separately, usually after determining that the identifier
|
72
|
+
* isn't a known variable name. If plpgsql_IdentifierLookup is DECLARE then
|
73
|
+
* no variable names will be recognized, so the unreserved words always work.
|
74
|
+
* (Note in particular that this helps us avoid reserving keywords that are
|
75
|
+
* only needed in DECLARE sections.)
|
76
|
+
*
|
77
|
+
* In certain contexts it is desirable to prefer recognizing an unreserved
|
78
|
+
* keyword over recognizing a variable name. In particular, at the start
|
79
|
+
* of a statement we should prefer unreserved keywords unless the statement
|
80
|
+
* looks like an assignment (i.e., first token is followed by ':=' or '[').
|
81
|
+
* This rule allows most statement-introducing keywords to be kept unreserved.
|
82
|
+
* (We still have to reserve initial keywords that might follow a block
|
83
|
+
* label, unfortunately, since the method used to determine if we are at
|
84
|
+
* start of statement doesn't recognize such cases. We'd also have to
|
85
|
+
* reserve any keyword that could legitimately be followed by ':=' or '['.)
|
86
|
+
* Some additional cases are handled in pl_gram.y using tok_is_keyword().
|
87
|
+
*
|
88
|
+
* We try to avoid reserving more keywords than we have to; but there's
|
89
|
+
* little point in not reserving a word if it's reserved in the core grammar.
|
90
|
+
* Currently, the following words are reserved here but not in the core:
|
91
|
+
* BEGIN BY DECLARE EXECUTE FOREACH IF LOOP STRICT WHILE
|
92
|
+
*/
|
93
|
+
|
94
|
+
/* ScanKeywordList lookup data for PL/pgSQL keywords */
|
95
|
+
#include "pl_reserved_kwlist_d.h"
|
96
|
+
#include "pl_unreserved_kwlist_d.h"
|
97
|
+
|
98
|
+
/* Token codes for PL/pgSQL keywords */
|
99
|
+
#define PG_KEYWORD(kwname, value) value,
|
100
|
+
|
101
|
+
static const uint16 ReservedPLKeywordTokens[] = {
|
102
|
+
#include "pl_reserved_kwlist.h"
|
103
|
+
};
|
104
|
+
|
105
|
+
static const uint16 UnreservedPLKeywordTokens[] = {
|
106
|
+
#include "pl_unreserved_kwlist.h"
|
107
|
+
};
|
108
|
+
|
109
|
+
#undef PG_KEYWORD
|
110
|
+
|
111
|
+
/*
|
112
|
+
* This macro must recognize all tokens that can immediately precede a
|
113
|
+
* PL/pgSQL executable statement (that is, proc_sect or proc_stmt in the
|
114
|
+
* grammar). Fortunately, there are not very many, so hard-coding in this
|
115
|
+
* fashion seems sufficient.
|
116
|
+
*/
|
117
|
+
#define AT_STMT_START(prev_token) \
|
118
|
+
((prev_token) == ';' || \
|
119
|
+
(prev_token) == K_BEGIN || \
|
120
|
+
(prev_token) == K_THEN || \
|
121
|
+
(prev_token) == K_ELSE || \
|
122
|
+
(prev_token) == K_LOOP)
|
123
|
+
|
124
|
+
|
125
|
+
/* Auxiliary data about a token (other than the token type) */
|
126
|
+
typedef struct
|
127
|
+
{
|
128
|
+
YYSTYPE lval; /* semantic information */
|
129
|
+
YYLTYPE lloc; /* offset in scanbuf */
|
130
|
+
int leng; /* length in bytes */
|
131
|
+
} TokenAuxData;
|
132
|
+
|
133
|
+
/*
|
134
|
+
* Scanner working state. At some point we might wish to fold all this
|
135
|
+
* into a YY_EXTRA struct. For the moment, there is no need for plpgsql's
|
136
|
+
* lexer to be re-entrant, and the notational burden of passing a yyscanner
|
137
|
+
* pointer around is great enough to not want to do it without need.
|
138
|
+
*/
|
139
|
+
|
140
|
+
/* The stuff the core lexer needs */
|
141
|
+
static __thread core_yyscan_t yyscanner = NULL;
|
142
|
+
|
143
|
+
static __thread core_yy_extra_type core_yy;
|
144
|
+
|
145
|
+
|
146
|
+
/* The original input string */
|
147
|
+
static __thread const char *scanorig;
|
148
|
+
|
149
|
+
|
150
|
+
/* Current token's length (corresponds to plpgsql_yylval and plpgsql_yylloc) */
|
151
|
+
static __thread int plpgsql_yyleng;
|
152
|
+
|
153
|
+
|
154
|
+
/* Current token's code (corresponds to plpgsql_yylval and plpgsql_yylloc) */
|
155
|
+
static __thread int plpgsql_yytoken;
|
156
|
+
|
157
|
+
|
158
|
+
/* Token pushback stack */
|
159
|
+
#define MAX_PUSHBACKS 4
|
160
|
+
|
161
|
+
static __thread int num_pushbacks;
|
162
|
+
|
163
|
+
static __thread int pushback_token[MAX_PUSHBACKS];
|
164
|
+
|
165
|
+
static __thread TokenAuxData pushback_auxdata[MAX_PUSHBACKS];
|
166
|
+
|
167
|
+
|
168
|
+
/* State for plpgsql_location_to_lineno() */
|
169
|
+
static __thread const char *cur_line_start;
|
170
|
+
|
171
|
+
static __thread const char *cur_line_end;
|
172
|
+
|
173
|
+
static __thread int cur_line_num;
|
174
|
+
|
175
|
+
|
176
|
+
/* Internal functions */
|
177
|
+
static int internal_yylex(TokenAuxData *auxdata);
|
178
|
+
static void push_back_token(int token, TokenAuxData *auxdata);
|
179
|
+
static void location_lineno_init(void);
|
180
|
+
|
181
|
+
|
182
|
+
/*
|
183
|
+
* This is the yylex routine called from the PL/pgSQL grammar.
|
184
|
+
* It is a wrapper around the core lexer, with the ability to recognize
|
185
|
+
* PL/pgSQL variables and return them as special T_DATUM tokens. If a
|
186
|
+
* word or compound word does not match any variable name, or if matching
|
187
|
+
* is turned off by plpgsql_IdentifierLookup, it is returned as
|
188
|
+
* T_WORD or T_CWORD respectively, or as an unreserved keyword if it
|
189
|
+
* matches one of those.
|
190
|
+
*/
|
191
|
+
int
|
192
|
+
plpgsql_yylex(void)
|
193
|
+
{
|
194
|
+
int tok1;
|
195
|
+
TokenAuxData aux1;
|
196
|
+
int kwnum;
|
197
|
+
|
198
|
+
tok1 = internal_yylex(&aux1);
|
199
|
+
if (tok1 == IDENT || tok1 == PARAM)
|
200
|
+
{
|
201
|
+
int tok2;
|
202
|
+
TokenAuxData aux2;
|
203
|
+
|
204
|
+
tok2 = internal_yylex(&aux2);
|
205
|
+
if (tok2 == '.')
|
206
|
+
{
|
207
|
+
int tok3;
|
208
|
+
TokenAuxData aux3;
|
209
|
+
|
210
|
+
tok3 = internal_yylex(&aux3);
|
211
|
+
if (tok3 == IDENT)
|
212
|
+
{
|
213
|
+
int tok4;
|
214
|
+
TokenAuxData aux4;
|
215
|
+
|
216
|
+
tok4 = internal_yylex(&aux4);
|
217
|
+
if (tok4 == '.')
|
218
|
+
{
|
219
|
+
int tok5;
|
220
|
+
TokenAuxData aux5;
|
221
|
+
|
222
|
+
tok5 = internal_yylex(&aux5);
|
223
|
+
if (tok5 == IDENT)
|
224
|
+
{
|
225
|
+
if (plpgsql_parse_tripword(aux1.lval.str,
|
226
|
+
aux3.lval.str,
|
227
|
+
aux5.lval.str,
|
228
|
+
&aux1.lval.wdatum,
|
229
|
+
&aux1.lval.cword))
|
230
|
+
tok1 = T_DATUM;
|
231
|
+
else
|
232
|
+
tok1 = T_CWORD;
|
233
|
+
}
|
234
|
+
else
|
235
|
+
{
|
236
|
+
/* not A.B.C, so just process A.B */
|
237
|
+
push_back_token(tok5, &aux5);
|
238
|
+
push_back_token(tok4, &aux4);
|
239
|
+
if (plpgsql_parse_dblword(aux1.lval.str,
|
240
|
+
aux3.lval.str,
|
241
|
+
&aux1.lval.wdatum,
|
242
|
+
&aux1.lval.cword))
|
243
|
+
tok1 = T_DATUM;
|
244
|
+
else
|
245
|
+
tok1 = T_CWORD;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
else
|
249
|
+
{
|
250
|
+
/* not A.B.C, so just process A.B */
|
251
|
+
push_back_token(tok4, &aux4);
|
252
|
+
if (plpgsql_parse_dblword(aux1.lval.str,
|
253
|
+
aux3.lval.str,
|
254
|
+
&aux1.lval.wdatum,
|
255
|
+
&aux1.lval.cword))
|
256
|
+
tok1 = T_DATUM;
|
257
|
+
else
|
258
|
+
tok1 = T_CWORD;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
else
|
262
|
+
{
|
263
|
+
/* not A.B, so just process A */
|
264
|
+
push_back_token(tok3, &aux3);
|
265
|
+
push_back_token(tok2, &aux2);
|
266
|
+
if (plpgsql_parse_word(aux1.lval.str,
|
267
|
+
core_yy.scanbuf + aux1.lloc,
|
268
|
+
true,
|
269
|
+
&aux1.lval.wdatum,
|
270
|
+
&aux1.lval.word))
|
271
|
+
tok1 = T_DATUM;
|
272
|
+
else if (!aux1.lval.word.quoted &&
|
273
|
+
(kwnum = ScanKeywordLookup(aux1.lval.word.ident,
|
274
|
+
&UnreservedPLKeywords)) >= 0)
|
275
|
+
{
|
276
|
+
aux1.lval.keyword = GetScanKeyword(kwnum,
|
277
|
+
&UnreservedPLKeywords);
|
278
|
+
tok1 = UnreservedPLKeywordTokens[kwnum];
|
279
|
+
}
|
280
|
+
else
|
281
|
+
tok1 = T_WORD;
|
282
|
+
}
|
283
|
+
}
|
284
|
+
else
|
285
|
+
{
|
286
|
+
/* not A.B, so just process A */
|
287
|
+
push_back_token(tok2, &aux2);
|
288
|
+
|
289
|
+
/*
|
290
|
+
* See if it matches a variable name, except in the context where
|
291
|
+
* we are at start of statement and the next token isn't
|
292
|
+
* assignment or '['. In that case, it couldn't validly be a
|
293
|
+
* variable name, and skipping the lookup allows variable names to
|
294
|
+
* be used that would conflict with plpgsql or core keywords that
|
295
|
+
* introduce statements (e.g., "comment"). Without this special
|
296
|
+
* logic, every statement-introducing keyword would effectively be
|
297
|
+
* reserved in PL/pgSQL, which would be unpleasant.
|
298
|
+
*
|
299
|
+
* If it isn't a variable name, try to match against unreserved
|
300
|
+
* plpgsql keywords. If not one of those either, it's T_WORD.
|
301
|
+
*
|
302
|
+
* Note: we must call plpgsql_parse_word even if we don't want to
|
303
|
+
* do variable lookup, because it sets up aux1.lval.word for the
|
304
|
+
* non-variable cases.
|
305
|
+
*/
|
306
|
+
if (plpgsql_parse_word(aux1.lval.str,
|
307
|
+
core_yy.scanbuf + aux1.lloc,
|
308
|
+
(!AT_STMT_START(plpgsql_yytoken) ||
|
309
|
+
(tok2 == '=' || tok2 == COLON_EQUALS ||
|
310
|
+
tok2 == '[')),
|
311
|
+
&aux1.lval.wdatum,
|
312
|
+
&aux1.lval.word))
|
313
|
+
tok1 = T_DATUM;
|
314
|
+
else if (!aux1.lval.word.quoted &&
|
315
|
+
(kwnum = ScanKeywordLookup(aux1.lval.word.ident,
|
316
|
+
&UnreservedPLKeywords)) >= 0)
|
317
|
+
{
|
318
|
+
aux1.lval.keyword = GetScanKeyword(kwnum,
|
319
|
+
&UnreservedPLKeywords);
|
320
|
+
tok1 = UnreservedPLKeywordTokens[kwnum];
|
321
|
+
}
|
322
|
+
else
|
323
|
+
tok1 = T_WORD;
|
324
|
+
}
|
325
|
+
}
|
326
|
+
else
|
327
|
+
{
|
328
|
+
/*
|
329
|
+
* Not a potential plpgsql variable name, just return the data.
|
330
|
+
*
|
331
|
+
* Note that we also come through here if the grammar pushed back a
|
332
|
+
* T_DATUM, T_CWORD, T_WORD, or unreserved-keyword token returned by a
|
333
|
+
* previous lookup cycle; thus, pushbacks do not incur extra lookup
|
334
|
+
* work, since we'll never do the above code twice for the same token.
|
335
|
+
* This property also makes it safe to rely on the old value of
|
336
|
+
* plpgsql_yytoken in the is-this-start-of-statement test above.
|
337
|
+
*/
|
338
|
+
}
|
339
|
+
|
340
|
+
plpgsql_yylval = aux1.lval;
|
341
|
+
plpgsql_yylloc = aux1.lloc;
|
342
|
+
plpgsql_yyleng = aux1.leng;
|
343
|
+
plpgsql_yytoken = tok1;
|
344
|
+
return tok1;
|
345
|
+
}
|
346
|
+
|
347
|
+
/*
|
348
|
+
* Internal yylex function. This wraps the core lexer and adds one feature:
|
349
|
+
* a token pushback stack. We also make a couple of trivial single-token
|
350
|
+
* translations from what the core lexer does to what we want, in particular
|
351
|
+
* interfacing from the core_YYSTYPE to YYSTYPE union.
|
352
|
+
*/
|
353
|
+
static int
|
354
|
+
internal_yylex(TokenAuxData *auxdata)
|
355
|
+
{
|
356
|
+
int token;
|
357
|
+
const char *yytext;
|
358
|
+
|
359
|
+
if (num_pushbacks > 0)
|
360
|
+
{
|
361
|
+
num_pushbacks--;
|
362
|
+
token = pushback_token[num_pushbacks];
|
363
|
+
*auxdata = pushback_auxdata[num_pushbacks];
|
364
|
+
}
|
365
|
+
else
|
366
|
+
{
|
367
|
+
token = core_yylex(&auxdata->lval.core_yystype,
|
368
|
+
&auxdata->lloc,
|
369
|
+
yyscanner);
|
370
|
+
|
371
|
+
/* remember the length of yytext before it gets changed */
|
372
|
+
yytext = core_yy.scanbuf + auxdata->lloc;
|
373
|
+
auxdata->leng = strlen(yytext);
|
374
|
+
|
375
|
+
/* Check for << >> and #, which the core considers operators */
|
376
|
+
if (token == Op)
|
377
|
+
{
|
378
|
+
if (strcmp(auxdata->lval.str, "<<") == 0)
|
379
|
+
token = LESS_LESS;
|
380
|
+
else if (strcmp(auxdata->lval.str, ">>") == 0)
|
381
|
+
token = GREATER_GREATER;
|
382
|
+
else if (strcmp(auxdata->lval.str, "#") == 0)
|
383
|
+
token = '#';
|
384
|
+
}
|
385
|
+
|
386
|
+
/* The core returns PARAM as ival, but we treat it like IDENT */
|
387
|
+
else if (token == PARAM)
|
388
|
+
{
|
389
|
+
auxdata->lval.str = pstrdup(yytext);
|
390
|
+
}
|
391
|
+
|
392
|
+
else if (token == SQL_COMMENT || token == C_COMMENT)
|
393
|
+
{
|
394
|
+
token = internal_yylex(auxdata);
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
398
|
+
return token;
|
399
|
+
}
|
400
|
+
|
401
|
+
/*
|
402
|
+
* Push back a token to be re-read by next internal_yylex() call.
|
403
|
+
*/
|
404
|
+
static void
|
405
|
+
push_back_token(int token, TokenAuxData *auxdata)
|
406
|
+
{
|
407
|
+
if (num_pushbacks >= MAX_PUSHBACKS)
|
408
|
+
elog(ERROR, "too many tokens pushed back");
|
409
|
+
pushback_token[num_pushbacks] = token;
|
410
|
+
pushback_auxdata[num_pushbacks] = *auxdata;
|
411
|
+
num_pushbacks++;
|
412
|
+
}
|
413
|
+
|
414
|
+
/*
|
415
|
+
* Push back a single token to be re-read by next plpgsql_yylex() call.
|
416
|
+
*
|
417
|
+
* NOTE: this does not cause yylval or yylloc to "back up". Also, it
|
418
|
+
* is not a good idea to push back a token code other than what you read.
|
419
|
+
*/
|
420
|
+
void
|
421
|
+
plpgsql_push_back_token(int token)
|
422
|
+
{
|
423
|
+
TokenAuxData auxdata;
|
424
|
+
|
425
|
+
auxdata.lval = plpgsql_yylval;
|
426
|
+
auxdata.lloc = plpgsql_yylloc;
|
427
|
+
auxdata.leng = plpgsql_yyleng;
|
428
|
+
push_back_token(token, &auxdata);
|
429
|
+
}
|
430
|
+
|
431
|
+
/*
|
432
|
+
* Tell whether a token is an unreserved keyword.
|
433
|
+
*
|
434
|
+
* (If it is, its lowercased form was returned as the token value, so we
|
435
|
+
* do not need to offer that data here.)
|
436
|
+
*/
|
437
|
+
bool
|
438
|
+
plpgsql_token_is_unreserved_keyword(int token)
|
439
|
+
{
|
440
|
+
int i;
|
441
|
+
|
442
|
+
for (i = 0; i < lengthof(UnreservedPLKeywordTokens); i++)
|
443
|
+
{
|
444
|
+
if (UnreservedPLKeywordTokens[i] == token)
|
445
|
+
return true;
|
446
|
+
}
|
447
|
+
return false;
|
448
|
+
}
|
449
|
+
|
450
|
+
/*
|
451
|
+
* Append the function text starting at startlocation and extending to
|
452
|
+
* (not including) endlocation onto the existing contents of "buf".
|
453
|
+
*/
|
454
|
+
void
|
455
|
+
plpgsql_append_source_text(StringInfo buf,
|
456
|
+
int startlocation, int endlocation)
|
457
|
+
{
|
458
|
+
Assert(startlocation <= endlocation);
|
459
|
+
appendBinaryStringInfo(buf, scanorig + startlocation,
|
460
|
+
endlocation - startlocation);
|
461
|
+
}
|
462
|
+
|
463
|
+
/*
|
464
|
+
* Peek one token ahead in the input stream. Only the token code is
|
465
|
+
* made available, not any of the auxiliary info such as location.
|
466
|
+
*
|
467
|
+
* NB: no variable or unreserved keyword lookup is performed here, they will
|
468
|
+
* be returned as IDENT. Reserved keywords are resolved as usual.
|
469
|
+
*/
|
470
|
+
int
|
471
|
+
plpgsql_peek(void)
|
472
|
+
{
|
473
|
+
int tok1;
|
474
|
+
TokenAuxData aux1;
|
475
|
+
|
476
|
+
tok1 = internal_yylex(&aux1);
|
477
|
+
push_back_token(tok1, &aux1);
|
478
|
+
return tok1;
|
479
|
+
}
|
480
|
+
|
481
|
+
/*
|
482
|
+
* Peek two tokens ahead in the input stream. The first token and its
|
483
|
+
* location in the query are returned in *tok1_p and *tok1_loc, second token
|
484
|
+
* and its location in *tok2_p and *tok2_loc.
|
485
|
+
*
|
486
|
+
* NB: no variable or unreserved keyword lookup is performed here, they will
|
487
|
+
* be returned as IDENT. Reserved keywords are resolved as usual.
|
488
|
+
*/
|
489
|
+
void
|
490
|
+
plpgsql_peek2(int *tok1_p, int *tok2_p, int *tok1_loc, int *tok2_loc)
|
491
|
+
{
|
492
|
+
int tok1,
|
493
|
+
tok2;
|
494
|
+
TokenAuxData aux1,
|
495
|
+
aux2;
|
496
|
+
|
497
|
+
tok1 = internal_yylex(&aux1);
|
498
|
+
tok2 = internal_yylex(&aux2);
|
499
|
+
|
500
|
+
*tok1_p = tok1;
|
501
|
+
if (tok1_loc)
|
502
|
+
*tok1_loc = aux1.lloc;
|
503
|
+
*tok2_p = tok2;
|
504
|
+
if (tok2_loc)
|
505
|
+
*tok2_loc = aux2.lloc;
|
506
|
+
|
507
|
+
push_back_token(tok2, &aux2);
|
508
|
+
push_back_token(tok1, &aux1);
|
509
|
+
}
|
510
|
+
|
511
|
+
/*
|
512
|
+
* plpgsql_scanner_errposition
|
513
|
+
* Report an error cursor position, if possible.
|
514
|
+
*
|
515
|
+
* This is expected to be used within an ereport() call. The return value
|
516
|
+
* is a dummy (always 0, in fact).
|
517
|
+
*
|
518
|
+
* Note that this can only be used for messages emitted during initial
|
519
|
+
* parsing of a plpgsql function, since it requires the scanorig string
|
520
|
+
* to still be available.
|
521
|
+
*/
|
522
|
+
int
|
523
|
+
plpgsql_scanner_errposition(int location)
|
524
|
+
{
|
525
|
+
int pos;
|
526
|
+
|
527
|
+
if (location < 0 || scanorig == NULL)
|
528
|
+
return 0; /* no-op if location is unknown */
|
529
|
+
|
530
|
+
/* Convert byte offset to character number */
|
531
|
+
pos = pg_mbstrlen_with_len(scanorig, location) + 1;
|
532
|
+
/* And pass it to the ereport mechanism */
|
533
|
+
(void) internalerrposition(pos);
|
534
|
+
/* Also pass the function body string */
|
535
|
+
return internalerrquery(scanorig);
|
536
|
+
}
|
537
|
+
|
538
|
+
/*
|
539
|
+
* plpgsql_yyerror
|
540
|
+
* Report a lexer or grammar error.
|
541
|
+
*
|
542
|
+
* The message's cursor position refers to the current token (the one
|
543
|
+
* last returned by plpgsql_yylex()).
|
544
|
+
* This is OK for syntax error messages from the Bison parser, because Bison
|
545
|
+
* parsers report error as soon as the first unparsable token is reached.
|
546
|
+
* Beware of using yyerror for other purposes, as the cursor position might
|
547
|
+
* be misleading!
|
548
|
+
*/
|
549
|
+
void
|
550
|
+
plpgsql_yyerror(const char *message)
|
551
|
+
{
|
552
|
+
char *yytext = core_yy.scanbuf + plpgsql_yylloc;
|
553
|
+
|
554
|
+
if (*yytext == '\0')
|
555
|
+
{
|
556
|
+
ereport(ERROR,
|
557
|
+
(errcode(ERRCODE_SYNTAX_ERROR),
|
558
|
+
/* translator: %s is typically the translation of "syntax error" */
|
559
|
+
errmsg("%s at end of input", _(message)),
|
560
|
+
plpgsql_scanner_errposition(plpgsql_yylloc)));
|
561
|
+
}
|
562
|
+
else
|
563
|
+
{
|
564
|
+
/*
|
565
|
+
* If we have done any lookahead then flex will have restored the
|
566
|
+
* character after the end-of-token. Zap it again so that we report
|
567
|
+
* only the single token here. This modifies scanbuf but we no longer
|
568
|
+
* care about that.
|
569
|
+
*/
|
570
|
+
yytext[plpgsql_yyleng] = '\0';
|
571
|
+
|
572
|
+
ereport(ERROR,
|
573
|
+
(errcode(ERRCODE_SYNTAX_ERROR),
|
574
|
+
/* translator: first %s is typically the translation of "syntax error" */
|
575
|
+
errmsg("%s at or near \"%s\"", _(message), yytext),
|
576
|
+
plpgsql_scanner_errposition(plpgsql_yylloc)));
|
577
|
+
}
|
578
|
+
}
|
579
|
+
|
580
|
+
/*
|
581
|
+
* Given a location (a byte offset in the function source text),
|
582
|
+
* return a line number.
|
583
|
+
*
|
584
|
+
* We expect that this is typically called for a sequence of increasing
|
585
|
+
* location values, so optimize accordingly by tracking the endpoints
|
586
|
+
* of the "current" line.
|
587
|
+
*/
|
588
|
+
int
|
589
|
+
plpgsql_location_to_lineno(int location)
|
590
|
+
{
|
591
|
+
const char *loc;
|
592
|
+
|
593
|
+
if (location < 0 || scanorig == NULL)
|
594
|
+
return 0; /* garbage in, garbage out */
|
595
|
+
loc = scanorig + location;
|
596
|
+
|
597
|
+
/* be correct, but not fast, if input location goes backwards */
|
598
|
+
if (loc < cur_line_start)
|
599
|
+
location_lineno_init();
|
600
|
+
|
601
|
+
while (cur_line_end != NULL && loc > cur_line_end)
|
602
|
+
{
|
603
|
+
cur_line_start = cur_line_end + 1;
|
604
|
+
cur_line_num++;
|
605
|
+
cur_line_end = strchr(cur_line_start, '\n');
|
606
|
+
}
|
607
|
+
|
608
|
+
return cur_line_num;
|
609
|
+
}
|
610
|
+
|
611
|
+
/* initialize or reset the state for plpgsql_location_to_lineno */
|
612
|
+
static void
|
613
|
+
location_lineno_init(void)
|
614
|
+
{
|
615
|
+
cur_line_start = scanorig;
|
616
|
+
cur_line_num = 1;
|
617
|
+
|
618
|
+
cur_line_end = strchr(cur_line_start, '\n');
|
619
|
+
}
|
620
|
+
|
621
|
+
/* return the most recently computed lineno */
|
622
|
+
int
|
623
|
+
plpgsql_latest_lineno(void)
|
624
|
+
{
|
625
|
+
return cur_line_num;
|
626
|
+
}
|
627
|
+
|
628
|
+
|
629
|
+
/*
|
630
|
+
* Called before any actual parsing is done
|
631
|
+
*
|
632
|
+
* Note: the passed "str" must remain valid until plpgsql_scanner_finish().
|
633
|
+
* Although it is not fed directly to flex, we need the original string
|
634
|
+
* to cite in error messages.
|
635
|
+
*/
|
636
|
+
void
|
637
|
+
plpgsql_scanner_init(const char *str)
|
638
|
+
{
|
639
|
+
/* Start up the core scanner */
|
640
|
+
yyscanner = scanner_init(str, &core_yy,
|
641
|
+
&ReservedPLKeywords, ReservedPLKeywordTokens);
|
642
|
+
|
643
|
+
/*
|
644
|
+
* scanorig points to the original string, which unlike the scanner's
|
645
|
+
* scanbuf won't be modified on-the-fly by flex. Notice that although
|
646
|
+
* yytext points into scanbuf, we rely on being able to apply locations
|
647
|
+
* (offsets from string start) to scanorig as well.
|
648
|
+
*/
|
649
|
+
scanorig = str;
|
650
|
+
|
651
|
+
/* Other setup */
|
652
|
+
plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
|
653
|
+
plpgsql_yytoken = 0;
|
654
|
+
|
655
|
+
num_pushbacks = 0;
|
656
|
+
|
657
|
+
location_lineno_init();
|
658
|
+
}
|
659
|
+
|
660
|
+
/*
|
661
|
+
* Called after parsing is done to clean up after plpgsql_scanner_init()
|
662
|
+
*/
|
663
|
+
void
|
664
|
+
plpgsql_scanner_finish(void)
|
665
|
+
{
|
666
|
+
/* release storage */
|
667
|
+
scanner_finish(yyscanner);
|
668
|
+
/* avoid leaving any dangling pointers */
|
669
|
+
yyscanner = NULL;
|
670
|
+
scanorig = NULL;
|
671
|
+
}
|