pg_query 2.0.3 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +165 -0
- data/README.md +67 -29
- data/Rakefile +8 -23
- data/ext/pg_query/extconf.rb +21 -3
- data/ext/pg_query/include/pg_query.h +29 -4
- data/ext/pg_query/include/pg_query_enum_defs.c +551 -272
- data/ext/pg_query/include/pg_query_fingerprint_conds.c +563 -470
- data/ext/pg_query/include/pg_query_fingerprint_defs.c +5403 -3945
- data/ext/pg_query/include/pg_query_outfuncs_conds.c +402 -330
- data/ext/pg_query/include/pg_query_outfuncs_defs.c +1319 -1059
- data/ext/pg_query/include/pg_query_readfuncs_conds.c +141 -118
- data/ext/pg_query/include/pg_query_readfuncs_defs.c +1685 -1379
- data/ext/pg_query/include/{access → postgres/access}/amapi.h +47 -1
- data/ext/pg_query/include/{access → postgres/access}/attmap.h +5 -3
- data/ext/pg_query/include/{access → postgres/access}/attnum.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/clog.h +4 -2
- data/ext/pg_query/include/{access → postgres/access}/commit_ts.h +6 -9
- data/ext/pg_query/include/{access → postgres/access}/detoast.h +1 -11
- data/ext/pg_query/include/{access → postgres/access}/genam.h +21 -16
- data/ext/pg_query/include/{access → postgres/access}/gin.h +17 -4
- data/ext/pg_query/include/{access → postgres/access}/htup.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/htup_details.h +80 -88
- data/ext/pg_query/include/{access → postgres/access}/itup.h +61 -52
- data/ext/pg_query/include/{access → postgres/access}/parallel.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/printtup.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/relation.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/relscan.h +17 -2
- data/ext/pg_query/include/postgres/access/rmgr.h +62 -0
- data/ext/pg_query/include/{access → postgres/access}/rmgrlist.h +24 -24
- data/ext/pg_query/include/{access → postgres/access}/sdir.h +12 -3
- data/ext/pg_query/include/{access → postgres/access}/skey.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/stratnum.h +4 -2
- data/ext/pg_query/include/{access → postgres/access}/sysattr.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/table.h +2 -1
- data/ext/pg_query/include/{access → postgres/access}/tableam.h +337 -62
- data/ext/pg_query/include/postgres/access/toast_compression.h +73 -0
- data/ext/pg_query/include/{access → postgres/access}/transam.h +123 -13
- data/ext/pg_query/include/postgres/access/tsmapi.h +82 -0
- data/ext/pg_query/include/{access → postgres/access}/tupconvert.h +5 -2
- data/ext/pg_query/include/{access → postgres/access}/tupdesc.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/tupmacs.h +60 -100
- data/ext/pg_query/include/{access → postgres/access}/twophase.h +5 -1
- data/ext/pg_query/include/{access → postgres/access}/xact.h +99 -32
- data/ext/pg_query/include/{access → postgres/access}/xlog.h +69 -165
- data/ext/pg_query/include/{access → postgres/access}/xlog_internal.h +147 -73
- data/ext/pg_query/include/postgres/access/xlogbackup.h +41 -0
- data/ext/pg_query/include/{access → postgres/access}/xlogdefs.h +13 -40
- data/ext/pg_query/include/postgres/access/xlogprefetcher.h +55 -0
- data/ext/pg_query/include/{access → postgres/access}/xlogreader.h +154 -37
- data/ext/pg_query/include/{access → postgres/access}/xlogrecord.h +34 -13
- data/ext/pg_query/include/postgres/access/xlogrecovery.h +158 -0
- data/ext/pg_query/include/postgres/archive/archive_module.h +59 -0
- data/ext/pg_query/include/{c.h → postgres/c.h} +245 -188
- data/ext/pg_query/include/{catalog → postgres/catalog}/catalog.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/catversion.h +6 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/dependency.h +14 -19
- data/ext/pg_query/include/postgres/catalog/genbki.h +143 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/index.h +20 -5
- data/ext/pg_query/include/postgres/catalog/indexing.h +54 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/namespace.h +5 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaccess.h +73 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaddress.h +12 -7
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate.h +14 -10
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate_d.h +2 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am.h +4 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute.h +45 -26
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute_d.h +19 -16
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid.h +7 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid_d.h +19 -9
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class.h +45 -15
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class_d.h +31 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation.h +35 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation_d.h +21 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint.h +39 -13
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint_d.h +10 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_control.h +13 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion.h +8 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion_d.h +4 -1
- data/ext/pg_query/include/postgres/catalog/pg_database.h +124 -0
- data/ext/pg_query/include/postgres/catalog/pg_database_d.h +52 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend.h +11 -7
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger.h +9 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index.h +17 -7
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index_d.h +20 -17
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language.h +10 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace.h +7 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass.h +8 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator.h +21 -16
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator_d.h +37 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily.h +8 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily_d.h +6 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table.h +20 -9
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table_d.h +2 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc.h +20 -11
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc_d.h +10 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication.h +49 -6
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin.h +6 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin_d.h +5 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic.h +19 -12
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_d.h +2 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext.h +19 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext_d.h +7 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform.h +8 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger.h +24 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger_d.h +4 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict.h +8 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type.h +56 -24
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type_d.h +70 -31
- data/ext/pg_query/include/{catalog → postgres/catalog}/storage.h +9 -7
- data/ext/pg_query/include/{commands → postgres/commands}/async.h +4 -5
- data/ext/pg_query/include/{commands → postgres/commands}/dbcommands.h +3 -1
- data/ext/pg_query/include/{commands → postgres/commands}/defrem.h +12 -24
- data/ext/pg_query/include/{commands → postgres/commands}/event_trigger.h +2 -2
- data/ext/pg_query/include/{commands → postgres/commands}/explain.h +3 -1
- data/ext/pg_query/include/{commands → postgres/commands}/prepare.h +1 -1
- data/ext/pg_query/include/{commands → postgres/commands}/tablespace.h +6 -4
- data/ext/pg_query/include/{commands → postgres/commands}/trigger.h +36 -25
- data/ext/pg_query/include/{commands → postgres/commands}/user.h +10 -4
- data/ext/pg_query/include/{commands → postgres/commands}/vacuum.h +140 -47
- data/ext/pg_query/include/postgres/common/cryptohash.h +39 -0
- data/ext/pg_query/include/{common → postgres/common}/file_perm.h +4 -4
- data/ext/pg_query/include/{common → postgres/common}/hashfn.h +1 -1
- data/ext/pg_query/include/postgres/common/int.h +437 -0
- data/ext/pg_query/include/{common → postgres/common}/keywords.h +2 -6
- data/ext/pg_query/include/{common → postgres/common}/kwlookup.h +2 -2
- data/ext/pg_query/include/postgres/common/pg_prng.h +61 -0
- data/ext/pg_query/include/{common → postgres/common}/relpath.h +21 -14
- data/ext/pg_query/include/postgres/common/scram-common.h +70 -0
- data/ext/pg_query/include/postgres/common/sha2.h +32 -0
- data/ext/pg_query/include/postgres/common/string.h +44 -0
- data/ext/pg_query/include/postgres/common/unicode_east_asian_fw_table.h +125 -0
- data/ext/pg_query/include/{common/unicode_combining_table.h → postgres/common/unicode_nonspacing_table.h} +138 -8
- data/ext/pg_query/include/postgres/copyfuncs.funcs.c +5013 -0
- data/ext/pg_query/include/postgres/copyfuncs.switch.c +938 -0
- data/ext/pg_query/include/{datatype → postgres/datatype}/timestamp.h +50 -4
- data/ext/pg_query/include/postgres/equalfuncs.funcs.c +3097 -0
- data/ext/pg_query/include/postgres/equalfuncs.switch.c +785 -0
- data/ext/pg_query/include/{executor → postgres/executor}/execdesc.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/executor.h +98 -32
- data/ext/pg_query/include/{executor → postgres/executor}/functions.h +17 -3
- data/ext/pg_query/include/{executor → postgres/executor}/instrument.h +33 -16
- data/ext/pg_query/include/{executor → postgres/executor}/spi.h +42 -4
- data/ext/pg_query/include/{executor → postgres/executor}/tablefunc.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/tuptable.h +18 -11
- data/ext/pg_query/include/{fmgr.h → postgres/fmgr.h} +33 -8
- data/ext/pg_query/include/postgres/foreign/fdwapi.h +294 -0
- data/ext/pg_query/include/{funcapi.h → postgres/funcapi.h} +22 -10
- data/ext/pg_query/include/postgres/gram.h +1127 -0
- data/ext/pg_query/include/{parser → postgres}/gramparse.h +4 -4
- data/ext/pg_query/include/{jit → postgres/jit}/jit.h +12 -12
- data/ext/pg_query/include/postgres/kwlist_d.h +1119 -0
- data/ext/pg_query/include/postgres/lib/dshash.h +115 -0
- data/ext/pg_query/include/{lib → postgres/lib}/ilist.h +454 -22
- data/ext/pg_query/include/{lib → postgres/lib}/pairingheap.h +1 -1
- data/ext/pg_query/include/{lib → postgres/lib}/simplehash.h +158 -33
- data/ext/pg_query/include/postgres/lib/sort_template.h +432 -0
- data/ext/pg_query/include/{lib → postgres/lib}/stringinfo.h +3 -3
- data/ext/pg_query/include/{libpq → postgres/libpq}/auth.h +12 -4
- data/ext/pg_query/include/{libpq → postgres/libpq}/crypt.h +5 -4
- data/ext/pg_query/include/{libpq → postgres/libpq}/hba.h +54 -8
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq-be.h +45 -17
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq.h +31 -20
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqcomm.h +26 -71
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqformat.h +2 -2
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqsignal.h +25 -13
- data/ext/pg_query/include/postgres/libpq/sasl.h +136 -0
- data/ext/pg_query/include/postgres/libpq/scram.h +37 -0
- data/ext/pg_query/include/{mb → postgres/mb}/pg_wchar.h +125 -25
- data/ext/pg_query/include/{mb → postgres/mb}/stringinfo_mb.h +1 -1
- data/ext/pg_query/include/{miscadmin.h → postgres/miscadmin.h} +96 -65
- data/ext/pg_query/include/{nodes → postgres/nodes}/bitmapset.h +11 -7
- data/ext/pg_query/include/{nodes → postgres/nodes}/execnodes.h +351 -103
- data/ext/pg_query/include/{nodes → postgres/nodes}/extensible.h +8 -4
- data/ext/pg_query/include/{nodes → postgres/nodes}/lockoptions.h +1 -1
- data/ext/pg_query/include/{nodes → postgres/nodes}/makefuncs.h +19 -6
- data/ext/pg_query/include/{nodes → postgres/nodes}/memnodes.h +11 -6
- data/ext/pg_query/include/postgres/nodes/miscnodes.h +56 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/nodeFuncs.h +89 -29
- data/ext/pg_query/include/{nodes → postgres/nodes}/nodes.h +100 -496
- data/ext/pg_query/include/postgres/nodes/nodetags.h +471 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/params.h +3 -3
- data/ext/pg_query/include/{nodes → postgres/nodes}/parsenodes.h +678 -207
- data/ext/pg_query/include/{nodes → postgres/nodes}/pathnodes.h +1282 -454
- data/ext/pg_query/include/{nodes → postgres/nodes}/pg_list.h +103 -73
- data/ext/pg_query/include/{nodes → postgres/nodes}/plannodes.h +474 -133
- data/ext/pg_query/include/{nodes → postgres/nodes}/primnodes.h +754 -254
- data/ext/pg_query/include/{nodes → postgres/nodes}/print.h +1 -1
- data/ext/pg_query/include/postgres/nodes/queryjumble.h +86 -0
- data/ext/pg_query/include/postgres/nodes/replnodes.h +111 -0
- data/ext/pg_query/include/postgres/nodes/supportnodes.h +346 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/tidbitmap.h +1 -1
- data/ext/pg_query/include/postgres/nodes/value.h +90 -0
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/cost.h +14 -5
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo.h +9 -7
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo_gene.h +1 -1
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/optimizer.h +31 -28
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/paths.h +29 -12
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/planmain.h +15 -17
- data/ext/pg_query/include/{parser → postgres/parser}/analyze.h +20 -5
- data/ext/pg_query/include/postgres/parser/kwlist.h +498 -0
- data/ext/pg_query/include/{parser → postgres/parser}/parse_agg.h +5 -8
- data/ext/pg_query/include/{parser → postgres/parser}/parse_coerce.h +6 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_expr.h +2 -3
- data/ext/pg_query/include/{parser → postgres/parser}/parse_func.h +2 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_node.h +41 -11
- data/ext/pg_query/include/{parser → postgres/parser}/parse_oper.h +3 -5
- data/ext/pg_query/include/{parser → postgres/parser}/parse_relation.h +11 -5
- data/ext/pg_query/include/{parser → postgres/parser}/parse_type.h +4 -3
- data/ext/pg_query/include/postgres/parser/parser.h +68 -0
- data/ext/pg_query/include/{parser → postgres/parser}/parsetree.h +1 -1
- data/ext/pg_query/include/{parser → postgres/parser}/scanner.h +2 -2
- data/ext/pg_query/include/{parser → postgres/parser}/scansup.h +2 -5
- data/ext/pg_query/include/{partitioning → postgres/partitioning}/partdefs.h +1 -1
- data/ext/pg_query/include/{pg_config.h → postgres/pg_config.h} +216 -228
- data/ext/pg_query/include/{pg_config_manual.h → postgres/pg_config_manual.h} +80 -58
- data/ext/pg_query/include/postgres/pg_config_os.h +8 -0
- data/ext/pg_query/include/{pg_getopt.h → postgres/pg_getopt.h} +6 -6
- data/ext/pg_query/include/{pg_trace.h → postgres/pg_trace.h} +1 -1
- data/ext/pg_query/include/postgres/pgstat.h +778 -0
- data/ext/pg_query/include/{pgtime.h → postgres/pgtime.h} +16 -6
- data/ext/pg_query/include/{pl_gram.h → postgres/pl_gram.h} +116 -116
- data/ext/pg_query/include/{pl_reserved_kwlist.h → postgres/pl_reserved_kwlist.h} +1 -1
- data/ext/pg_query/include/{pl_reserved_kwlist_d.h → postgres/pl_reserved_kwlist_d.h} +10 -10
- data/ext/pg_query/include/{pl_unreserved_kwlist.h → postgres/pl_unreserved_kwlist.h} +3 -3
- data/ext/pg_query/include/{pl_unreserved_kwlist_d.h → postgres/pl_unreserved_kwlist_d.h} +60 -60
- data/ext/pg_query/include/{plerrcodes.h → postgres/plerrcodes.h} +9 -1
- data/ext/pg_query/include/{plpgsql.h → postgres/plpgsql.h} +79 -86
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-arm.h +9 -3
- data/ext/pg_query/include/postgres/port/atomics/arch-hppa.h +17 -0
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-ppc.h +21 -21
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-x86.h +2 -2
- data/ext/pg_query/include/{port → postgres/port}/atomics/fallback.h +3 -3
- data/ext/pg_query/include/{port → postgres/port}/atomics/generic-gcc.h +3 -3
- data/ext/pg_query/include/postgres/port/atomics/generic-msvc.h +101 -0
- data/ext/pg_query/include/postgres/port/atomics/generic-sunpro.h +106 -0
- data/ext/pg_query/include/{port → postgres/port}/atomics/generic.h +1 -1
- data/ext/pg_query/include/{port → postgres/port}/atomics.h +2 -7
- data/ext/pg_query/include/{port → postgres/port}/pg_bitutils.h +129 -16
- data/ext/pg_query/include/{port → postgres/port}/pg_bswap.h +1 -1
- data/ext/pg_query/include/{port → postgres/port}/pg_crc32c.h +1 -1
- data/ext/pg_query/include/postgres/port/simd.h +375 -0
- data/ext/pg_query/include/postgres/port/win32/arpa/inet.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/dlfcn.h +1 -0
- data/ext/pg_query/include/postgres/port/win32/grp.h +1 -0
- data/ext/pg_query/include/postgres/port/win32/netdb.h +7 -0
- data/ext/pg_query/include/postgres/port/win32/netinet/in.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/netinet/tcp.h +7 -0
- data/ext/pg_query/include/postgres/port/win32/pwd.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/sys/resource.h +20 -0
- data/ext/pg_query/include/postgres/port/win32/sys/select.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/sys/socket.h +26 -0
- data/ext/pg_query/include/postgres/port/win32/sys/un.h +17 -0
- data/ext/pg_query/include/postgres/port/win32/sys/wait.h +3 -0
- data/ext/pg_query/include/postgres/port/win32.h +59 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/dirent.h +34 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/file.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/param.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/time.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/unistd.h +9 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/utime.h +3 -0
- data/ext/pg_query/include/postgres/port/win32_port.h +594 -0
- data/ext/pg_query/include/{port.h → postgres/port.h} +107 -111
- data/ext/pg_query/include/postgres/portability/instr_time.h +197 -0
- data/ext/pg_query/include/postgres/postgres.h +579 -0
- data/ext/pg_query/include/{postgres_ext.h → postgres/postgres_ext.h} +0 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/autovacuum.h +17 -20
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker.h +3 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker_internals.h +2 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgwriter.h +6 -6
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/interrupt.h +1 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/pgarch.h +7 -10
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/postmaster.h +21 -17
- data/ext/pg_query/include/postgres/postmaster/startup.h +41 -0
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/syslogger.h +16 -11
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/walwriter.h +5 -3
- data/ext/pg_query/include/{regex → postgres/regex}/regex.h +27 -22
- data/ext/pg_query/include/{replication → postgres/replication}/logicallauncher.h +8 -5
- data/ext/pg_query/include/postgres/replication/logicalproto.h +274 -0
- data/ext/pg_query/include/postgres/replication/logicalworker.h +32 -0
- data/ext/pg_query/include/{replication → postgres/replication}/origin.h +8 -8
- data/ext/pg_query/include/postgres/replication/reorderbuffer.h +753 -0
- data/ext/pg_query/include/{replication → postgres/replication}/slot.h +42 -12
- data/ext/pg_query/include/{replication → postgres/replication}/syncrep.h +6 -12
- data/ext/pg_query/include/{replication → postgres/replication}/walreceiver.h +158 -20
- data/ext/pg_query/include/{replication → postgres/replication}/walsender.h +20 -20
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/prs2lock.h +1 -1
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteHandler.h +1 -6
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteManip.h +11 -2
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteSupport.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/backendid.h +3 -3
- data/ext/pg_query/include/{storage → postgres/storage}/block.h +24 -37
- data/ext/pg_query/include/{storage → postgres/storage}/buf.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/bufmgr.h +196 -95
- data/ext/pg_query/include/{storage → postgres/storage}/bufpage.h +152 -101
- data/ext/pg_query/include/{storage → postgres/storage}/condition_variable.h +14 -3
- data/ext/pg_query/include/{storage → postgres/storage}/dsm.h +6 -6
- data/ext/pg_query/include/{storage → postgres/storage}/dsm_impl.h +6 -2
- data/ext/pg_query/include/{storage → postgres/storage}/fd.h +48 -14
- data/ext/pg_query/include/postgres/storage/fileset.h +40 -0
- data/ext/pg_query/include/{storage → postgres/storage}/ipc.h +5 -2
- data/ext/pg_query/include/{storage → postgres/storage}/item.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/itemid.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/itemptr.h +96 -57
- data/ext/pg_query/include/{storage → postgres/storage}/large_object.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/latch.h +17 -13
- data/ext/pg_query/include/{storage → postgres/storage}/lmgr.h +7 -1
- data/ext/pg_query/include/{storage → postgres/storage}/lock.h +37 -25
- data/ext/pg_query/include/{storage → postgres/storage}/lockdefs.h +4 -4
- data/ext/pg_query/include/{storage → postgres/storage}/lwlock.h +21 -33
- data/ext/pg_query/include/{storage → postgres/storage}/lwlocknames.h +0 -1
- data/ext/pg_query/include/{storage → postgres/storage}/off.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pg_sema.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pg_shmem.h +9 -7
- data/ext/pg_query/include/{storage → postgres/storage}/pmsignal.h +15 -4
- data/ext/pg_query/include/{storage → postgres/storage}/predicate.h +5 -5
- data/ext/pg_query/include/{storage → postgres/storage}/proc.h +200 -67
- data/ext/pg_query/include/postgres/storage/procarray.h +99 -0
- data/ext/pg_query/include/{storage → postgres/storage}/proclist_types.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/procsignal.h +5 -7
- data/ext/pg_query/include/postgres/storage/relfilelocator.h +99 -0
- data/ext/pg_query/include/{storage → postgres/storage}/s_lock.h +118 -298
- data/ext/pg_query/include/{storage → postgres/storage}/sharedfileset.h +3 -11
- data/ext/pg_query/include/{storage → postgres/storage}/shm_mq.h +5 -4
- data/ext/pg_query/include/{storage → postgres/storage}/shm_toc.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/shmem.h +1 -23
- data/ext/pg_query/include/{storage → postgres/storage}/sinval.h +5 -5
- data/ext/pg_query/include/{storage → postgres/storage}/sinvaladt.h +4 -2
- data/ext/pg_query/include/{storage → postgres/storage}/smgr.h +21 -17
- data/ext/pg_query/include/{storage → postgres/storage}/spin.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/standby.h +17 -9
- data/ext/pg_query/include/{storage → postgres/storage}/standbydefs.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/sync.h +9 -5
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtag.h +7 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtaglist.h +3 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/deparse_utility.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/dest.h +1 -3
- data/ext/pg_query/include/{tcop → postgres/tcop}/fastpath.h +1 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/pquery.h +7 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/tcopprot.h +19 -14
- data/ext/pg_query/include/{tcop → postgres/tcop}/utility.h +7 -3
- data/ext/pg_query/include/{tsearch → postgres/tsearch}/ts_cache.h +3 -5
- data/ext/pg_query/include/{utils → postgres/utils}/acl.h +37 -71
- data/ext/pg_query/include/{utils → postgres/utils}/aclchk_internal.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/array.h +26 -2
- data/ext/pg_query/include/postgres/utils/backend_progress.h +45 -0
- data/ext/pg_query/include/postgres/utils/backend_status.h +342 -0
- data/ext/pg_query/include/{utils → postgres/utils}/builtins.h +20 -11
- data/ext/pg_query/include/{utils → postgres/utils}/bytea.h +3 -2
- data/ext/pg_query/include/{utils → postgres/utils}/catcache.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/date.h +37 -9
- data/ext/pg_query/include/{utils → postgres/utils}/datetime.h +48 -27
- data/ext/pg_query/include/{utils → postgres/utils}/datum.h +9 -1
- data/ext/pg_query/include/{utils → postgres/utils}/dsa.h +5 -1
- data/ext/pg_query/include/{utils → postgres/utils}/elog.h +154 -48
- data/ext/pg_query/include/{utils → postgres/utils}/errcodes.h +2 -0
- data/ext/pg_query/include/{utils → postgres/utils}/expandeddatum.h +14 -3
- data/ext/pg_query/include/{utils → postgres/utils}/expandedrecord.h +14 -4
- data/ext/pg_query/include/{utils → postgres/utils}/float.h +13 -12
- data/ext/pg_query/include/{utils → postgres/utils}/fmgroids.h +1353 -696
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrprotos.h +243 -18
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrtab.h +6 -5
- data/ext/pg_query/include/{utils → postgres/utils}/guc.h +120 -121
- data/ext/pg_query/include/postgres/utils/guc_hooks.h +163 -0
- data/ext/pg_query/include/{utils → postgres/utils}/guc_tables.h +71 -21
- data/ext/pg_query/include/{utils → postgres/utils}/hsearch.h +15 -11
- data/ext/pg_query/include/{utils → postgres/utils}/inval.h +7 -3
- data/ext/pg_query/include/postgres/utils/logtape.h +77 -0
- data/ext/pg_query/include/{utils → postgres/utils}/lsyscache.h +16 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memdebug.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memutils.h +14 -53
- data/ext/pg_query/include/postgres/utils/memutils_internal.h +136 -0
- data/ext/pg_query/include/postgres/utils/memutils_memorychunk.h +237 -0
- data/ext/pg_query/include/{utils → postgres/utils}/numeric.h +38 -9
- data/ext/pg_query/include/{utils → postgres/utils}/palloc.h +33 -4
- data/ext/pg_query/include/{utils → postgres/utils}/partcache.h +3 -2
- data/ext/pg_query/include/{utils → postgres/utils}/pg_locale.h +37 -21
- data/ext/pg_query/include/postgres/utils/pgstat_internal.h +814 -0
- data/ext/pg_query/include/{utils → postgres/utils}/plancache.h +6 -5
- data/ext/pg_query/include/{utils → postgres/utils}/portal.h +12 -1
- data/ext/pg_query/include/{utils → postgres/utils}/probes.h +59 -59
- data/ext/pg_query/include/postgres/utils/ps_status.h +47 -0
- data/ext/pg_query/include/{utils → postgres/utils}/queryenvironment.h +1 -1
- data/ext/pg_query/include/postgres/utils/regproc.h +39 -0
- data/ext/pg_query/include/{utils → postgres/utils}/rel.h +129 -61
- data/ext/pg_query/include/{utils → postgres/utils}/relcache.h +21 -14
- data/ext/pg_query/include/{utils → postgres/utils}/reltrigger.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/resowner.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/ruleutils.h +9 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sharedtuplestore.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/snapmgr.h +38 -15
- data/ext/pg_query/include/{utils → postgres/utils}/snapshot.h +14 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sortsupport.h +117 -2
- data/ext/pg_query/include/{utils → postgres/utils}/syscache.h +9 -1
- data/ext/pg_query/include/{utils → postgres/utils}/timeout.h +11 -4
- data/ext/pg_query/include/{utils → postgres/utils}/timestamp.h +46 -15
- data/ext/pg_query/include/{utils → postgres/utils}/tuplesort.h +209 -41
- data/ext/pg_query/include/{utils → postgres/utils}/tuplestore.h +2 -2
- data/ext/pg_query/include/{utils → postgres/utils}/typcache.h +24 -17
- data/ext/pg_query/include/{utils → postgres/utils}/varlena.h +17 -3
- data/ext/pg_query/include/postgres/utils/wait_event.h +294 -0
- data/ext/pg_query/include/{utils → postgres/utils}/xml.h +18 -8
- data/ext/pg_query/include/{postgres.h → postgres/varatt.h} +65 -471
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +7494 -6382
- data/ext/pg_query/include/protobuf/pg_query.pb.h +116922 -84792
- data/ext/pg_query/include/protobuf-c/protobuf-c.h +7 -3
- data/ext/pg_query/include/protobuf-c.h +7 -3
- data/ext/pg_query/pg_query.c +10 -1
- data/ext/pg_query/pg_query.pb-c.c +21026 -17002
- data/ext/pg_query/pg_query_deparse.c +1 -9896
- data/ext/pg_query/pg_query_fingerprint.c +162 -50
- data/ext/pg_query/pg_query_fingerprint.h +3 -1
- data/ext/pg_query/pg_query_internal.h +1 -1
- data/ext/pg_query/pg_query_json_plpgsql.c +56 -12
- data/ext/pg_query/pg_query_normalize.c +259 -64
- data/ext/pg_query/pg_query_outfuncs.h +1 -0
- data/ext/pg_query/pg_query_outfuncs_json.c +71 -16
- data/ext/pg_query/pg_query_outfuncs_protobuf.c +73 -12
- data/ext/pg_query/pg_query_parse.c +47 -5
- data/ext/pg_query/pg_query_parse_plpgsql.c +86 -21
- data/ext/pg_query/pg_query_readfuncs_protobuf.c +43 -8
- data/ext/pg_query/pg_query_ruby.c +6 -1
- data/ext/pg_query/pg_query_ruby_freebsd.sym +2 -0
- data/ext/pg_query/pg_query_scan.c +3 -2
- data/ext/pg_query/pg_query_split.c +6 -5
- data/ext/pg_query/postgres_deparse.c +11067 -0
- data/ext/pg_query/postgres_deparse.h +9 -0
- data/ext/pg_query/protobuf-c.c +34 -27
- data/ext/pg_query/src_backend_catalog_namespace.c +27 -10
- data/ext/pg_query/src_backend_catalog_pg_proc.c +4 -1
- data/ext/pg_query/src_backend_commands_define.c +11 -1
- data/ext/pg_query/src_backend_nodes_bitmapset.c +13 -70
- data/ext/pg_query/src_backend_nodes_copyfuncs.c +103 -5894
- data/ext/pg_query/src_backend_nodes_equalfuncs.c +102 -3830
- data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
- data/ext/pg_query/src_backend_nodes_list.c +99 -12
- data/ext/pg_query/src_backend_nodes_makefuncs.c +99 -4
- data/ext/pg_query/src_backend_nodes_nodeFuncs.c +325 -131
- data/ext/pg_query/src_backend_nodes_nodes.c +38 -0
- data/ext/pg_query/src_backend_nodes_value.c +28 -19
- data/ext/pg_query/src_backend_parser_gram.c +36104 -32074
- data/ext/pg_query/src_backend_parser_parser.c +53 -8
- data/ext/pg_query/src_backend_parser_scan.c +4893 -3701
- data/ext/pg_query/src_backend_parser_scansup.c +4 -28
- data/ext/pg_query/src_backend_storage_ipc_ipc.c +13 -4
- data/ext/pg_query/src_backend_tcop_postgres.c +133 -105
- data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +140 -0
- data/ext/pg_query/src_backend_utils_adt_datum.c +17 -7
- data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_format_type.c +6 -2
- data/ext/pg_query/src_backend_utils_adt_numutils.c +489 -0
- data/ext/pg_query/src_backend_utils_adt_ruleutils.c +187 -19
- data/ext/pg_query/src_backend_utils_error_assert.c +17 -18
- data/ext/pg_query/src_backend_utils_error_elog.c +513 -318
- data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +44 -17
- data/ext/pg_query/src_backend_utils_init_globals.c +9 -6
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +74 -131
- data/ext/pg_query/src_backend_utils_misc_guc_tables.c +492 -0
- data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +163 -0
- data/ext/pg_query/src_backend_utils_mmgr_aset.c +453 -314
- data/ext/pg_query/src_backend_utils_mmgr_generation.c +1039 -0
- data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +549 -76
- 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 +420 -0
- data/ext/pg_query/src_common_keywords.c +15 -2
- data/ext/pg_query/src_common_kwlist_d.h +545 -498
- 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 +717 -113
- data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +49 -22
- data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -18
- data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1136 -1195
- 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 +10 -10
- data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +2 -2
- data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +60 -60
- data/ext/pg_query/src_port_pg_bitutils.c +103 -40
- data/ext/pg_query/src_port_pgstrcasecmp.c +29 -1
- data/ext/pg_query/src_port_qsort.c +12 -224
- data/ext/pg_query/src_port_snprintf.c +51 -29
- data/ext/pg_query/src_port_strerror.c +9 -19
- data/ext/pg_query/src_port_strlcpy.c +79 -0
- data/lib/pg_query/deparse.rb +7 -1
- data/lib/pg_query/filter_columns.rb +7 -5
- data/lib/pg_query/fingerprint.rb +21 -9
- data/lib/pg_query/node.rb +18 -13
- data/lib/pg_query/param_refs.rb +1 -1
- data/lib/pg_query/parse.rb +141 -50
- data/lib/pg_query/pg_query_pb.rb +175 -3031
- data/lib/pg_query/treewalker.rb +26 -2
- data/lib/pg_query/truncate.rb +54 -8
- data/lib/pg_query/version.rb +1 -1
- data/lib/pg_query.rb +0 -1
- metadata +443 -380
- data/ext/pg_query/guc-file.c +0 -0
- data/ext/pg_query/include/access/rmgr.h +0 -35
- data/ext/pg_query/include/access/xloginsert.h +0 -64
- data/ext/pg_query/include/bootstrap/bootstrap.h +0 -62
- data/ext/pg_query/include/catalog/genbki.h +0 -64
- data/ext/pg_query/include/catalog/indexing.h +0 -366
- data/ext/pg_query/include/commands/variable.h +0 -38
- data/ext/pg_query/include/common/ip.h +0 -37
- data/ext/pg_query/include/common/string.h +0 -19
- data/ext/pg_query/include/getaddrinfo.h +0 -162
- data/ext/pg_query/include/kwlist_d.h +0 -1072
- data/ext/pg_query/include/nodes/value.h +0 -61
- data/ext/pg_query/include/parser/gram.h +0 -1067
- data/ext/pg_query/include/parser/kwlist.h +0 -477
- data/ext/pg_query/include/parser/parse_clause.h +0 -54
- data/ext/pg_query/include/parser/parse_collate.h +0 -27
- data/ext/pg_query/include/parser/parse_target.h +0 -46
- data/ext/pg_query/include/parser/parser.h +0 -41
- data/ext/pg_query/include/pg_config_os.h +0 -8
- data/ext/pg_query/include/pgstat.h +0 -1487
- data/ext/pg_query/include/portability/instr_time.h +0 -256
- data/ext/pg_query/include/postmaster/fork_process.h +0 -17
- data/ext/pg_query/include/replication/logicalproto.h +0 -110
- data/ext/pg_query/include/replication/logicalworker.h +0 -19
- data/ext/pg_query/include/replication/reorderbuffer.h +0 -467
- data/ext/pg_query/include/storage/relfilenode.h +0 -99
- data/ext/pg_query/include/utils/dynahash.h +0 -19
- data/ext/pg_query/include/utils/pg_lsn.h +0 -29
- data/ext/pg_query/include/utils/pidfile.h +0 -56
- data/ext/pg_query/include/utils/ps_status.h +0 -25
- data/ext/pg_query/include/utils/regproc.h +0 -28
- 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_libpq_pqcomm.c +0 -651
- data/ext/pg_query/src_backend_parser_parse_expr.c +0 -313
- data/ext/pg_query/src_backend_postmaster_postmaster.c +0 -2230
- data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -370
- data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1086
- data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1831
- data/ext/pg_query/src_common_string.c +0 -86
- data/ext/pg_query/src_port_erand48.c +0 -127
- data/ext/pg_query/src_port_pgsleep.c +0 -69
- data/ext/pg_query/src_port_random.c +0 -31
- data/ext/pg_query/src_port_strnlen.c +0 -39
- data/lib/pg_query/json_field_names.rb +0 -1402
- /data/ext/pg_query/include/{pg_config_ext.h → postgres/pg_config_ext.h} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* snapshot.h
|
|
4
4
|
* POSTGRES snapshot definition
|
|
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/utils/snapshot.h
|
|
@@ -192,6 +192,12 @@ typedef struct SnapshotData
|
|
|
192
192
|
*/
|
|
193
193
|
uint32 speculativeToken;
|
|
194
194
|
|
|
195
|
+
/*
|
|
196
|
+
* For SNAPSHOT_NON_VACUUMABLE (and hopefully more in the future) this is
|
|
197
|
+
* used to determine whether row could be vacuumed.
|
|
198
|
+
*/
|
|
199
|
+
struct GlobalVisState *vistest;
|
|
200
|
+
|
|
195
201
|
/*
|
|
196
202
|
* Book-keeping information, used by the snapshot manager
|
|
197
203
|
*/
|
|
@@ -201,6 +207,13 @@ typedef struct SnapshotData
|
|
|
201
207
|
|
|
202
208
|
TimestampTz whenTaken; /* timestamp when snapshot was taken */
|
|
203
209
|
XLogRecPtr lsn; /* position in the WAL stream when taken */
|
|
210
|
+
|
|
211
|
+
/*
|
|
212
|
+
* The transaction completion count at the time GetSnapshotData() built
|
|
213
|
+
* this snapshot. Allows to avoid re-computing static snapshots when no
|
|
214
|
+
* transactions completed since the last GetSnapshotData().
|
|
215
|
+
*/
|
|
216
|
+
uint64 snapXactCompletionCount;
|
|
204
217
|
} SnapshotData;
|
|
205
218
|
|
|
206
219
|
#endif /* SNAPSHOT_H */
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* function will have a shim set up by sort support automatically. However,
|
|
25
25
|
* opclasses that support the optional additional abbreviated key capability
|
|
26
26
|
* must always provide an authoritative comparator used to tie-break
|
|
27
|
-
* inconclusive abbreviated comparisons and also used
|
|
27
|
+
* inconclusive abbreviated comparisons and also used when aborting
|
|
28
28
|
* abbreviation. Furthermore, a converter and abort/costing function must be
|
|
29
29
|
* provided.
|
|
30
30
|
*
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* function for such cases, but probably not any other acceleration method.
|
|
43
43
|
*
|
|
44
44
|
*
|
|
45
|
-
* Portions Copyright (c) 1996-
|
|
45
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
46
46
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
47
47
|
*
|
|
48
48
|
* src/include/utils/sortsupport.h
|
|
@@ -229,6 +229,109 @@ ApplySortComparator(Datum datum1, bool isNull1,
|
|
|
229
229
|
return compare;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
static inline int
|
|
233
|
+
ApplyUnsignedSortComparator(Datum datum1, bool isNull1,
|
|
234
|
+
Datum datum2, bool isNull2,
|
|
235
|
+
SortSupport ssup)
|
|
236
|
+
{
|
|
237
|
+
int compare;
|
|
238
|
+
|
|
239
|
+
if (isNull1)
|
|
240
|
+
{
|
|
241
|
+
if (isNull2)
|
|
242
|
+
compare = 0; /* NULL "=" NULL */
|
|
243
|
+
else if (ssup->ssup_nulls_first)
|
|
244
|
+
compare = -1; /* NULL "<" NOT_NULL */
|
|
245
|
+
else
|
|
246
|
+
compare = 1; /* NULL ">" NOT_NULL */
|
|
247
|
+
}
|
|
248
|
+
else if (isNull2)
|
|
249
|
+
{
|
|
250
|
+
if (ssup->ssup_nulls_first)
|
|
251
|
+
compare = 1; /* NOT_NULL ">" NULL */
|
|
252
|
+
else
|
|
253
|
+
compare = -1; /* NOT_NULL "<" NULL */
|
|
254
|
+
}
|
|
255
|
+
else
|
|
256
|
+
{
|
|
257
|
+
compare = datum1 < datum2 ? -1 : datum1 > datum2 ? 1 : 0;
|
|
258
|
+
if (ssup->ssup_reverse)
|
|
259
|
+
INVERT_COMPARE_RESULT(compare);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return compare;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
#if SIZEOF_DATUM >= 8
|
|
266
|
+
static inline int
|
|
267
|
+
ApplySignedSortComparator(Datum datum1, bool isNull1,
|
|
268
|
+
Datum datum2, bool isNull2,
|
|
269
|
+
SortSupport ssup)
|
|
270
|
+
{
|
|
271
|
+
int compare;
|
|
272
|
+
|
|
273
|
+
if (isNull1)
|
|
274
|
+
{
|
|
275
|
+
if (isNull2)
|
|
276
|
+
compare = 0; /* NULL "=" NULL */
|
|
277
|
+
else if (ssup->ssup_nulls_first)
|
|
278
|
+
compare = -1; /* NULL "<" NOT_NULL */
|
|
279
|
+
else
|
|
280
|
+
compare = 1; /* NULL ">" NOT_NULL */
|
|
281
|
+
}
|
|
282
|
+
else if (isNull2)
|
|
283
|
+
{
|
|
284
|
+
if (ssup->ssup_nulls_first)
|
|
285
|
+
compare = 1; /* NOT_NULL ">" NULL */
|
|
286
|
+
else
|
|
287
|
+
compare = -1; /* NOT_NULL "<" NULL */
|
|
288
|
+
}
|
|
289
|
+
else
|
|
290
|
+
{
|
|
291
|
+
compare = DatumGetInt64(datum1) < DatumGetInt64(datum2) ? -1 :
|
|
292
|
+
DatumGetInt64(datum1) > DatumGetInt64(datum2) ? 1 : 0;
|
|
293
|
+
if (ssup->ssup_reverse)
|
|
294
|
+
INVERT_COMPARE_RESULT(compare);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return compare;
|
|
298
|
+
}
|
|
299
|
+
#endif
|
|
300
|
+
|
|
301
|
+
static inline int
|
|
302
|
+
ApplyInt32SortComparator(Datum datum1, bool isNull1,
|
|
303
|
+
Datum datum2, bool isNull2,
|
|
304
|
+
SortSupport ssup)
|
|
305
|
+
{
|
|
306
|
+
int compare;
|
|
307
|
+
|
|
308
|
+
if (isNull1)
|
|
309
|
+
{
|
|
310
|
+
if (isNull2)
|
|
311
|
+
compare = 0; /* NULL "=" NULL */
|
|
312
|
+
else if (ssup->ssup_nulls_first)
|
|
313
|
+
compare = -1; /* NULL "<" NOT_NULL */
|
|
314
|
+
else
|
|
315
|
+
compare = 1; /* NULL ">" NOT_NULL */
|
|
316
|
+
}
|
|
317
|
+
else if (isNull2)
|
|
318
|
+
{
|
|
319
|
+
if (ssup->ssup_nulls_first)
|
|
320
|
+
compare = 1; /* NOT_NULL ">" NULL */
|
|
321
|
+
else
|
|
322
|
+
compare = -1; /* NOT_NULL "<" NULL */
|
|
323
|
+
}
|
|
324
|
+
else
|
|
325
|
+
{
|
|
326
|
+
compare = DatumGetInt32(datum1) < DatumGetInt32(datum2) ? -1 :
|
|
327
|
+
DatumGetInt32(datum1) > DatumGetInt32(datum2) ? 1 : 0;
|
|
328
|
+
if (ssup->ssup_reverse)
|
|
329
|
+
INVERT_COMPARE_RESULT(compare);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return compare;
|
|
333
|
+
}
|
|
334
|
+
|
|
232
335
|
/*
|
|
233
336
|
* Apply a sort comparator function and return a 3-way comparison using full,
|
|
234
337
|
* authoritative comparator. This takes care of handling reverse-sort and
|
|
@@ -267,10 +370,22 @@ ApplySortAbbrevFullComparator(Datum datum1, bool isNull1,
|
|
|
267
370
|
return compare;
|
|
268
371
|
}
|
|
269
372
|
|
|
373
|
+
/*
|
|
374
|
+
* Datum comparison functions that we have specialized sort routines for.
|
|
375
|
+
* Datatypes that install these as their comparator or abbreviated comparator
|
|
376
|
+
* are eligible for faster sorting.
|
|
377
|
+
*/
|
|
378
|
+
extern int ssup_datum_unsigned_cmp(Datum x, Datum y, SortSupport ssup);
|
|
379
|
+
#if SIZEOF_DATUM >= 8
|
|
380
|
+
extern int ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup);
|
|
381
|
+
#endif
|
|
382
|
+
extern int ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup);
|
|
383
|
+
|
|
270
384
|
/* Other functions in utils/sort/sortsupport.c */
|
|
271
385
|
extern void PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup);
|
|
272
386
|
extern void PrepareSortSupportFromOrderingOp(Oid orderingOp, SortSupport ssup);
|
|
273
387
|
extern void PrepareSortSupportFromIndexRel(Relation indexRel, int16 strategy,
|
|
274
388
|
SortSupport ssup);
|
|
389
|
+
extern void PrepareSortSupportFromGistIndexRel(Relation indexRel, SortSupport ssup);
|
|
275
390
|
|
|
276
391
|
#endif /* SORTSUPPORT_H */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* See also lsyscache.h, which provides convenience routines for
|
|
7
7
|
* common cache-lookup operations.
|
|
8
8
|
*
|
|
9
|
-
* Portions Copyright (c) 1996-
|
|
9
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
10
10
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
11
11
|
*
|
|
12
12
|
* src/include/utils/syscache.h
|
|
@@ -72,13 +72,18 @@ enum SysCacheIdentifier
|
|
|
72
72
|
OPEROID,
|
|
73
73
|
OPFAMILYAMNAMENSP,
|
|
74
74
|
OPFAMILYOID,
|
|
75
|
+
PARAMETERACLNAME,
|
|
76
|
+
PARAMETERACLOID,
|
|
75
77
|
PARTRELID,
|
|
76
78
|
PROCNAMEARGSNSP,
|
|
77
79
|
PROCOID,
|
|
78
80
|
PUBLICATIONNAME,
|
|
81
|
+
PUBLICATIONNAMESPACE,
|
|
82
|
+
PUBLICATIONNAMESPACEMAP,
|
|
79
83
|
PUBLICATIONOID,
|
|
80
84
|
PUBLICATIONREL,
|
|
81
85
|
PUBLICATIONRELMAP,
|
|
86
|
+
RANGEMULTIRANGE,
|
|
82
87
|
RANGETYPE,
|
|
83
88
|
RELNAMENSP,
|
|
84
89
|
RELOID,
|
|
@@ -152,6 +157,9 @@ extern HeapTuple SearchSysCacheCopyAttNum(Oid relid, int16 attnum);
|
|
|
152
157
|
extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
|
|
153
158
|
AttrNumber attributeNumber, bool *isNull);
|
|
154
159
|
|
|
160
|
+
extern Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup,
|
|
161
|
+
AttrNumber attributeNumber);
|
|
162
|
+
|
|
155
163
|
extern uint32 GetSysCacheHashValue(int cacheId,
|
|
156
164
|
Datum key1, Datum key2, Datum key3, Datum key4);
|
|
157
165
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Routines to multiplex SIGALRM interrupts for multiple timeout reasons.
|
|
5
5
|
*
|
|
6
6
|
*
|
|
7
|
-
* Portions Copyright (c) 1996-
|
|
7
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
8
8
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
9
9
|
*
|
|
10
10
|
* src/include/utils/timeout.h
|
|
@@ -31,10 +31,14 @@ typedef enum TimeoutId
|
|
|
31
31
|
STANDBY_TIMEOUT,
|
|
32
32
|
STANDBY_LOCK_TIMEOUT,
|
|
33
33
|
IDLE_IN_TRANSACTION_SESSION_TIMEOUT,
|
|
34
|
+
IDLE_SESSION_TIMEOUT,
|
|
35
|
+
IDLE_STATS_UPDATE_TIMEOUT,
|
|
36
|
+
CLIENT_CONNECTION_CHECK_TIMEOUT,
|
|
37
|
+
STARTUP_PROGRESS_TIMEOUT,
|
|
34
38
|
/* First user-definable timeout reason */
|
|
35
39
|
USER_TIMEOUT,
|
|
36
40
|
/* Maximum number of timeout reasons */
|
|
37
|
-
MAX_TIMEOUTS =
|
|
41
|
+
MAX_TIMEOUTS = USER_TIMEOUT + 10
|
|
38
42
|
} TimeoutId;
|
|
39
43
|
|
|
40
44
|
/* callback function signature */
|
|
@@ -46,14 +50,15 @@ typedef void (*timeout_handler_proc) (void);
|
|
|
46
50
|
typedef enum TimeoutType
|
|
47
51
|
{
|
|
48
52
|
TMPARAM_AFTER,
|
|
49
|
-
TMPARAM_AT
|
|
53
|
+
TMPARAM_AT,
|
|
54
|
+
TMPARAM_EVERY
|
|
50
55
|
} TimeoutType;
|
|
51
56
|
|
|
52
57
|
typedef struct
|
|
53
58
|
{
|
|
54
59
|
TimeoutId id; /* timeout to set */
|
|
55
60
|
TimeoutType type; /* TMPARAM_AFTER or TMPARAM_AT */
|
|
56
|
-
int delay_ms; /* only used for TMPARAM_AFTER */
|
|
61
|
+
int delay_ms; /* only used for TMPARAM_AFTER/EVERY */
|
|
57
62
|
TimestampTz fin_time; /* only used for TMPARAM_AT */
|
|
58
63
|
} EnableTimeoutParams;
|
|
59
64
|
|
|
@@ -73,6 +78,8 @@ extern void reschedule_timeouts(void);
|
|
|
73
78
|
|
|
74
79
|
/* timeout operation */
|
|
75
80
|
extern void enable_timeout_after(TimeoutId id, int delay_ms);
|
|
81
|
+
extern void enable_timeout_every(TimeoutId id, TimestampTz fin_time,
|
|
82
|
+
int delay_ms);
|
|
76
83
|
extern void enable_timeout_at(TimeoutId id, TimestampTz fin_time);
|
|
77
84
|
extern void enable_timeouts(const EnableTimeoutParams *timeouts, int count);
|
|
78
85
|
extern void disable_timeout(TimeoutId id, bool keep_indicator);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* timestamp.h
|
|
4
4
|
* Definitions for the SQL "timestamp" and "interval" types.
|
|
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/utils/timestamp.h
|
|
@@ -19,18 +19,46 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
/*
|
|
22
|
-
*
|
|
22
|
+
* Functions for fmgr-callable functions.
|
|
23
23
|
*
|
|
24
24
|
* For Timestamp, we make use of the same support routines as for int64.
|
|
25
25
|
* Therefore Timestamp is pass-by-reference if and only if int64 is!
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
static inline Timestamp
|
|
28
|
+
DatumGetTimestamp(Datum X)
|
|
29
|
+
{
|
|
30
|
+
return (Timestamp) DatumGetInt64(X);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static inline TimestampTz
|
|
34
|
+
DatumGetTimestampTz(Datum X)
|
|
35
|
+
{
|
|
36
|
+
return (TimestampTz) DatumGetInt64(X);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static inline Interval *
|
|
40
|
+
DatumGetIntervalP(Datum X)
|
|
41
|
+
{
|
|
42
|
+
return (Interval *) DatumGetPointer(X);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static inline Datum
|
|
46
|
+
TimestampGetDatum(Timestamp X)
|
|
47
|
+
{
|
|
48
|
+
return Int64GetDatum(X);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static inline Datum
|
|
52
|
+
TimestampTzGetDatum(TimestampTz X)
|
|
53
|
+
{
|
|
54
|
+
return Int64GetDatum(X);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static inline Datum
|
|
58
|
+
IntervalPGetDatum(const Interval *X)
|
|
59
|
+
{
|
|
60
|
+
return PointerGetDatum(X);
|
|
61
|
+
}
|
|
34
62
|
|
|
35
63
|
#define PG_GETARG_TIMESTAMP(n) DatumGetTimestamp(PG_GETARG_DATUM(n))
|
|
36
64
|
#define PG_GETARG_TIMESTAMPTZ(n) DatumGetTimestampTz(PG_GETARG_DATUM(n))
|
|
@@ -53,14 +81,16 @@
|
|
|
53
81
|
#define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK)
|
|
54
82
|
#define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK)
|
|
55
83
|
|
|
84
|
+
/* Macros for doing timestamp arithmetic without assuming timestamp's units */
|
|
56
85
|
#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * (int64) 1000))
|
|
86
|
+
#define TimestampTzPlusSeconds(tz,s) ((tz) + ((s) * (int64) 1000000))
|
|
57
87
|
|
|
58
88
|
|
|
59
89
|
/* Set at postmaster start */
|
|
60
|
-
extern TimestampTz PgStartTime;
|
|
90
|
+
extern PGDLLIMPORT TimestampTz PgStartTime;
|
|
61
91
|
|
|
62
92
|
/* Set at configuration reload */
|
|
63
|
-
extern TimestampTz PgReloadTime;
|
|
93
|
+
extern PGDLLIMPORT TimestampTz PgReloadTime;
|
|
64
94
|
|
|
65
95
|
|
|
66
96
|
/* Internal routines (not fmgr-callable) */
|
|
@@ -83,13 +113,14 @@ extern pg_time_t timestamptz_to_time_t(TimestampTz t);
|
|
|
83
113
|
|
|
84
114
|
extern const char *timestamptz_to_str(TimestampTz t);
|
|
85
115
|
|
|
86
|
-
extern int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *
|
|
116
|
+
extern int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result);
|
|
87
117
|
extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm,
|
|
88
118
|
fsec_t *fsec, const char **tzn, pg_tz *attimezone);
|
|
89
|
-
extern void dt2time(Timestamp
|
|
119
|
+
extern void dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec);
|
|
90
120
|
|
|
91
|
-
extern
|
|
92
|
-
extern int
|
|
121
|
+
extern void interval2itm(Interval span, struct pg_itm *itm);
|
|
122
|
+
extern int itm2interval(struct pg_itm *itm, Interval *span);
|
|
123
|
+
extern int itmin2interval(struct pg_itm_in *itm_in, Interval *span);
|
|
93
124
|
|
|
94
125
|
extern Timestamp SetEpochTimestamp(void);
|
|
95
126
|
extern void GetEpochTime(struct pg_tm *tm);
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* algorithm. Parallel sorts use a variant of this external sort
|
|
12
12
|
* algorithm, and are typically only used for large amounts of data.
|
|
13
13
|
*
|
|
14
|
-
* Portions Copyright (c) 1996-
|
|
14
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
15
15
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
16
16
|
*
|
|
17
17
|
* src/include/utils/tuplesort.h
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
#include "access/itup.h"
|
|
25
25
|
#include "executor/tuptable.h"
|
|
26
26
|
#include "storage/dsm.h"
|
|
27
|
+
#include "utils/logtape.h"
|
|
27
28
|
#include "utils/relcache.h"
|
|
29
|
+
#include "utils/sortsupport.h"
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
/*
|
|
@@ -86,6 +88,15 @@ typedef enum
|
|
|
86
88
|
SORT_SPACE_TYPE_MEMORY
|
|
87
89
|
} TuplesortSpaceType;
|
|
88
90
|
|
|
91
|
+
/* Bitwise option flags for tuple sorts */
|
|
92
|
+
#define TUPLESORT_NONE 0
|
|
93
|
+
|
|
94
|
+
/* specifies whether non-sequential access to the sort result is required */
|
|
95
|
+
#define TUPLESORT_RANDOMACCESS (1 << 0)
|
|
96
|
+
|
|
97
|
+
/* specifies if the tuplesort is able to support bounded sorts */
|
|
98
|
+
#define TUPLESORT_ALLOWBOUNDED (1 << 1)
|
|
99
|
+
|
|
89
100
|
typedef struct TuplesortInstrumentation
|
|
90
101
|
{
|
|
91
102
|
TuplesortMethod sortMethod; /* sort algorithm used */
|
|
@@ -93,6 +104,148 @@ typedef struct TuplesortInstrumentation
|
|
|
93
104
|
int64 spaceUsed; /* space consumption, in kB */
|
|
94
105
|
} TuplesortInstrumentation;
|
|
95
106
|
|
|
107
|
+
/*
|
|
108
|
+
* The objects we actually sort are SortTuple structs. These contain
|
|
109
|
+
* a pointer to the tuple proper (might be a MinimalTuple or IndexTuple),
|
|
110
|
+
* which is a separate palloc chunk --- we assume it is just one chunk and
|
|
111
|
+
* can be freed by a simple pfree() (except during merge, when we use a
|
|
112
|
+
* simple slab allocator). SortTuples also contain the tuple's first key
|
|
113
|
+
* column in Datum/nullflag format, and a source/input tape number that
|
|
114
|
+
* tracks which tape each heap element/slot belongs to during merging.
|
|
115
|
+
*
|
|
116
|
+
* Storing the first key column lets us save heap_getattr or index_getattr
|
|
117
|
+
* calls during tuple comparisons. We could extract and save all the key
|
|
118
|
+
* columns not just the first, but this would increase code complexity and
|
|
119
|
+
* overhead, and wouldn't actually save any comparison cycles in the common
|
|
120
|
+
* case where the first key determines the comparison result. Note that
|
|
121
|
+
* for a pass-by-reference datatype, datum1 points into the "tuple" storage.
|
|
122
|
+
*
|
|
123
|
+
* There is one special case: when the sort support infrastructure provides an
|
|
124
|
+
* "abbreviated key" representation, where the key is (typically) a pass by
|
|
125
|
+
* value proxy for a pass by reference type. In this case, the abbreviated key
|
|
126
|
+
* is stored in datum1 in place of the actual first key column.
|
|
127
|
+
*
|
|
128
|
+
* When sorting single Datums, the data value is represented directly by
|
|
129
|
+
* datum1/isnull1 for pass by value types (or null values). If the datatype is
|
|
130
|
+
* pass-by-reference and isnull1 is false, then "tuple" points to a separately
|
|
131
|
+
* palloc'd data value, otherwise "tuple" is NULL. The value of datum1 is then
|
|
132
|
+
* either the same pointer as "tuple", or is an abbreviated key value as
|
|
133
|
+
* described above. Accordingly, "tuple" is always used in preference to
|
|
134
|
+
* datum1 as the authoritative value for pass-by-reference cases.
|
|
135
|
+
*/
|
|
136
|
+
typedef struct
|
|
137
|
+
{
|
|
138
|
+
void *tuple; /* the tuple itself */
|
|
139
|
+
Datum datum1; /* value of first key column */
|
|
140
|
+
bool isnull1; /* is first key column NULL? */
|
|
141
|
+
int srctape; /* source tape number */
|
|
142
|
+
} SortTuple;
|
|
143
|
+
|
|
144
|
+
typedef int (*SortTupleComparator) (const SortTuple *a, const SortTuple *b,
|
|
145
|
+
Tuplesortstate *state);
|
|
146
|
+
|
|
147
|
+
/*
|
|
148
|
+
* The public part of a Tuple sort operation state. This data structure
|
|
149
|
+
* contains the definition of sort-variant-specific interface methods and
|
|
150
|
+
* the part of Tuple sort operation state required by their implementations.
|
|
151
|
+
*/
|
|
152
|
+
typedef struct
|
|
153
|
+
{
|
|
154
|
+
/*
|
|
155
|
+
* These function pointers decouple the routines that must know what kind
|
|
156
|
+
* of tuple we are sorting from the routines that don't need to know it.
|
|
157
|
+
* They are set up by the tuplesort_begin_xxx routines.
|
|
158
|
+
*
|
|
159
|
+
* Function to compare two tuples; result is per qsort() convention, ie:
|
|
160
|
+
* <0, 0, >0 according as a<b, a=b, a>b. The API must match
|
|
161
|
+
* qsort_arg_comparator.
|
|
162
|
+
*/
|
|
163
|
+
SortTupleComparator comparetup;
|
|
164
|
+
|
|
165
|
+
/*
|
|
166
|
+
* Alter datum1 representation in the SortTuple's array back from the
|
|
167
|
+
* abbreviated key to the first column value.
|
|
168
|
+
*/
|
|
169
|
+
void (*removeabbrev) (Tuplesortstate *state, SortTuple *stups,
|
|
170
|
+
int count);
|
|
171
|
+
|
|
172
|
+
/*
|
|
173
|
+
* Function to write a stored tuple onto tape. The representation of the
|
|
174
|
+
* tuple on tape need not be the same as it is in memory.
|
|
175
|
+
*/
|
|
176
|
+
void (*writetup) (Tuplesortstate *state, LogicalTape *tape,
|
|
177
|
+
SortTuple *stup);
|
|
178
|
+
|
|
179
|
+
/*
|
|
180
|
+
* Function to read a stored tuple from tape back into memory. 'len' is
|
|
181
|
+
* the already-read length of the stored tuple. The tuple is allocated
|
|
182
|
+
* from the slab memory arena, or is palloc'd, see
|
|
183
|
+
* tuplesort_readtup_alloc().
|
|
184
|
+
*/
|
|
185
|
+
void (*readtup) (Tuplesortstate *state, SortTuple *stup,
|
|
186
|
+
LogicalTape *tape, unsigned int len);
|
|
187
|
+
|
|
188
|
+
/*
|
|
189
|
+
* Function to do some specific release of resources for the sort variant.
|
|
190
|
+
* In particular, this function should free everything stored in the "arg"
|
|
191
|
+
* field, which wouldn't be cleared on reset of the Tuple sort memory
|
|
192
|
+
* contexts. This can be NULL if nothing specific needs to be done.
|
|
193
|
+
*/
|
|
194
|
+
void (*freestate) (Tuplesortstate *state);
|
|
195
|
+
|
|
196
|
+
/*
|
|
197
|
+
* The subsequent fields are used in the implementations of the functions
|
|
198
|
+
* above.
|
|
199
|
+
*/
|
|
200
|
+
MemoryContext maincontext; /* memory context for tuple sort metadata that
|
|
201
|
+
* persists across multiple batches */
|
|
202
|
+
MemoryContext sortcontext; /* memory context holding most sort data */
|
|
203
|
+
MemoryContext tuplecontext; /* sub-context of sortcontext for tuple data */
|
|
204
|
+
|
|
205
|
+
/*
|
|
206
|
+
* Whether SortTuple's datum1 and isnull1 members are maintained by the
|
|
207
|
+
* above routines. If not, some sort specializations are disabled.
|
|
208
|
+
*/
|
|
209
|
+
bool haveDatum1;
|
|
210
|
+
|
|
211
|
+
/*
|
|
212
|
+
* The sortKeys variable is used by every case other than the hash index
|
|
213
|
+
* case; it is set by tuplesort_begin_xxx. tupDesc is only used by the
|
|
214
|
+
* MinimalTuple and CLUSTER routines, though.
|
|
215
|
+
*/
|
|
216
|
+
int nKeys; /* number of columns in sort key */
|
|
217
|
+
SortSupport sortKeys; /* array of length nKeys */
|
|
218
|
+
|
|
219
|
+
/*
|
|
220
|
+
* This variable is shared by the single-key MinimalTuple case and the
|
|
221
|
+
* Datum case (which both use qsort_ssup()). Otherwise, it's NULL. The
|
|
222
|
+
* presence of a value in this field is also checked by various sort
|
|
223
|
+
* specialization functions as an optimization when comparing the leading
|
|
224
|
+
* key in a tiebreak situation to determine if there are any subsequent
|
|
225
|
+
* keys to sort on.
|
|
226
|
+
*/
|
|
227
|
+
SortSupport onlyKey;
|
|
228
|
+
|
|
229
|
+
int sortopt; /* Bitmask of flags used to setup sort */
|
|
230
|
+
|
|
231
|
+
bool tuples; /* Can SortTuple.tuple ever be set? */
|
|
232
|
+
|
|
233
|
+
void *arg; /* Specific information for the sort variant */
|
|
234
|
+
} TuplesortPublic;
|
|
235
|
+
|
|
236
|
+
/* Sort parallel code from state for sort__start probes */
|
|
237
|
+
#define PARALLEL_SORT(coordinate) (coordinate == NULL || \
|
|
238
|
+
(coordinate)->sharedsort == NULL ? 0 : \
|
|
239
|
+
(coordinate)->isWorker ? 1 : 2)
|
|
240
|
+
|
|
241
|
+
#define TuplesortstateGetPublic(state) ((TuplesortPublic *) state)
|
|
242
|
+
|
|
243
|
+
/* When using this macro, beware of double evaluation of len */
|
|
244
|
+
#define LogicalTapeReadExact(tape, ptr, len) \
|
|
245
|
+
do { \
|
|
246
|
+
if (LogicalTapeRead(tape, ptr, len) != (size_t) (len)) \
|
|
247
|
+
elog(ERROR, "unexpected end of data"); \
|
|
248
|
+
} while(0)
|
|
96
249
|
|
|
97
250
|
/*
|
|
98
251
|
* We provide multiple interfaces to what is essentially the same code,
|
|
@@ -196,35 +349,81 @@ typedef struct TuplesortInstrumentation
|
|
|
196
349
|
* generated (typically, caller uses a parallel heap scan).
|
|
197
350
|
*/
|
|
198
351
|
|
|
352
|
+
|
|
353
|
+
extern Tuplesortstate *tuplesort_begin_common(int workMem,
|
|
354
|
+
SortCoordinate coordinate,
|
|
355
|
+
int sortopt);
|
|
356
|
+
extern void tuplesort_set_bound(Tuplesortstate *state, int64 bound);
|
|
357
|
+
extern bool tuplesort_used_bound(Tuplesortstate *state);
|
|
358
|
+
extern void tuplesort_puttuple_common(Tuplesortstate *state,
|
|
359
|
+
SortTuple *tuple, bool useAbbrev);
|
|
360
|
+
extern void tuplesort_performsort(Tuplesortstate *state);
|
|
361
|
+
extern bool tuplesort_gettuple_common(Tuplesortstate *state, bool forward,
|
|
362
|
+
SortTuple *stup);
|
|
363
|
+
extern bool tuplesort_skiptuples(Tuplesortstate *state, int64 ntuples,
|
|
364
|
+
bool forward);
|
|
365
|
+
extern void tuplesort_end(Tuplesortstate *state);
|
|
366
|
+
extern void tuplesort_reset(Tuplesortstate *state);
|
|
367
|
+
|
|
368
|
+
extern void tuplesort_get_stats(Tuplesortstate *state,
|
|
369
|
+
TuplesortInstrumentation *stats);
|
|
370
|
+
extern const char *tuplesort_method_name(TuplesortMethod m);
|
|
371
|
+
extern const char *tuplesort_space_type_name(TuplesortSpaceType t);
|
|
372
|
+
|
|
373
|
+
extern int tuplesort_merge_order(int64 allowedMem);
|
|
374
|
+
|
|
375
|
+
extern Size tuplesort_estimate_shared(int nWorkers);
|
|
376
|
+
extern void tuplesort_initialize_shared(Sharedsort *shared, int nWorkers,
|
|
377
|
+
dsm_segment *seg);
|
|
378
|
+
extern void tuplesort_attach_shared(Sharedsort *shared, dsm_segment *seg);
|
|
379
|
+
|
|
380
|
+
/*
|
|
381
|
+
* These routines may only be called if TUPLESORT_RANDOMACCESS was specified
|
|
382
|
+
* during tuplesort_begin_*. Additionally backwards scan in gettuple/getdatum
|
|
383
|
+
* also require TUPLESORT_RANDOMACCESS. Note that parallel sorts do not
|
|
384
|
+
* support random access.
|
|
385
|
+
*/
|
|
386
|
+
extern void tuplesort_rescan(Tuplesortstate *state);
|
|
387
|
+
extern void tuplesort_markpos(Tuplesortstate *state);
|
|
388
|
+
extern void tuplesort_restorepos(Tuplesortstate *state);
|
|
389
|
+
|
|
390
|
+
extern void *tuplesort_readtup_alloc(Tuplesortstate *state, Size tuplen);
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
/* tuplesortvariants.c */
|
|
394
|
+
|
|
199
395
|
extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc,
|
|
200
396
|
int nkeys, AttrNumber *attNums,
|
|
201
397
|
Oid *sortOperators, Oid *sortCollations,
|
|
202
398
|
bool *nullsFirstFlags,
|
|
203
399
|
int workMem, SortCoordinate coordinate,
|
|
204
|
-
|
|
400
|
+
int sortopt);
|
|
205
401
|
extern Tuplesortstate *tuplesort_begin_cluster(TupleDesc tupDesc,
|
|
206
402
|
Relation indexRel, int workMem,
|
|
207
|
-
SortCoordinate coordinate,
|
|
403
|
+
SortCoordinate coordinate,
|
|
404
|
+
int sortopt);
|
|
208
405
|
extern Tuplesortstate *tuplesort_begin_index_btree(Relation heapRel,
|
|
209
406
|
Relation indexRel,
|
|
210
407
|
bool enforceUnique,
|
|
408
|
+
bool uniqueNullsNotDistinct,
|
|
211
409
|
int workMem, SortCoordinate coordinate,
|
|
212
|
-
|
|
410
|
+
int sortopt);
|
|
213
411
|
extern Tuplesortstate *tuplesort_begin_index_hash(Relation heapRel,
|
|
214
412
|
Relation indexRel,
|
|
215
413
|
uint32 high_mask,
|
|
216
414
|
uint32 low_mask,
|
|
217
415
|
uint32 max_buckets,
|
|
218
416
|
int workMem, SortCoordinate coordinate,
|
|
219
|
-
|
|
417
|
+
int sortopt);
|
|
418
|
+
extern Tuplesortstate *tuplesort_begin_index_gist(Relation heapRel,
|
|
419
|
+
Relation indexRel,
|
|
420
|
+
int workMem, SortCoordinate coordinate,
|
|
421
|
+
int sortopt);
|
|
220
422
|
extern Tuplesortstate *tuplesort_begin_datum(Oid datumType,
|
|
221
423
|
Oid sortOperator, Oid sortCollation,
|
|
222
424
|
bool nullsFirstFlag,
|
|
223
425
|
int workMem, SortCoordinate coordinate,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
extern void tuplesort_set_bound(Tuplesortstate *state, int64 bound);
|
|
227
|
-
extern bool tuplesort_used_bound(Tuplesortstate *state);
|
|
426
|
+
int sortopt);
|
|
228
427
|
|
|
229
428
|
extern void tuplesort_puttupleslot(Tuplesortstate *state,
|
|
230
429
|
TupleTableSlot *slot);
|
|
@@ -235,43 +434,12 @@ extern void tuplesort_putindextuplevalues(Tuplesortstate *state,
|
|
|
235
434
|
extern void tuplesort_putdatum(Tuplesortstate *state, Datum val,
|
|
236
435
|
bool isNull);
|
|
237
436
|
|
|
238
|
-
extern void tuplesort_performsort(Tuplesortstate *state);
|
|
239
|
-
|
|
240
437
|
extern bool tuplesort_gettupleslot(Tuplesortstate *state, bool forward,
|
|
241
438
|
bool copy, TupleTableSlot *slot, Datum *abbrev);
|
|
242
439
|
extern HeapTuple tuplesort_getheaptuple(Tuplesortstate *state, bool forward);
|
|
243
440
|
extern IndexTuple tuplesort_getindextuple(Tuplesortstate *state, bool forward);
|
|
244
|
-
extern bool tuplesort_getdatum(Tuplesortstate *state, bool forward,
|
|
441
|
+
extern bool tuplesort_getdatum(Tuplesortstate *state, bool forward, bool copy,
|
|
245
442
|
Datum *val, bool *isNull, Datum *abbrev);
|
|
246
443
|
|
|
247
|
-
extern bool tuplesort_skiptuples(Tuplesortstate *state, int64 ntuples,
|
|
248
|
-
bool forward);
|
|
249
|
-
|
|
250
|
-
extern void tuplesort_end(Tuplesortstate *state);
|
|
251
|
-
|
|
252
|
-
extern void tuplesort_reset(Tuplesortstate *state);
|
|
253
|
-
|
|
254
|
-
extern void tuplesort_get_stats(Tuplesortstate *state,
|
|
255
|
-
TuplesortInstrumentation *stats);
|
|
256
|
-
extern const char *tuplesort_method_name(TuplesortMethod m);
|
|
257
|
-
extern const char *tuplesort_space_type_name(TuplesortSpaceType t);
|
|
258
|
-
|
|
259
|
-
extern int tuplesort_merge_order(int64 allowedMem);
|
|
260
|
-
|
|
261
|
-
extern Size tuplesort_estimate_shared(int nworkers);
|
|
262
|
-
extern void tuplesort_initialize_shared(Sharedsort *shared, int nWorkers,
|
|
263
|
-
dsm_segment *seg);
|
|
264
|
-
extern void tuplesort_attach_shared(Sharedsort *shared, dsm_segment *seg);
|
|
265
|
-
|
|
266
|
-
/*
|
|
267
|
-
* These routines may only be called if randomAccess was specified 'true'.
|
|
268
|
-
* Likewise, backwards scan in gettuple/getdatum is only allowed if
|
|
269
|
-
* randomAccess was specified. Note that parallel sorts do not support
|
|
270
|
-
* randomAccess.
|
|
271
|
-
*/
|
|
272
|
-
|
|
273
|
-
extern void tuplesort_rescan(Tuplesortstate *state);
|
|
274
|
-
extern void tuplesort_markpos(Tuplesortstate *state);
|
|
275
|
-
extern void tuplesort_restorepos(Tuplesortstate *state);
|
|
276
444
|
|
|
277
445
|
#endif /* TUPLESORT_H */
|