pg_query 4.2.2 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +6 -8
- data/Rakefile +3 -3
- data/ext/pg_query/extconf.rb +1 -3
- data/ext/pg_query/include/access/amapi.h +3 -1
- data/ext/pg_query/include/access/attmap.h +5 -3
- data/ext/pg_query/include/access/attnum.h +1 -1
- data/ext/pg_query/include/access/clog.h +1 -1
- data/ext/pg_query/include/access/commit_ts.h +1 -1
- data/ext/pg_query/include/access/detoast.h +1 -1
- data/ext/pg_query/include/access/genam.h +7 -5
- data/ext/pg_query/include/access/gin.h +16 -3
- data/ext/pg_query/include/access/htup.h +1 -1
- data/ext/pg_query/include/access/htup_details.h +6 -2
- data/ext/pg_query/include/access/itup.h +61 -58
- data/ext/pg_query/include/access/parallel.h +2 -2
- data/ext/pg_query/include/access/printtup.h +1 -1
- data/ext/pg_query/include/access/relation.h +1 -1
- data/ext/pg_query/include/access/relscan.h +1 -1
- data/ext/pg_query/include/access/rmgrlist.h +2 -2
- data/ext/pg_query/include/access/sdir.h +12 -3
- data/ext/pg_query/include/access/skey.h +1 -1
- data/ext/pg_query/include/access/stratnum.h +1 -1
- data/ext/pg_query/include/access/sysattr.h +1 -1
- data/ext/pg_query/include/access/table.h +1 -1
- data/ext/pg_query/include/access/tableam.h +68 -45
- data/ext/pg_query/include/access/toast_compression.h +1 -1
- data/ext/pg_query/include/access/transam.h +1 -1
- data/ext/pg_query/include/access/tsmapi.h +82 -0
- data/ext/pg_query/include/access/tupconvert.h +5 -2
- data/ext/pg_query/include/access/tupdesc.h +2 -2
- data/ext/pg_query/include/access/tupmacs.h +58 -98
- data/ext/pg_query/include/access/twophase.h +2 -2
- data/ext/pg_query/include/access/xact.h +25 -18
- data/ext/pg_query/include/access/xlog.h +15 -16
- data/ext/pg_query/include/access/xlog_internal.h +100 -62
- data/ext/pg_query/include/access/xlogbackup.h +41 -0
- data/ext/pg_query/include/access/xlogdefs.h +6 -25
- data/ext/pg_query/include/access/xlogprefetcher.h +1 -1
- data/ext/pg_query/include/access/xlogreader.h +7 -6
- data/ext/pg_query/include/access/xlogrecord.h +17 -5
- data/ext/pg_query/include/access/xlogrecovery.h +4 -3
- data/ext/pg_query/include/archive/archive_module.h +59 -0
- data/ext/pg_query/include/c.h +144 -156
- data/ext/pg_query/include/catalog/catalog.h +4 -3
- data/ext/pg_query/include/catalog/catversion.h +6 -2
- data/ext/pg_query/include/catalog/dependency.h +5 -4
- data/ext/pg_query/include/catalog/genbki.h +7 -6
- data/ext/pg_query/include/catalog/index.h +4 -4
- data/ext/pg_query/include/catalog/indexing.h +1 -1
- data/ext/pg_query/include/catalog/namespace.h +2 -2
- data/ext/pg_query/include/catalog/objectaccess.h +10 -8
- data/ext/pg_query/include/catalog/objectaddress.h +3 -3
- data/ext/pg_query/include/catalog/pg_aggregate.h +1 -1
- data/ext/pg_query/include/catalog/pg_aggregate_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_am.h +1 -1
- data/ext/pg_query/include/catalog/pg_am_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_attribute.h +19 -17
- data/ext/pg_query/include/catalog/pg_attribute_d.h +19 -19
- data/ext/pg_query/include/catalog/pg_authid.h +1 -1
- data/ext/pg_query/include/catalog/pg_authid_d.h +3 -1
- data/ext/pg_query/include/catalog/pg_class.h +1 -1
- data/ext/pg_query/include/catalog/pg_class_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_collation.h +3 -1
- data/ext/pg_query/include/catalog/pg_collation_d.h +4 -3
- data/ext/pg_query/include/catalog/pg_constraint.h +2 -2
- data/ext/pg_query/include/catalog/pg_constraint_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_control.h +9 -1
- data/ext/pg_query/include/catalog/pg_conversion.h +2 -2
- data/ext/pg_query/include/catalog/pg_conversion_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_database.h +124 -0
- data/ext/pg_query/include/catalog/pg_database_d.h +52 -0
- data/ext/pg_query/include/catalog/pg_depend.h +1 -1
- data/ext/pg_query/include/catalog/pg_depend_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_event_trigger.h +1 -1
- data/ext/pg_query/include/catalog/pg_event_trigger_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_index.h +1 -1
- data/ext/pg_query/include/catalog/pg_index_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_language.h +1 -1
- data/ext/pg_query/include/catalog/pg_language_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_namespace.h +1 -1
- data/ext/pg_query/include/catalog/pg_namespace_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_opclass.h +1 -1
- data/ext/pg_query/include/catalog/pg_opclass_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_operator.h +1 -1
- data/ext/pg_query/include/catalog/pg_operator_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_opfamily.h +3 -2
- data/ext/pg_query/include/catalog/pg_opfamily_d.h +4 -2
- data/ext/pg_query/include/catalog/pg_partitioned_table.h +1 -1
- data/ext/pg_query/include/catalog/pg_partitioned_table_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_proc.h +1 -1
- data/ext/pg_query/include/catalog/pg_proc_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_publication.h +2 -5
- data/ext/pg_query/include/catalog/pg_publication_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_replication_origin.h +1 -1
- data/ext/pg_query/include/catalog/pg_replication_origin_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_statistic.h +1 -1
- data/ext/pg_query/include/catalog/pg_statistic_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_statistic_ext.h +1 -1
- data/ext/pg_query/include/catalog/pg_statistic_ext_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_transform.h +1 -1
- data/ext/pg_query/include/catalog/pg_transform_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_trigger.h +1 -1
- data/ext/pg_query/include/catalog/pg_trigger_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_ts_config.h +1 -1
- data/ext/pg_query/include/catalog/pg_ts_config_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_ts_dict.h +1 -1
- data/ext/pg_query/include/catalog/pg_ts_dict_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_ts_parser.h +1 -1
- data/ext/pg_query/include/catalog/pg_ts_parser_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_ts_template.h +1 -1
- data/ext/pg_query/include/catalog/pg_ts_template_d.h +1 -1
- data/ext/pg_query/include/catalog/pg_type.h +1 -1
- data/ext/pg_query/include/catalog/pg_type_d.h +1 -1
- data/ext/pg_query/include/catalog/storage.h +6 -6
- data/ext/pg_query/include/commands/async.h +1 -1
- data/ext/pg_query/include/commands/dbcommands.h +2 -1
- data/ext/pg_query/include/commands/defrem.h +2 -1
- data/ext/pg_query/include/commands/event_trigger.h +1 -1
- data/ext/pg_query/include/commands/explain.h +3 -1
- data/ext/pg_query/include/commands/prepare.h +1 -1
- data/ext/pg_query/include/commands/tablespace.h +4 -4
- data/ext/pg_query/include/commands/trigger.h +15 -14
- data/ext/pg_query/include/commands/user.h +9 -3
- data/ext/pg_query/include/commands/vacuum.h +60 -14
- data/ext/pg_query/include/common/cryptohash.h +39 -0
- data/ext/pg_query/include/common/file_perm.h +1 -1
- data/ext/pg_query/include/common/hashfn.h +1 -1
- data/ext/pg_query/include/common/int.h +437 -0
- data/ext/pg_query/include/common/ip.h +4 -2
- data/ext/pg_query/include/common/keywords.h +1 -1
- data/ext/pg_query/include/common/kwlookup.h +2 -2
- data/ext/pg_query/include/common/pg_prng.h +3 -2
- data/ext/pg_query/include/common/relpath.h +20 -13
- data/ext/pg_query/include/common/scram-common.h +70 -0
- data/ext/pg_query/include/common/sha2.h +32 -0
- data/ext/pg_query/include/common/string.h +5 -3
- data/ext/pg_query/include/common/unicode_east_asian_fw_table.h +10 -10
- data/ext/pg_query/include/common/{unicode_combining_table.h → unicode_nonspacing_table.h} +31 -13
- data/ext/pg_query/include/copyfuncs.funcs.c +5013 -0
- data/ext/pg_query/include/copyfuncs.switch.c +938 -0
- data/ext/pg_query/include/datatype/timestamp.h +11 -4
- data/ext/pg_query/include/equalfuncs.funcs.c +3097 -0
- data/ext/pg_query/include/equalfuncs.switch.c +785 -0
- data/ext/pg_query/include/executor/execdesc.h +1 -1
- data/ext/pg_query/include/executor/executor.h +34 -17
- data/ext/pg_query/include/executor/functions.h +1 -1
- data/ext/pg_query/include/executor/instrument.h +1 -1
- data/ext/pg_query/include/executor/spi.h +2 -2
- data/ext/pg_query/include/executor/tablefunc.h +1 -1
- data/ext/pg_query/include/executor/tuptable.h +18 -11
- data/ext/pg_query/include/fmgr.h +21 -2
- data/ext/pg_query/include/foreign/fdwapi.h +294 -0
- data/ext/pg_query/include/funcapi.h +12 -12
- data/ext/pg_query/include/gram.h +1127 -0
- data/ext/pg_query/include/{parser/gramparse.h → gramparse.h} +4 -4
- data/ext/pg_query/include/jit/jit.h +2 -2
- data/ext/pg_query/include/kwlist_d.h +534 -510
- data/ext/pg_query/include/lib/dshash.h +4 -1
- data/ext/pg_query/include/lib/ilist.h +435 -22
- data/ext/pg_query/include/lib/pairingheap.h +1 -1
- data/ext/pg_query/include/lib/simplehash.h +9 -9
- data/ext/pg_query/include/lib/sort_template.h +1 -1
- data/ext/pg_query/include/lib/stringinfo.h +3 -3
- data/ext/pg_query/include/libpq/auth.h +8 -2
- data/ext/pg_query/include/libpq/crypt.h +1 -1
- data/ext/pg_query/include/libpq/hba.h +24 -17
- data/ext/pg_query/include/libpq/libpq-be.h +36 -25
- data/ext/pg_query/include/libpq/libpq.h +1 -1
- data/ext/pg_query/include/libpq/pqcomm.h +10 -41
- data/ext/pg_query/include/libpq/pqformat.h +2 -2
- data/ext/pg_query/include/libpq/pqsignal.h +22 -10
- data/ext/pg_query/include/libpq/sasl.h +136 -0
- data/ext/pg_query/include/libpq/scram.h +37 -0
- data/ext/pg_query/include/mb/pg_wchar.h +35 -18
- data/ext/pg_query/include/mb/stringinfo_mb.h +1 -1
- data/ext/pg_query/include/miscadmin.h +26 -14
- data/ext/pg_query/include/nodes/bitmapset.h +11 -7
- data/ext/pg_query/include/nodes/execnodes.h +83 -30
- data/ext/pg_query/include/nodes/extensible.h +5 -3
- data/ext/pg_query/include/nodes/lockoptions.h +1 -1
- data/ext/pg_query/include/nodes/makefuncs.h +14 -2
- data/ext/pg_query/include/nodes/memnodes.h +7 -4
- data/ext/pg_query/include/nodes/miscnodes.h +56 -0
- data/ext/pg_query/include/nodes/nodeFuncs.h +89 -29
- data/ext/pg_query/include/nodes/nodes.h +95 -510
- data/ext/pg_query/include/nodes/nodetags.h +471 -0
- data/ext/pg_query/include/nodes/params.h +3 -3
- data/ext/pg_query/include/nodes/parsenodes.h +377 -139
- data/ext/pg_query/include/nodes/pathnodes.h +1090 -440
- data/ext/pg_query/include/nodes/pg_list.h +30 -7
- data/ext/pg_query/include/nodes/plannodes.h +367 -124
- data/ext/pg_query/include/nodes/primnodes.h +670 -222
- data/ext/pg_query/include/nodes/print.h +1 -1
- data/ext/pg_query/include/{utils → nodes}/queryjumble.h +5 -7
- data/ext/pg_query/include/nodes/replnodes.h +111 -0
- data/ext/pg_query/include/nodes/supportnodes.h +346 -0
- data/ext/pg_query/include/nodes/tidbitmap.h +1 -1
- data/ext/pg_query/include/nodes/value.h +12 -2
- data/ext/pg_query/include/optimizer/cost.h +6 -4
- data/ext/pg_query/include/optimizer/geqo.h +1 -1
- data/ext/pg_query/include/optimizer/geqo_gene.h +1 -1
- data/ext/pg_query/include/optimizer/optimizer.h +8 -8
- data/ext/pg_query/include/optimizer/paths.h +16 -7
- data/ext/pg_query/include/optimizer/planmain.h +3 -6
- data/ext/pg_query/include/parser/analyze.h +4 -3
- data/ext/pg_query/include/parser/kwlist.h +12 -1
- data/ext/pg_query/include/parser/parse_agg.h +4 -2
- data/ext/pg_query/include/parser/parse_coerce.h +3 -1
- data/ext/pg_query/include/parser/parse_expr.h +1 -1
- data/ext/pg_query/include/parser/parse_func.h +1 -1
- data/ext/pg_query/include/parser/parse_node.h +22 -4
- data/ext/pg_query/include/parser/parse_oper.h +3 -3
- data/ext/pg_query/include/parser/parse_relation.h +8 -3
- data/ext/pg_query/include/parser/parse_type.h +4 -3
- data/ext/pg_query/include/parser/parser.h +1 -1
- data/ext/pg_query/include/parser/parsetree.h +1 -1
- data/ext/pg_query/include/parser/scanner.h +2 -2
- data/ext/pg_query/include/parser/scansup.h +1 -1
- data/ext/pg_query/include/partitioning/partdefs.h +1 -1
- data/ext/pg_query/include/pg_config.h +23 -217
- data/ext/pg_query/include/pg_config_manual.h +8 -46
- data/ext/pg_query/include/pg_getopt.h +1 -1
- data/ext/pg_query/include/pg_query.h +27 -3
- data/ext/pg_query/include/pg_query_enum_defs.c +311 -149
- data/ext/pg_query/include/pg_query_fingerprint_conds.c +545 -489
- data/ext/pg_query/include/pg_query_fingerprint_defs.c +5092 -4432
- data/ext/pg_query/include/pg_query_outfuncs_conds.c +385 -343
- data/ext/pg_query/include/pg_query_outfuncs_defs.c +1294 -1161
- data/ext/pg_query/include/pg_query_readfuncs_conds.c +137 -123
- data/ext/pg_query/include/pg_query_readfuncs_defs.c +1657 -1496
- data/ext/pg_query/include/pg_trace.h +1 -1
- data/ext/pg_query/include/pgstat.h +172 -93
- data/ext/pg_query/include/pgtime.h +3 -3
- data/ext/pg_query/include/pl_gram.h +64 -62
- data/ext/pg_query/include/pl_reserved_kwlist.h +1 -1
- data/ext/pg_query/include/pl_reserved_kwlist_d.h +1 -1
- data/ext/pg_query/include/pl_unreserved_kwlist.h +2 -1
- data/ext/pg_query/include/pl_unreserved_kwlist_d.h +48 -46
- data/ext/pg_query/include/plpgsql.h +17 -22
- data/ext/pg_query/include/port/atomics/arch-arm.h +3 -3
- data/ext/pg_query/include/port/atomics/arch-ppc.h +21 -21
- data/ext/pg_query/include/port/atomics/arch-x86.h +2 -2
- data/ext/pg_query/include/port/atomics/fallback.h +3 -3
- data/ext/pg_query/include/port/atomics/generic-gcc.h +1 -1
- data/ext/pg_query/include/port/atomics/generic.h +1 -1
- data/ext/pg_query/include/port/atomics.h +2 -7
- data/ext/pg_query/include/port/pg_bitutils.h +62 -25
- data/ext/pg_query/include/port/pg_bswap.h +1 -1
- data/ext/pg_query/include/port/pg_crc32c.h +1 -1
- data/ext/pg_query/include/port/simd.h +375 -0
- data/ext/pg_query/include/port.h +42 -75
- data/ext/pg_query/include/portability/instr_time.h +81 -140
- data/ext/pg_query/include/postgres.h +205 -434
- data/ext/pg_query/include/postgres_ext.h +0 -1
- data/ext/pg_query/include/postmaster/autovacuum.h +1 -4
- data/ext/pg_query/include/postmaster/auxprocess.h +1 -1
- data/ext/pg_query/include/postmaster/bgworker.h +2 -2
- data/ext/pg_query/include/postmaster/bgworker_internals.h +1 -1
- data/ext/pg_query/include/postmaster/bgwriter.h +2 -2
- data/ext/pg_query/include/postmaster/fork_process.h +1 -1
- data/ext/pg_query/include/postmaster/interrupt.h +1 -1
- data/ext/pg_query/include/postmaster/pgarch.h +1 -38
- data/ext/pg_query/include/postmaster/postmaster.h +5 -2
- data/ext/pg_query/include/postmaster/startup.h +3 -1
- data/ext/pg_query/include/postmaster/syslogger.h +2 -2
- data/ext/pg_query/include/postmaster/walwriter.h +3 -1
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +6186 -5585
- data/ext/pg_query/include/protobuf/pg_query.pb.h +112443 -91222
- data/ext/pg_query/include/regex/regex.h +9 -6
- data/ext/pg_query/include/replication/logicallauncher.h +6 -1
- data/ext/pg_query/include/replication/logicalproto.h +30 -10
- data/ext/pg_query/include/replication/logicalworker.h +14 -1
- data/ext/pg_query/include/replication/origin.h +4 -4
- data/ext/pg_query/include/replication/reorderbuffer.h +113 -45
- data/ext/pg_query/include/replication/slot.h +25 -6
- data/ext/pg_query/include/replication/syncrep.h +2 -8
- data/ext/pg_query/include/replication/walreceiver.h +15 -9
- data/ext/pg_query/include/replication/walsender.h +13 -13
- data/ext/pg_query/include/rewrite/prs2lock.h +1 -1
- data/ext/pg_query/include/rewrite/rewriteHandler.h +1 -4
- data/ext/pg_query/include/rewrite/rewriteManip.h +11 -2
- data/ext/pg_query/include/rewrite/rewriteSupport.h +1 -1
- data/ext/pg_query/include/src_backend_nodes_copyfuncs.funcs.c +5321 -0
- data/ext/pg_query/include/src_backend_nodes_equalfuncs.funcs.c +3354 -0
- data/ext/pg_query/include/storage/backendid.h +1 -1
- data/ext/pg_query/include/storage/block.h +24 -31
- data/ext/pg_query/include/storage/buf.h +1 -1
- data/ext/pg_query/include/storage/bufmgr.h +183 -87
- data/ext/pg_query/include/storage/bufpage.h +146 -93
- data/ext/pg_query/include/storage/condition_variable.h +2 -2
- data/ext/pg_query/include/storage/dsm.h +3 -6
- data/ext/pg_query/include/storage/dsm_impl.h +4 -1
- data/ext/pg_query/include/storage/fd.h +24 -20
- data/ext/pg_query/include/storage/fileset.h +1 -1
- data/ext/pg_query/include/storage/ipc.h +1 -1
- data/ext/pg_query/include/storage/item.h +1 -1
- data/ext/pg_query/include/storage/itemid.h +1 -1
- data/ext/pg_query/include/storage/itemptr.h +94 -57
- data/ext/pg_query/include/storage/large_object.h +1 -1
- data/ext/pg_query/include/storage/latch.h +9 -1
- data/ext/pg_query/include/storage/lmgr.h +6 -1
- data/ext/pg_query/include/storage/lock.h +21 -13
- data/ext/pg_query/include/storage/lockdefs.h +3 -3
- data/ext/pg_query/include/storage/lwlock.h +16 -2
- data/ext/pg_query/include/storage/off.h +1 -1
- data/ext/pg_query/include/storage/pg_sema.h +1 -1
- data/ext/pg_query/include/storage/pg_shmem.h +1 -1
- data/ext/pg_query/include/storage/pmsignal.h +1 -1
- data/ext/pg_query/include/storage/predicate.h +2 -2
- data/ext/pg_query/include/storage/proc.h +22 -17
- data/ext/pg_query/include/storage/procarray.h +3 -2
- data/ext/pg_query/include/storage/proclist_types.h +1 -1
- data/ext/pg_query/include/storage/procsignal.h +3 -1
- data/ext/pg_query/include/storage/relfilelocator.h +99 -0
- data/ext/pg_query/include/storage/s_lock.h +66 -309
- data/ext/pg_query/include/storage/sharedfileset.h +1 -1
- data/ext/pg_query/include/storage/shm_mq.h +1 -1
- data/ext/pg_query/include/storage/shm_toc.h +1 -1
- data/ext/pg_query/include/storage/shmem.h +1 -23
- data/ext/pg_query/include/storage/sinval.h +3 -3
- data/ext/pg_query/include/storage/sinvaladt.h +4 -2
- data/ext/pg_query/include/storage/smgr.h +12 -10
- data/ext/pg_query/include/storage/spin.h +1 -1
- data/ext/pg_query/include/storage/standby.h +9 -8
- data/ext/pg_query/include/storage/standbydefs.h +1 -1
- data/ext/pg_query/include/storage/sync.h +3 -3
- data/ext/pg_query/include/tcop/cmdtag.h +7 -2
- data/ext/pg_query/include/tcop/cmdtaglist.h +1 -1
- data/ext/pg_query/include/tcop/deparse_utility.h +1 -1
- data/ext/pg_query/include/tcop/dest.h +1 -3
- data/ext/pg_query/include/tcop/fastpath.h +1 -1
- data/ext/pg_query/include/tcop/pquery.h +1 -1
- data/ext/pg_query/include/tcop/tcopprot.h +1 -4
- data/ext/pg_query/include/tcop/utility.h +1 -1
- data/ext/pg_query/include/tsearch/ts_cache.h +2 -4
- data/ext/pg_query/include/utils/acl.h +26 -81
- data/ext/pg_query/include/utils/aclchk_internal.h +1 -1
- data/ext/pg_query/include/utils/array.h +19 -1
- data/ext/pg_query/include/utils/backend_progress.h +2 -1
- data/ext/pg_query/include/utils/backend_status.h +24 -3
- data/ext/pg_query/include/utils/builtins.h +14 -5
- data/ext/pg_query/include/utils/bytea.h +1 -1
- data/ext/pg_query/include/utils/catcache.h +1 -1
- data/ext/pg_query/include/utils/date.h +37 -9
- data/ext/pg_query/include/utils/datetime.h +41 -21
- data/ext/pg_query/include/utils/datum.h +1 -1
- data/ext/pg_query/include/utils/dsa.h +5 -1
- data/ext/pg_query/include/utils/elog.h +101 -26
- data/ext/pg_query/include/utils/expandeddatum.h +14 -3
- data/ext/pg_query/include/utils/expandedrecord.h +14 -4
- data/ext/pg_query/include/utils/float.h +7 -6
- data/ext/pg_query/include/utils/fmgroids.h +54 -1
- data/ext/pg_query/include/utils/fmgrprotos.h +45 -3
- data/ext/pg_query/include/utils/fmgrtab.h +1 -1
- data/ext/pg_query/include/utils/guc.h +55 -82
- data/ext/pg_query/include/utils/guc_hooks.h +163 -0
- data/ext/pg_query/include/utils/guc_tables.h +49 -3
- data/ext/pg_query/include/utils/hsearch.h +1 -1
- data/ext/pg_query/include/utils/inval.h +3 -3
- data/ext/pg_query/include/utils/logtape.h +77 -0
- data/ext/pg_query/include/utils/lsyscache.h +5 -1
- data/ext/pg_query/include/utils/memdebug.h +1 -1
- data/ext/pg_query/include/utils/memutils.h +5 -49
- data/ext/pg_query/include/utils/memutils_internal.h +136 -0
- data/ext/pg_query/include/utils/memutils_memorychunk.h +237 -0
- data/ext/pg_query/include/utils/numeric.h +20 -5
- data/ext/pg_query/include/utils/palloc.h +8 -1
- data/ext/pg_query/include/utils/partcache.h +3 -2
- data/ext/pg_query/include/utils/pg_locale.h +22 -14
- data/ext/pg_query/include/utils/pgstat_internal.h +37 -7
- data/ext/pg_query/include/utils/pidfile.h +1 -1
- data/ext/pg_query/include/utils/plancache.h +1 -1
- data/ext/pg_query/include/utils/portal.h +1 -1
- data/ext/pg_query/include/utils/probes.h +6 -6
- data/ext/pg_query/include/utils/ps_status.h +23 -1
- data/ext/pg_query/include/utils/queryenvironment.h +1 -1
- data/ext/pg_query/include/utils/regproc.h +3 -3
- data/ext/pg_query/include/utils/rel.h +60 -43
- data/ext/pg_query/include/utils/relcache.h +13 -8
- data/ext/pg_query/include/utils/reltrigger.h +1 -1
- data/ext/pg_query/include/utils/resowner.h +1 -1
- data/ext/pg_query/include/utils/ruleutils.h +6 -1
- data/ext/pg_query/include/utils/sharedtuplestore.h +1 -1
- data/ext/pg_query/include/utils/snapmgr.h +4 -2
- data/ext/pg_query/include/utils/snapshot.h +1 -1
- data/ext/pg_query/include/utils/sortsupport.h +2 -2
- data/ext/pg_query/include/utils/syscache.h +4 -1
- data/ext/pg_query/include/utils/timeout.h +1 -1
- data/ext/pg_query/include/utils/timestamp.h +41 -11
- data/ext/pg_query/include/utils/tuplesort.h +189 -35
- data/ext/pg_query/include/utils/tuplestore.h +1 -1
- data/ext/pg_query/include/utils/typcache.h +1 -1
- data/ext/pg_query/include/utils/varlena.h +13 -1
- data/ext/pg_query/include/utils/wait_event.h +9 -4
- data/ext/pg_query/include/utils/xml.h +15 -5
- data/ext/pg_query/include/varatt.h +358 -0
- data/ext/pg_query/pg_query.c +1 -1
- data/ext/pg_query/pg_query.pb-c.c +19755 -17757
- data/ext/pg_query/pg_query_fingerprint.c +8 -3
- data/ext/pg_query/pg_query_fingerprint.h +1 -1
- data/ext/pg_query/pg_query_internal.h +1 -1
- data/ext/pg_query/pg_query_json_plpgsql.c +1 -0
- data/ext/pg_query/pg_query_normalize.c +1 -1
- data/ext/pg_query/pg_query_outfuncs_protobuf.c +2 -2
- data/ext/pg_query/pg_query_parse.c +46 -4
- data/ext/pg_query/pg_query_parse_plpgsql.c +1 -1
- data/ext/pg_query/pg_query_scan.c +1 -1
- data/ext/pg_query/pg_query_split.c +2 -2
- data/ext/pg_query/postgres_deparse.c +511 -109
- data/ext/pg_query/src_backend_catalog_namespace.c +7 -2
- data/ext/pg_query/src_backend_catalog_pg_proc.c +1 -1
- data/ext/pg_query/src_backend_commands_define.c +1 -1
- data/ext/pg_query/src_backend_nodes_bitmapset.c +11 -70
- data/ext/pg_query/src_backend_nodes_copyfuncs.c +96 -6202
- data/ext/pg_query/src_backend_nodes_equalfuncs.c +95 -4068
- data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
- data/ext/pg_query/src_backend_nodes_list.c +14 -2
- data/ext/pg_query/src_backend_nodes_makefuncs.c +95 -1
- data/ext/pg_query/src_backend_nodes_nodeFuncs.c +283 -132
- data/ext/pg_query/src_backend_nodes_value.c +1 -1
- data/ext/pg_query/src_backend_parser_gram.c +33208 -31806
- data/ext/pg_query/src_backend_parser_parser.c +28 -2
- data/ext/pg_query/src_backend_parser_scan.c +4318 -3329
- data/ext/pg_query/src_backend_parser_scansup.c +1 -1
- data/ext/pg_query/src_backend_postmaster_postmaster.c +129 -110
- data/ext/pg_query/src_backend_storage_ipc_ipc.c +1 -1
- data/ext/pg_query/src_backend_tcop_postgres.c +66 -87
- data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_datum.c +5 -7
- data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_format_type.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_numutils.c +489 -0
- data/ext/pg_query/src_backend_utils_adt_ruleutils.c +79 -5
- data/ext/pg_query/src_backend_utils_error_assert.c +4 -7
- data/ext/pg_query/src_backend_utils_error_elog.c +354 -97
- data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +33 -1
- data/ext/pg_query/src_backend_utils_init_globals.c +5 -2
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +13 -4
- data/ext/pg_query/src_backend_utils_misc_guc_tables.c +494 -0
- data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +163 -0
- data/ext/pg_query/src_backend_utils_mmgr_aset.c +449 -312
- data/ext/pg_query/src_backend_utils_mmgr_generation.c +1039 -0
- data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +398 -49
- data/ext/pg_query/src_backend_utils_mmgr_slab.c +1021 -0
- data/ext/pg_query/src_common_encnames.c +4 -1
- data/ext/pg_query/src_common_hashfn.c +1 -1
- data/ext/pg_query/src_common_keywords.c +1 -1
- data/ext/pg_query/src_common_kwlist_d.h +534 -510
- data/ext/pg_query/src_common_kwlookup.c +1 -1
- data/ext/pg_query/src_common_psprintf.c +1 -1
- data/ext/pg_query/src_common_stringinfo.c +4 -4
- data/ext/pg_query/src_common_wchar.c +9 -8
- data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +661 -694
- data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +48 -46
- data/ext/pg_query/src_port_pg_bitutils.c +1 -1
- data/ext/pg_query/src_port_pgstrcasecmp.c +29 -1
- data/ext/pg_query/src_port_snprintf.c +3 -7
- data/ext/pg_query/src_port_strerror.c +1 -1
- data/ext/pg_query/src_port_strnlen.c +1 -1
- data/lib/pg_query/pg_query_pb.rb +166 -3191
- data/lib/pg_query/treewalker.rb +7 -2
- data/lib/pg_query/version.rb +1 -1
- metadata +43 -24
- data/ext/pg_query/include/catalog/pg_parameter_acl.h +0 -60
- data/ext/pg_query/include/catalog/pg_parameter_acl_d.h +0 -34
- data/ext/pg_query/include/commands/variable.h +0 -38
- data/ext/pg_query/include/getaddrinfo.h +0 -162
- data/ext/pg_query/include/parser/gram.h +0 -1101
- data/ext/pg_query/include/storage/relfilenode.h +0 -99
- data/ext/pg_query/include/utils/dynahash.h +0 -20
- data/ext/pg_query/include/utils/pg_lsn.h +0 -29
- data/ext/pg_query/include/utils/rls.h +0 -50
- data/ext/pg_query/include/utils/tzparser.h +0 -39
- data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -371
- data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1116
- data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1993
- data/ext/pg_query/src_common_pg_prng.c +0 -152
- data/ext/pg_query/src_common_string.c +0 -92
- data/ext/pg_query/src_port_pgsleep.c +0 -69
@@ -0,0 +1,375 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* simd.h
|
4
|
+
* Support for platform-specific vector operations.
|
5
|
+
*
|
6
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
7
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
8
|
+
*
|
9
|
+
* src/include/port/simd.h
|
10
|
+
*
|
11
|
+
* NOTES
|
12
|
+
* - VectorN in this file refers to a register where the element operands
|
13
|
+
* are N bits wide. The vector width is platform-specific, so users that care
|
14
|
+
* about that will need to inspect "sizeof(VectorN)".
|
15
|
+
*
|
16
|
+
*-------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
#ifndef SIMD_H
|
19
|
+
#define SIMD_H
|
20
|
+
|
21
|
+
#if (defined(__x86_64__) || defined(_M_AMD64))
|
22
|
+
/*
|
23
|
+
* SSE2 instructions are part of the spec for the 64-bit x86 ISA. We assume
|
24
|
+
* that compilers targeting this architecture understand SSE2 intrinsics.
|
25
|
+
*
|
26
|
+
* We use emmintrin.h rather than the comprehensive header immintrin.h in
|
27
|
+
* order to exclude extensions beyond SSE2. This is because MSVC, at least,
|
28
|
+
* will allow the use of intrinsics that haven't been enabled at compile
|
29
|
+
* time.
|
30
|
+
*/
|
31
|
+
#include <emmintrin.h>
|
32
|
+
#define USE_SSE2
|
33
|
+
typedef __m128i Vector8;
|
34
|
+
typedef __m128i Vector32;
|
35
|
+
|
36
|
+
#elif defined(__aarch64__) && defined(__ARM_NEON)
|
37
|
+
/*
|
38
|
+
* We use the Neon instructions if the compiler provides access to them (as
|
39
|
+
* indicated by __ARM_NEON) and we are on aarch64. While Neon support is
|
40
|
+
* technically optional for aarch64, it appears that all available 64-bit
|
41
|
+
* hardware does have it. Neon exists in some 32-bit hardware too, but we
|
42
|
+
* could not realistically use it there without a run-time check, which seems
|
43
|
+
* not worth the trouble for now.
|
44
|
+
*/
|
45
|
+
#include <arm_neon.h>
|
46
|
+
#define USE_NEON
|
47
|
+
typedef uint8x16_t Vector8;
|
48
|
+
typedef uint32x4_t Vector32;
|
49
|
+
|
50
|
+
#else
|
51
|
+
/*
|
52
|
+
* If no SIMD instructions are available, we can in some cases emulate vector
|
53
|
+
* operations using bitwise operations on unsigned integers. Note that many
|
54
|
+
* of the functions in this file presently do not have non-SIMD
|
55
|
+
* implementations. In particular, none of the functions involving Vector32
|
56
|
+
* are implemented without SIMD since it's likely not worthwhile to represent
|
57
|
+
* two 32-bit integers using a uint64.
|
58
|
+
*/
|
59
|
+
#define USE_NO_SIMD
|
60
|
+
typedef uint64 Vector8;
|
61
|
+
#endif
|
62
|
+
|
63
|
+
/* load/store operations */
|
64
|
+
static inline void vector8_load(Vector8 *v, const uint8 *s);
|
65
|
+
#ifndef USE_NO_SIMD
|
66
|
+
static inline void vector32_load(Vector32 *v, const uint32 *s);
|
67
|
+
#endif
|
68
|
+
|
69
|
+
/* assignment operations */
|
70
|
+
static inline Vector8 vector8_broadcast(const uint8 c);
|
71
|
+
#ifndef USE_NO_SIMD
|
72
|
+
static inline Vector32 vector32_broadcast(const uint32 c);
|
73
|
+
#endif
|
74
|
+
|
75
|
+
/* element-wise comparisons to a scalar */
|
76
|
+
static inline bool vector8_has(const Vector8 v, const uint8 c);
|
77
|
+
static inline bool vector8_has_zero(const Vector8 v);
|
78
|
+
static inline bool vector8_has_le(const Vector8 v, const uint8 c);
|
79
|
+
static inline bool vector8_is_highbit_set(const Vector8 v);
|
80
|
+
#ifndef USE_NO_SIMD
|
81
|
+
static inline bool vector32_is_highbit_set(const Vector32 v);
|
82
|
+
#endif
|
83
|
+
|
84
|
+
/* arithmetic operations */
|
85
|
+
static inline Vector8 vector8_or(const Vector8 v1, const Vector8 v2);
|
86
|
+
#ifndef USE_NO_SIMD
|
87
|
+
static inline Vector32 vector32_or(const Vector32 v1, const Vector32 v2);
|
88
|
+
static inline Vector8 vector8_ssub(const Vector8 v1, const Vector8 v2);
|
89
|
+
#endif
|
90
|
+
|
91
|
+
/*
|
92
|
+
* comparisons between vectors
|
93
|
+
*
|
94
|
+
* Note: These return a vector rather than boolean, which is why we don't
|
95
|
+
* have non-SIMD implementations.
|
96
|
+
*/
|
97
|
+
#ifndef USE_NO_SIMD
|
98
|
+
static inline Vector8 vector8_eq(const Vector8 v1, const Vector8 v2);
|
99
|
+
static inline Vector32 vector32_eq(const Vector32 v1, const Vector32 v2);
|
100
|
+
#endif
|
101
|
+
|
102
|
+
/*
|
103
|
+
* Load a chunk of memory into the given vector.
|
104
|
+
*/
|
105
|
+
static inline void
|
106
|
+
vector8_load(Vector8 *v, const uint8 *s)
|
107
|
+
{
|
108
|
+
#if defined(USE_SSE2)
|
109
|
+
*v = _mm_loadu_si128((const __m128i *) s);
|
110
|
+
#elif defined(USE_NEON)
|
111
|
+
*v = vld1q_u8(s);
|
112
|
+
#else
|
113
|
+
memcpy(v, s, sizeof(Vector8));
|
114
|
+
#endif
|
115
|
+
}
|
116
|
+
|
117
|
+
#ifndef USE_NO_SIMD
|
118
|
+
static inline void
|
119
|
+
vector32_load(Vector32 *v, const uint32 *s)
|
120
|
+
{
|
121
|
+
#ifdef USE_SSE2
|
122
|
+
*v = _mm_loadu_si128((const __m128i *) s);
|
123
|
+
#elif defined(USE_NEON)
|
124
|
+
*v = vld1q_u32(s);
|
125
|
+
#endif
|
126
|
+
}
|
127
|
+
#endif /* ! USE_NO_SIMD */
|
128
|
+
|
129
|
+
/*
|
130
|
+
* Create a vector with all elements set to the same value.
|
131
|
+
*/
|
132
|
+
static inline Vector8
|
133
|
+
vector8_broadcast(const uint8 c)
|
134
|
+
{
|
135
|
+
#if defined(USE_SSE2)
|
136
|
+
return _mm_set1_epi8(c);
|
137
|
+
#elif defined(USE_NEON)
|
138
|
+
return vdupq_n_u8(c);
|
139
|
+
#else
|
140
|
+
return ~UINT64CONST(0) / 0xFF * c;
|
141
|
+
#endif
|
142
|
+
}
|
143
|
+
|
144
|
+
#ifndef USE_NO_SIMD
|
145
|
+
static inline Vector32
|
146
|
+
vector32_broadcast(const uint32 c)
|
147
|
+
{
|
148
|
+
#ifdef USE_SSE2
|
149
|
+
return _mm_set1_epi32(c);
|
150
|
+
#elif defined(USE_NEON)
|
151
|
+
return vdupq_n_u32(c);
|
152
|
+
#endif
|
153
|
+
}
|
154
|
+
#endif /* ! USE_NO_SIMD */
|
155
|
+
|
156
|
+
/*
|
157
|
+
* Return true if any elements in the vector are equal to the given scalar.
|
158
|
+
*/
|
159
|
+
static inline bool
|
160
|
+
vector8_has(const Vector8 v, const uint8 c)
|
161
|
+
{
|
162
|
+
bool result;
|
163
|
+
|
164
|
+
/* pre-compute the result for assert checking */
|
165
|
+
#ifdef USE_ASSERT_CHECKING
|
166
|
+
bool assert_result = false;
|
167
|
+
|
168
|
+
for (Size i = 0; i < sizeof(Vector8); i++)
|
169
|
+
{
|
170
|
+
if (((const uint8 *) &v)[i] == c)
|
171
|
+
{
|
172
|
+
assert_result = true;
|
173
|
+
break;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
#endif /* USE_ASSERT_CHECKING */
|
177
|
+
|
178
|
+
#if defined(USE_NO_SIMD)
|
179
|
+
/* any bytes in v equal to c will evaluate to zero via XOR */
|
180
|
+
result = vector8_has_zero(v ^ vector8_broadcast(c));
|
181
|
+
#else
|
182
|
+
result = vector8_is_highbit_set(vector8_eq(v, vector8_broadcast(c)));
|
183
|
+
#endif
|
184
|
+
|
185
|
+
Assert(assert_result == result);
|
186
|
+
return result;
|
187
|
+
}
|
188
|
+
|
189
|
+
/*
|
190
|
+
* Convenience function equivalent to vector8_has(v, 0)
|
191
|
+
*/
|
192
|
+
static inline bool
|
193
|
+
vector8_has_zero(const Vector8 v)
|
194
|
+
{
|
195
|
+
#if defined(USE_NO_SIMD)
|
196
|
+
/*
|
197
|
+
* We cannot call vector8_has() here, because that would lead to a
|
198
|
+
* circular definition.
|
199
|
+
*/
|
200
|
+
return vector8_has_le(v, 0);
|
201
|
+
#else
|
202
|
+
return vector8_has(v, 0);
|
203
|
+
#endif
|
204
|
+
}
|
205
|
+
|
206
|
+
/*
|
207
|
+
* Return true if any elements in the vector are less than or equal to the
|
208
|
+
* given scalar.
|
209
|
+
*/
|
210
|
+
static inline bool
|
211
|
+
vector8_has_le(const Vector8 v, const uint8 c)
|
212
|
+
{
|
213
|
+
bool result = false;
|
214
|
+
|
215
|
+
/* pre-compute the result for assert checking */
|
216
|
+
#ifdef USE_ASSERT_CHECKING
|
217
|
+
bool assert_result = false;
|
218
|
+
|
219
|
+
for (Size i = 0; i < sizeof(Vector8); i++)
|
220
|
+
{
|
221
|
+
if (((const uint8 *) &v)[i] <= c)
|
222
|
+
{
|
223
|
+
assert_result = true;
|
224
|
+
break;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
#endif /* USE_ASSERT_CHECKING */
|
228
|
+
|
229
|
+
#if defined(USE_NO_SIMD)
|
230
|
+
|
231
|
+
/*
|
232
|
+
* To find bytes <= c, we can use bitwise operations to find bytes < c+1,
|
233
|
+
* but it only works if c+1 <= 128 and if the highest bit in v is not set.
|
234
|
+
* Adapted from
|
235
|
+
* https://graphics.stanford.edu/~seander/bithacks.html#HasLessInWord
|
236
|
+
*/
|
237
|
+
if ((int64) v >= 0 && c < 0x80)
|
238
|
+
result = (v - vector8_broadcast(c + 1)) & ~v & vector8_broadcast(0x80);
|
239
|
+
else
|
240
|
+
{
|
241
|
+
/* one byte at a time */
|
242
|
+
for (Size i = 0; i < sizeof(Vector8); i++)
|
243
|
+
{
|
244
|
+
if (((const uint8 *) &v)[i] <= c)
|
245
|
+
{
|
246
|
+
result = true;
|
247
|
+
break;
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
#else
|
252
|
+
|
253
|
+
/*
|
254
|
+
* Use saturating subtraction to find bytes <= c, which will present as
|
255
|
+
* NUL bytes. This approach is a workaround for the lack of unsigned
|
256
|
+
* comparison instructions on some architectures.
|
257
|
+
*/
|
258
|
+
result = vector8_has_zero(vector8_ssub(v, vector8_broadcast(c)));
|
259
|
+
#endif
|
260
|
+
|
261
|
+
Assert(assert_result == result);
|
262
|
+
return result;
|
263
|
+
}
|
264
|
+
|
265
|
+
/*
|
266
|
+
* Return true if the high bit of any element is set
|
267
|
+
*/
|
268
|
+
static inline bool
|
269
|
+
vector8_is_highbit_set(const Vector8 v)
|
270
|
+
{
|
271
|
+
#ifdef USE_SSE2
|
272
|
+
return _mm_movemask_epi8(v) != 0;
|
273
|
+
#elif defined(USE_NEON)
|
274
|
+
return vmaxvq_u8(v) > 0x7F;
|
275
|
+
#else
|
276
|
+
return v & vector8_broadcast(0x80);
|
277
|
+
#endif
|
278
|
+
}
|
279
|
+
|
280
|
+
/*
|
281
|
+
* Exactly like vector8_is_highbit_set except for the input type, so it
|
282
|
+
* looks at each byte separately.
|
283
|
+
*
|
284
|
+
* XXX x86 uses the same underlying type for 8-bit, 16-bit, and 32-bit
|
285
|
+
* integer elements, but Arm does not, hence the need for a separate
|
286
|
+
* function. We could instead adopt the behavior of Arm's vmaxvq_u32(), i.e.
|
287
|
+
* check each 32-bit element, but that would require an additional mask
|
288
|
+
* operation on x86.
|
289
|
+
*/
|
290
|
+
#ifndef USE_NO_SIMD
|
291
|
+
static inline bool
|
292
|
+
vector32_is_highbit_set(const Vector32 v)
|
293
|
+
{
|
294
|
+
#if defined(USE_NEON)
|
295
|
+
return vector8_is_highbit_set((Vector8) v);
|
296
|
+
#else
|
297
|
+
return vector8_is_highbit_set(v);
|
298
|
+
#endif
|
299
|
+
}
|
300
|
+
#endif /* ! USE_NO_SIMD */
|
301
|
+
|
302
|
+
/*
|
303
|
+
* Return the bitwise OR of the inputs
|
304
|
+
*/
|
305
|
+
static inline Vector8
|
306
|
+
vector8_or(const Vector8 v1, const Vector8 v2)
|
307
|
+
{
|
308
|
+
#ifdef USE_SSE2
|
309
|
+
return _mm_or_si128(v1, v2);
|
310
|
+
#elif defined(USE_NEON)
|
311
|
+
return vorrq_u8(v1, v2);
|
312
|
+
#else
|
313
|
+
return v1 | v2;
|
314
|
+
#endif
|
315
|
+
}
|
316
|
+
|
317
|
+
#ifndef USE_NO_SIMD
|
318
|
+
static inline Vector32
|
319
|
+
vector32_or(const Vector32 v1, const Vector32 v2)
|
320
|
+
{
|
321
|
+
#ifdef USE_SSE2
|
322
|
+
return _mm_or_si128(v1, v2);
|
323
|
+
#elif defined(USE_NEON)
|
324
|
+
return vorrq_u32(v1, v2);
|
325
|
+
#endif
|
326
|
+
}
|
327
|
+
#endif /* ! USE_NO_SIMD */
|
328
|
+
|
329
|
+
/*
|
330
|
+
* Return the result of subtracting the respective elements of the input
|
331
|
+
* vectors using saturation (i.e., if the operation would yield a value less
|
332
|
+
* than zero, zero is returned instead). For more information on saturation
|
333
|
+
* arithmetic, see https://en.wikipedia.org/wiki/Saturation_arithmetic
|
334
|
+
*/
|
335
|
+
#ifndef USE_NO_SIMD
|
336
|
+
static inline Vector8
|
337
|
+
vector8_ssub(const Vector8 v1, const Vector8 v2)
|
338
|
+
{
|
339
|
+
#ifdef USE_SSE2
|
340
|
+
return _mm_subs_epu8(v1, v2);
|
341
|
+
#elif defined(USE_NEON)
|
342
|
+
return vqsubq_u8(v1, v2);
|
343
|
+
#endif
|
344
|
+
}
|
345
|
+
#endif /* ! USE_NO_SIMD */
|
346
|
+
|
347
|
+
/*
|
348
|
+
* Return a vector with all bits set in each lane where the corresponding
|
349
|
+
* lanes in the inputs are equal.
|
350
|
+
*/
|
351
|
+
#ifndef USE_NO_SIMD
|
352
|
+
static inline Vector8
|
353
|
+
vector8_eq(const Vector8 v1, const Vector8 v2)
|
354
|
+
{
|
355
|
+
#ifdef USE_SSE2
|
356
|
+
return _mm_cmpeq_epi8(v1, v2);
|
357
|
+
#elif defined(USE_NEON)
|
358
|
+
return vceqq_u8(v1, v2);
|
359
|
+
#endif
|
360
|
+
}
|
361
|
+
#endif /* ! USE_NO_SIMD */
|
362
|
+
|
363
|
+
#ifndef USE_NO_SIMD
|
364
|
+
static inline Vector32
|
365
|
+
vector32_eq(const Vector32 v1, const Vector32 v2)
|
366
|
+
{
|
367
|
+
#ifdef USE_SSE2
|
368
|
+
return _mm_cmpeq_epi32(v1, v2);
|
369
|
+
#elif defined(USE_NEON)
|
370
|
+
return vceqq_u32(v1, v2);
|
371
|
+
#endif
|
372
|
+
}
|
373
|
+
#endif /* ! USE_NO_SIMD */
|
374
|
+
|
375
|
+
#endif /* SIMD_H */
|
data/ext/pg_query/include/port.h
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
* port.h
|
4
4
|
* Header for src/port/ compatibility functions.
|
5
5
|
*
|
6
|
-
* Portions Copyright (c) 1996-
|
6
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
7
7
|
* Portions Copyright (c) 1994, Regents of the University of California
|
8
8
|
*
|
9
9
|
* src/include/port.h
|
@@ -46,14 +46,14 @@ extern bool pg_set_block(pgsocket sock);
|
|
46
46
|
|
47
47
|
/* Portable path handling for Unix/Win32 (in path.c) */
|
48
48
|
|
49
|
-
extern bool has_drive_prefix(const char *
|
49
|
+
extern bool has_drive_prefix(const char *path);
|
50
50
|
extern char *first_dir_separator(const char *filename);
|
51
51
|
extern char *last_dir_separator(const char *filename);
|
52
52
|
extern char *first_path_var_separator(const char *pathlist);
|
53
53
|
extern void join_path_components(char *ret_path,
|
54
54
|
const char *head, const char *tail);
|
55
55
|
extern void canonicalize_path(char *path);
|
56
|
-
extern void make_native_path(char *
|
56
|
+
extern void make_native_path(char *filename);
|
57
57
|
extern void cleanup_path(char *path);
|
58
58
|
extern bool path_contains_parent_reference(const char *path);
|
59
59
|
extern bool path_is_relative_and_below_cwd(const char *path);
|
@@ -208,15 +208,24 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
|
|
208
208
|
#undef printf
|
209
209
|
#endif
|
210
210
|
|
211
|
-
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
211
|
+
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args) pg_attribute_printf(3, 0);
|
212
212
|
extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
|
213
|
-
extern int pg_vsprintf(char *str, const char *fmt, va_list args);
|
213
|
+
extern int pg_vsprintf(char *str, const char *fmt, va_list args) pg_attribute_printf(2, 0);
|
214
214
|
extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3);
|
215
|
-
extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args);
|
215
|
+
extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args) pg_attribute_printf(2, 0);
|
216
216
|
extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3);
|
217
|
-
extern int pg_vprintf(const char *fmt, va_list args);
|
217
|
+
extern int pg_vprintf(const char *fmt, va_list args) pg_attribute_printf(1, 0);
|
218
218
|
extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
|
219
219
|
|
220
|
+
#ifndef WIN32
|
221
|
+
/*
|
222
|
+
* We add a pg_ prefix as a warning that the Windows implementations have the
|
223
|
+
* non-standard side-effect of changing the current file position.
|
224
|
+
*/
|
225
|
+
#define pg_pread pread
|
226
|
+
#define pg_pwrite pwrite
|
227
|
+
#endif
|
228
|
+
|
220
229
|
/*
|
221
230
|
* We use __VA_ARGS__ for printf to prevent replacing references to
|
222
231
|
* the "printf" format archetype in format() attribute declarations.
|
@@ -288,7 +297,6 @@ extern int pgunlink(const char *path);
|
|
288
297
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
289
298
|
extern int pgsymlink(const char *oldpath, const char *newpath);
|
290
299
|
extern int pgreadlink(const char *path, char *buf, size_t size);
|
291
|
-
extern bool pgwin32_is_junction(const char *path);
|
292
300
|
|
293
301
|
#define symlink(oldpath, newpath) pgsymlink(oldpath, newpath)
|
294
302
|
#define readlink(path, buf, size) pgreadlink(path, buf, size)
|
@@ -332,11 +340,6 @@ extern FILE *pgwin32_popen(const char *command, const char *type);
|
|
332
340
|
#define popen(a,b) pgwin32_popen(a,b)
|
333
341
|
#define pclose(a) _pclose(a)
|
334
342
|
|
335
|
-
/* New versions of MingW have gettimeofday, old mingw and msvc don't */
|
336
|
-
#ifndef HAVE_GETTIMEOFDAY
|
337
|
-
/* Last parameter not used */
|
338
|
-
extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
|
339
|
-
#endif
|
340
343
|
#else /* !WIN32 */
|
341
344
|
|
342
345
|
/*
|
@@ -370,10 +373,6 @@ extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
|
|
370
373
|
#define pgoff_t off_t
|
371
374
|
#endif
|
372
375
|
|
373
|
-
#ifndef HAVE_FLS
|
374
|
-
extern int fls(int mask);
|
375
|
-
#endif
|
376
|
-
|
377
376
|
#ifndef HAVE_GETPEEREID
|
378
377
|
/* On Windows, Perl might have incompatible definitions of uid_t and gid_t. */
|
379
378
|
#ifndef PLPERL_HAVE_UID_GID
|
@@ -401,16 +400,13 @@ extern int getpeereid(int sock, uid_t *uid, gid_t *gid);
|
|
401
400
|
extern void explicit_bzero(void *buf, size_t len);
|
402
401
|
#endif
|
403
402
|
|
404
|
-
#ifndef HAVE_STRTOF
|
405
|
-
extern float strtof(const char *nptr, char **endptr);
|
406
|
-
#endif
|
407
|
-
|
408
403
|
#ifdef HAVE_BUGGY_STRTOF
|
409
404
|
extern float pg_strtof(const char *nptr, char **endptr);
|
410
405
|
#define strtof(a,b) (pg_strtof((a),(b)))
|
411
406
|
#endif
|
412
407
|
|
413
|
-
#
|
408
|
+
#ifdef WIN32
|
409
|
+
/* src/port/win32link.c */
|
414
410
|
extern int link(const char *src, const char *dst);
|
415
411
|
#endif
|
416
412
|
|
@@ -424,25 +420,6 @@ extern char *mkdtemp(char *path);
|
|
424
420
|
extern int inet_aton(const char *cp, struct in_addr *addr);
|
425
421
|
#endif
|
426
422
|
|
427
|
-
/*
|
428
|
-
* Windows and older Unix don't have pread(2) and pwrite(2). We have
|
429
|
-
* replacement functions, but they have slightly different semantics so we'll
|
430
|
-
* use a name with a pg_ prefix to avoid confusion.
|
431
|
-
*/
|
432
|
-
#ifdef HAVE_PREAD
|
433
|
-
#define pg_pread pread
|
434
|
-
#else
|
435
|
-
extern ssize_t pg_pread(int fd, void *buf, size_t nbyte, off_t offset);
|
436
|
-
#endif
|
437
|
-
|
438
|
-
#ifdef HAVE_PWRITE
|
439
|
-
#define pg_pwrite pwrite
|
440
|
-
#else
|
441
|
-
extern ssize_t pg_pwrite(int fd, const void *buf, size_t nbyte, off_t offset);
|
442
|
-
#endif
|
443
|
-
|
444
|
-
/* For pg_pwritev() and pg_preadv(), see port/pg_iovec.h. */
|
445
|
-
|
446
423
|
#if !HAVE_DECL_STRLCAT
|
447
424
|
extern size_t strlcat(char *dst, const char *src, size_t siz);
|
448
425
|
#endif
|
@@ -455,37 +432,6 @@ extern size_t strlcpy(char *dst, const char *src, size_t siz);
|
|
455
432
|
extern size_t strnlen(const char *str, size_t maxlen);
|
456
433
|
#endif
|
457
434
|
|
458
|
-
#ifndef HAVE_SETENV
|
459
|
-
extern int setenv(const char *name, const char *value, int overwrite);
|
460
|
-
#endif
|
461
|
-
|
462
|
-
#ifndef HAVE_UNSETENV
|
463
|
-
extern int unsetenv(const char *name);
|
464
|
-
#endif
|
465
|
-
|
466
|
-
#ifndef HAVE_DLOPEN
|
467
|
-
extern void *dlopen(const char *file, int mode);
|
468
|
-
extern void *dlsym(void *handle, const char *symbol);
|
469
|
-
extern int dlclose(void *handle);
|
470
|
-
extern char *dlerror(void);
|
471
|
-
#endif
|
472
|
-
|
473
|
-
/*
|
474
|
-
* In some older systems, the RTLD_NOW flag isn't defined and the mode
|
475
|
-
* argument to dlopen must always be 1.
|
476
|
-
*/
|
477
|
-
#if !HAVE_DECL_RTLD_NOW
|
478
|
-
#define RTLD_NOW 1
|
479
|
-
#endif
|
480
|
-
|
481
|
-
/*
|
482
|
-
* The RTLD_GLOBAL flag is wanted if available, but it doesn't exist
|
483
|
-
* everywhere. If it doesn't exist, set it to 0 so it has no effect.
|
484
|
-
*/
|
485
|
-
#if !HAVE_DECL_RTLD_GLOBAL
|
486
|
-
#define RTLD_GLOBAL 0
|
487
|
-
#endif
|
488
|
-
|
489
435
|
/* thread.c */
|
490
436
|
#ifndef WIN32
|
491
437
|
extern bool pg_get_user_name(uid_t user_id, char *buffer, size_t buflen);
|
@@ -506,7 +452,7 @@ extern void qsort_arg(void *base, size_t nel, size_t elsize,
|
|
506
452
|
extern void qsort_interruptible(void *base, size_t nel, size_t elsize,
|
507
453
|
qsort_arg_comparator cmp, void *arg);
|
508
454
|
|
509
|
-
extern void *bsearch_arg(const void *key, const void *
|
455
|
+
extern void *bsearch_arg(const void *key, const void *base0,
|
510
456
|
size_t nmemb, size_t size,
|
511
457
|
int (*compar) (const void *, const void *, void *),
|
512
458
|
void *arg);
|
@@ -539,15 +485,36 @@ extern int pg_check_dir(const char *dir);
|
|
539
485
|
extern int pg_mkdir_p(char *path, int omode);
|
540
486
|
|
541
487
|
/* port/pqsignal.c */
|
542
|
-
typedef void (*pqsigfunc) (
|
488
|
+
typedef void (*pqsigfunc) (SIGNAL_ARGS);
|
543
489
|
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
|
544
490
|
|
545
491
|
/* port/quotes.c */
|
546
492
|
extern char *escape_single_quotes_ascii(const char *src);
|
547
493
|
|
548
494
|
/* common/wait_error.c */
|
549
|
-
extern char *wait_result_to_str(int
|
495
|
+
extern char *wait_result_to_str(int exitstatus);
|
550
496
|
extern bool wait_result_is_signal(int exit_status, int signum);
|
551
497
|
extern bool wait_result_is_any_signal(int exit_status, bool include_command_not_found);
|
498
|
+
extern int wait_result_to_exit_code(int exit_status);
|
499
|
+
|
500
|
+
/*
|
501
|
+
* Interfaces that we assume all Unix system have. We retain individual macros
|
502
|
+
* for better documentation.
|
503
|
+
*
|
504
|
+
* For symlink-related functions, there is often no need to test these macros,
|
505
|
+
* because we provided basic support on Windows that can work with absolute
|
506
|
+
* paths to directories. Code that wants to test for complete symlink support
|
507
|
+
* (including relative paths and non-directories) should be conditional on
|
508
|
+
* HAVE_READLINK or HAVE_SYMLINK.
|
509
|
+
*/
|
510
|
+
#ifndef WIN32
|
511
|
+
#define HAVE_GETRLIMIT 1
|
512
|
+
#define HAVE_POLL 1
|
513
|
+
#define HAVE_POLL_H 1
|
514
|
+
#define HAVE_READLINK 1
|
515
|
+
#define HAVE_SETSID 1
|
516
|
+
#define HAVE_SHM_OPEN 1
|
517
|
+
#define HAVE_SYMLINK 1
|
518
|
+
#endif
|
552
519
|
|
553
520
|
#endif /* PG_PORT_H */
|