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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* POSTGRES table access method definitions.
|
|
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/access/tableam.h
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
#include "access/relscan.h"
|
|
21
21
|
#include "access/sdir.h"
|
|
22
|
-
#include "
|
|
22
|
+
#include "access/xact.h"
|
|
23
|
+
#include "executor/tuptable.h"
|
|
23
24
|
#include "utils/rel.h"
|
|
24
25
|
#include "utils/snapshot.h"
|
|
25
26
|
|
|
@@ -27,8 +28,8 @@
|
|
|
27
28
|
#define DEFAULT_TABLE_ACCESS_METHOD "heap"
|
|
28
29
|
|
|
29
30
|
/* GUCs */
|
|
30
|
-
extern char *default_table_access_method;
|
|
31
|
-
extern bool synchronize_seqscans;
|
|
31
|
+
extern PGDLLIMPORT char *default_table_access_method;
|
|
32
|
+
extern PGDLLIMPORT bool synchronize_seqscans;
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
struct BulkInsertStateData;
|
|
@@ -48,18 +49,19 @@ typedef enum ScanOptions
|
|
|
48
49
|
SO_TYPE_BITMAPSCAN = 1 << 1,
|
|
49
50
|
SO_TYPE_SAMPLESCAN = 1 << 2,
|
|
50
51
|
SO_TYPE_TIDSCAN = 1 << 3,
|
|
51
|
-
|
|
52
|
+
SO_TYPE_TIDRANGESCAN = 1 << 4,
|
|
53
|
+
SO_TYPE_ANALYZE = 1 << 5,
|
|
52
54
|
|
|
53
55
|
/* several of SO_ALLOW_* may be specified */
|
|
54
56
|
/* allow or disallow use of access strategy */
|
|
55
|
-
SO_ALLOW_STRAT = 1 <<
|
|
57
|
+
SO_ALLOW_STRAT = 1 << 6,
|
|
56
58
|
/* report location to syncscan logic? */
|
|
57
|
-
SO_ALLOW_SYNC = 1 <<
|
|
59
|
+
SO_ALLOW_SYNC = 1 << 7,
|
|
58
60
|
/* verify visibility page-at-a-time? */
|
|
59
|
-
SO_ALLOW_PAGEMODE = 1 <<
|
|
61
|
+
SO_ALLOW_PAGEMODE = 1 << 8,
|
|
60
62
|
|
|
61
63
|
/* unregister snapshot at scan end? */
|
|
62
|
-
SO_TEMP_SNAPSHOT = 1 <<
|
|
64
|
+
SO_TEMP_SNAPSHOT = 1 << 9
|
|
63
65
|
} ScanOptions;
|
|
64
66
|
|
|
65
67
|
/*
|
|
@@ -100,6 +102,22 @@ typedef enum TM_Result
|
|
|
100
102
|
TM_WouldBlock
|
|
101
103
|
} TM_Result;
|
|
102
104
|
|
|
105
|
+
/*
|
|
106
|
+
* Result codes for table_update(..., update_indexes*..).
|
|
107
|
+
* Used to determine which indexes to update.
|
|
108
|
+
*/
|
|
109
|
+
typedef enum TU_UpdateIndexes
|
|
110
|
+
{
|
|
111
|
+
/* No indexed columns were updated (incl. TID addressing of tuple) */
|
|
112
|
+
TU_None,
|
|
113
|
+
|
|
114
|
+
/* A non-summarizing indexed column was updated, or the TID has changed */
|
|
115
|
+
TU_All,
|
|
116
|
+
|
|
117
|
+
/* Only summarized columns were updated, TID is unchanged */
|
|
118
|
+
TU_Summarizing
|
|
119
|
+
} TU_UpdateIndexes;
|
|
120
|
+
|
|
103
121
|
/*
|
|
104
122
|
* When table_tuple_update, table_tuple_delete, or table_tuple_lock fail
|
|
105
123
|
* because the target tuple is already outdated, they fill in this struct to
|
|
@@ -127,6 +145,108 @@ typedef struct TM_FailureData
|
|
|
127
145
|
bool traversed;
|
|
128
146
|
} TM_FailureData;
|
|
129
147
|
|
|
148
|
+
/*
|
|
149
|
+
* State used when calling table_index_delete_tuples().
|
|
150
|
+
*
|
|
151
|
+
* Represents the status of table tuples, referenced by table TID and taken by
|
|
152
|
+
* index AM from index tuples. State consists of high level parameters of the
|
|
153
|
+
* deletion operation, plus two mutable palloc()'d arrays for information
|
|
154
|
+
* about the status of individual table tuples. These are conceptually one
|
|
155
|
+
* single array. Using two arrays keeps the TM_IndexDelete struct small,
|
|
156
|
+
* which makes sorting the first array (the deltids array) fast.
|
|
157
|
+
*
|
|
158
|
+
* Some index AM callers perform simple index tuple deletion (by specifying
|
|
159
|
+
* bottomup = false), and include only known-dead deltids. These known-dead
|
|
160
|
+
* entries are all marked knowndeletable = true directly (typically these are
|
|
161
|
+
* TIDs from LP_DEAD-marked index tuples), but that isn't strictly required.
|
|
162
|
+
*
|
|
163
|
+
* Callers that specify bottomup = true are "bottom-up index deletion"
|
|
164
|
+
* callers. The considerations for the tableam are more subtle with these
|
|
165
|
+
* callers because they ask the tableam to perform highly speculative work,
|
|
166
|
+
* and might only expect the tableam to check a small fraction of all entries.
|
|
167
|
+
* Caller is not allowed to specify knowndeletable = true for any entry
|
|
168
|
+
* because everything is highly speculative. Bottom-up caller provides
|
|
169
|
+
* context and hints to tableam -- see comments below for details on how index
|
|
170
|
+
* AMs and tableams should coordinate during bottom-up index deletion.
|
|
171
|
+
*
|
|
172
|
+
* Simple index deletion callers may ask the tableam to perform speculative
|
|
173
|
+
* work, too. This is a little like bottom-up deletion, but not too much.
|
|
174
|
+
* The tableam will only perform speculative work when it's practically free
|
|
175
|
+
* to do so in passing for simple deletion caller (while always performing
|
|
176
|
+
* whatever work is needed to enable knowndeletable/LP_DEAD index tuples to
|
|
177
|
+
* be deleted within index AM). This is the real reason why it's possible for
|
|
178
|
+
* simple index deletion caller to specify knowndeletable = false up front
|
|
179
|
+
* (this means "check if it's possible for me to delete corresponding index
|
|
180
|
+
* tuple when it's cheap to do so in passing"). The index AM should only
|
|
181
|
+
* include "extra" entries for index tuples whose TIDs point to a table block
|
|
182
|
+
* that tableam is expected to have to visit anyway (in the event of a block
|
|
183
|
+
* orientated tableam). The tableam isn't strictly obligated to check these
|
|
184
|
+
* "extra" TIDs, but a block-based AM should always manage to do so in
|
|
185
|
+
* practice.
|
|
186
|
+
*
|
|
187
|
+
* The final contents of the deltids/status arrays are interesting to callers
|
|
188
|
+
* that ask tableam to perform speculative work (i.e. when _any_ items have
|
|
189
|
+
* knowndeletable set to false up front). These index AM callers will
|
|
190
|
+
* naturally need to consult final state to determine which index tuples are
|
|
191
|
+
* in fact deletable.
|
|
192
|
+
*
|
|
193
|
+
* The index AM can keep track of which index tuple relates to which deltid by
|
|
194
|
+
* setting idxoffnum (and/or relying on each entry being uniquely identifiable
|
|
195
|
+
* using tid), which is important when the final contents of the array will
|
|
196
|
+
* need to be interpreted -- the array can shrink from initial size after
|
|
197
|
+
* tableam processing and/or have entries in a new order (tableam may sort
|
|
198
|
+
* deltids array for its own reasons). Bottom-up callers may find that final
|
|
199
|
+
* ndeltids is 0 on return from call to tableam, in which case no index tuple
|
|
200
|
+
* deletions are possible. Simple deletion callers can rely on any entries
|
|
201
|
+
* they know to be deletable appearing in the final array as deletable.
|
|
202
|
+
*/
|
|
203
|
+
typedef struct TM_IndexDelete
|
|
204
|
+
{
|
|
205
|
+
ItemPointerData tid; /* table TID from index tuple */
|
|
206
|
+
int16 id; /* Offset into TM_IndexStatus array */
|
|
207
|
+
} TM_IndexDelete;
|
|
208
|
+
|
|
209
|
+
typedef struct TM_IndexStatus
|
|
210
|
+
{
|
|
211
|
+
OffsetNumber idxoffnum; /* Index am page offset number */
|
|
212
|
+
bool knowndeletable; /* Currently known to be deletable? */
|
|
213
|
+
|
|
214
|
+
/* Bottom-up index deletion specific fields follow */
|
|
215
|
+
bool promising; /* Promising (duplicate) index tuple? */
|
|
216
|
+
int16 freespace; /* Space freed in index if deleted */
|
|
217
|
+
} TM_IndexStatus;
|
|
218
|
+
|
|
219
|
+
/*
|
|
220
|
+
* Index AM/tableam coordination is central to the design of bottom-up index
|
|
221
|
+
* deletion. The index AM provides hints about where to look to the tableam
|
|
222
|
+
* by marking some entries as "promising". Index AM does this with duplicate
|
|
223
|
+
* index tuples that are strongly suspected to be old versions left behind by
|
|
224
|
+
* UPDATEs that did not logically modify indexed values. Index AM may find it
|
|
225
|
+
* helpful to only mark entries as promising when they're thought to have been
|
|
226
|
+
* affected by such an UPDATE in the recent past.
|
|
227
|
+
*
|
|
228
|
+
* Bottom-up index deletion casts a wide net at first, usually by including
|
|
229
|
+
* all TIDs on a target index page. It is up to the tableam to worry about
|
|
230
|
+
* the cost of checking transaction status information. The tableam is in
|
|
231
|
+
* control, but needs careful guidance from the index AM. Index AM requests
|
|
232
|
+
* that bottomupfreespace target be met, while tableam measures progress
|
|
233
|
+
* towards that goal by tallying the per-entry freespace value for known
|
|
234
|
+
* deletable entries. (All !bottomup callers can just set these space related
|
|
235
|
+
* fields to zero.)
|
|
236
|
+
*/
|
|
237
|
+
typedef struct TM_IndexDeleteOp
|
|
238
|
+
{
|
|
239
|
+
Relation irel; /* Target index relation */
|
|
240
|
+
BlockNumber iblknum; /* Index block number (for error reports) */
|
|
241
|
+
bool bottomup; /* Bottom-up (not simple) deletion? */
|
|
242
|
+
int bottomupfreespace; /* Bottom-up space target */
|
|
243
|
+
|
|
244
|
+
/* Mutable per-TID information follows (index AM initializes entries) */
|
|
245
|
+
int ndeltids; /* Current # of deltids/status elements */
|
|
246
|
+
TM_IndexDelete *deltids;
|
|
247
|
+
TM_IndexStatus *status;
|
|
248
|
+
} TM_IndexDeleteOp;
|
|
249
|
+
|
|
130
250
|
/* "options" flag bits for table_tuple_insert */
|
|
131
251
|
/* TABLE_INSERT_SKIP_WAL was 0x0001; RelationNeedsWAL() now governs */
|
|
132
252
|
#define TABLE_INSERT_SKIP_FSM 0x0002
|
|
@@ -224,6 +344,34 @@ typedef struct TableAmRoutine
|
|
|
224
344
|
ScanDirection direction,
|
|
225
345
|
TupleTableSlot *slot);
|
|
226
346
|
|
|
347
|
+
/*-----------
|
|
348
|
+
* Optional functions to provide scanning for ranges of ItemPointers.
|
|
349
|
+
* Implementations must either provide both of these functions, or neither
|
|
350
|
+
* of them.
|
|
351
|
+
*
|
|
352
|
+
* Implementations of scan_set_tidrange must themselves handle
|
|
353
|
+
* ItemPointers of any value. i.e, they must handle each of the following:
|
|
354
|
+
*
|
|
355
|
+
* 1) mintid or maxtid is beyond the end of the table; and
|
|
356
|
+
* 2) mintid is above maxtid; and
|
|
357
|
+
* 3) item offset for mintid or maxtid is beyond the maximum offset
|
|
358
|
+
* allowed by the AM.
|
|
359
|
+
*
|
|
360
|
+
* Implementations can assume that scan_set_tidrange is always called
|
|
361
|
+
* before scan_getnextslot_tidrange or after scan_rescan and before any
|
|
362
|
+
* further calls to scan_getnextslot_tidrange.
|
|
363
|
+
*/
|
|
364
|
+
void (*scan_set_tidrange) (TableScanDesc scan,
|
|
365
|
+
ItemPointer mintid,
|
|
366
|
+
ItemPointer maxtid);
|
|
367
|
+
|
|
368
|
+
/*
|
|
369
|
+
* Return next tuple from `scan` that's in the range of TIDs defined by
|
|
370
|
+
* scan_set_tidrange.
|
|
371
|
+
*/
|
|
372
|
+
bool (*scan_getnextslot_tidrange) (TableScanDesc scan,
|
|
373
|
+
ScanDirection direction,
|
|
374
|
+
TupleTableSlot *slot);
|
|
227
375
|
|
|
228
376
|
/* ------------------------------------------------------------------------
|
|
229
377
|
* Parallel table scan related functions.
|
|
@@ -341,10 +489,9 @@ typedef struct TableAmRoutine
|
|
|
341
489
|
TupleTableSlot *slot,
|
|
342
490
|
Snapshot snapshot);
|
|
343
491
|
|
|
344
|
-
/* see
|
|
345
|
-
TransactionId (*
|
|
346
|
-
|
|
347
|
-
int nitems);
|
|
492
|
+
/* see table_index_delete_tuples() */
|
|
493
|
+
TransactionId (*index_delete_tuples) (Relation rel,
|
|
494
|
+
TM_IndexDeleteOp *delstate);
|
|
348
495
|
|
|
349
496
|
|
|
350
497
|
/* ------------------------------------------------------------------------
|
|
@@ -395,7 +542,7 @@ typedef struct TableAmRoutine
|
|
|
395
542
|
bool wait,
|
|
396
543
|
TM_FailureData *tmfd,
|
|
397
544
|
LockTupleMode *lockmode,
|
|
398
|
-
|
|
545
|
+
TU_UpdateIndexes *update_indexes);
|
|
399
546
|
|
|
400
547
|
/* see table_tuple_lock() for reference about parameters */
|
|
401
548
|
TM_Result (*tuple_lock) (Relation rel,
|
|
@@ -429,32 +576,32 @@ typedef struct TableAmRoutine
|
|
|
429
576
|
*/
|
|
430
577
|
|
|
431
578
|
/*
|
|
432
|
-
* This callback needs to create
|
|
579
|
+
* This callback needs to create new relation storage for `rel`, with
|
|
433
580
|
* appropriate durability behaviour for `persistence`.
|
|
434
581
|
*
|
|
435
582
|
* Note that only the subset of the relcache filled by
|
|
436
583
|
* RelationBuildLocalRelation() can be relied upon and that the relation's
|
|
437
584
|
* catalog entries will either not yet exist (new relation), or will still
|
|
438
|
-
* reference the old
|
|
585
|
+
* reference the old relfilelocator.
|
|
439
586
|
*
|
|
440
587
|
* As output *freezeXid, *minmulti must be set to the values appropriate
|
|
441
588
|
* for pg_class.{relfrozenxid, relminmxid}. For AMs that don't need those
|
|
442
589
|
* fields to be filled they can be set to InvalidTransactionId and
|
|
443
590
|
* InvalidMultiXactId, respectively.
|
|
444
591
|
*
|
|
445
|
-
* See also
|
|
592
|
+
* See also table_relation_set_new_filelocator().
|
|
446
593
|
*/
|
|
447
|
-
void (*
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
594
|
+
void (*relation_set_new_filelocator) (Relation rel,
|
|
595
|
+
const RelFileLocator *newrlocator,
|
|
596
|
+
char persistence,
|
|
597
|
+
TransactionId *freezeXid,
|
|
598
|
+
MultiXactId *minmulti);
|
|
452
599
|
|
|
453
600
|
/*
|
|
454
601
|
* This callback needs to remove all contents from `rel`'s current
|
|
455
|
-
*
|
|
456
|
-
* Often this can be implemented by truncating the underlying
|
|
457
|
-
* its minimal size.
|
|
602
|
+
* relfilelocator. No provisions for transactional behaviour need to be
|
|
603
|
+
* made. Often this can be implemented by truncating the underlying
|
|
604
|
+
* storage to its minimal size.
|
|
458
605
|
*
|
|
459
606
|
* See also table_relation_nontransactional_truncate().
|
|
460
607
|
*/
|
|
@@ -467,7 +614,7 @@ typedef struct TableAmRoutine
|
|
|
467
614
|
* storage, unless it contains references to the tablespace internally.
|
|
468
615
|
*/
|
|
469
616
|
void (*relation_copy_data) (Relation rel,
|
|
470
|
-
const
|
|
617
|
+
const RelFileLocator *newrlocator);
|
|
471
618
|
|
|
472
619
|
/* See table_relation_copy_for_cluster() */
|
|
473
620
|
void (*relation_copy_for_cluster) (Relation NewTable,
|
|
@@ -496,7 +643,7 @@ typedef struct TableAmRoutine
|
|
|
496
643
|
* There probably, in the future, needs to be a separate callback to
|
|
497
644
|
* integrate with autovacuum's scheduling.
|
|
498
645
|
*/
|
|
499
|
-
void (*relation_vacuum) (Relation
|
|
646
|
+
void (*relation_vacuum) (Relation rel,
|
|
500
647
|
struct VacuumParams *params,
|
|
501
648
|
BufferAccessStrategy bstrategy);
|
|
502
649
|
|
|
@@ -732,13 +879,13 @@ typedef struct TableAmRoutine
|
|
|
732
879
|
* for the relation. Works for tables, views, foreign tables and partitioned
|
|
733
880
|
* tables.
|
|
734
881
|
*/
|
|
735
|
-
extern const TupleTableSlotOps *table_slot_callbacks(Relation
|
|
882
|
+
extern const TupleTableSlotOps *table_slot_callbacks(Relation relation);
|
|
736
883
|
|
|
737
884
|
/*
|
|
738
885
|
* Returns slot using the callbacks returned by table_slot_callbacks(), and
|
|
739
886
|
* registers it on *reglist.
|
|
740
887
|
*/
|
|
741
|
-
extern TupleTableSlot *table_slot_create(Relation
|
|
888
|
+
extern TupleTableSlot *table_slot_create(Relation relation, List **reglist);
|
|
742
889
|
|
|
743
890
|
|
|
744
891
|
/* ----------------------------------------------------------------------------
|
|
@@ -755,7 +902,7 @@ table_beginscan(Relation rel, Snapshot snapshot,
|
|
|
755
902
|
int nkeys, struct ScanKeyData *key)
|
|
756
903
|
{
|
|
757
904
|
uint32 flags = SO_TYPE_SEQSCAN |
|
|
758
|
-
|
|
905
|
+
SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE;
|
|
759
906
|
|
|
760
907
|
return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags);
|
|
761
908
|
}
|
|
@@ -764,7 +911,7 @@ table_beginscan(Relation rel, Snapshot snapshot,
|
|
|
764
911
|
* Like table_beginscan(), but for scanning catalog. It'll automatically use a
|
|
765
912
|
* snapshot appropriate for scanning catalog relations.
|
|
766
913
|
*/
|
|
767
|
-
extern TableScanDesc table_beginscan_catalog(Relation
|
|
914
|
+
extern TableScanDesc table_beginscan_catalog(Relation relation, int nkeys,
|
|
768
915
|
struct ScanKeyData *key);
|
|
769
916
|
|
|
770
917
|
/*
|
|
@@ -903,9 +1050,84 @@ static inline bool
|
|
|
903
1050
|
table_scan_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
|
|
904
1051
|
{
|
|
905
1052
|
slot->tts_tableOid = RelationGetRelid(sscan->rs_rd);
|
|
1053
|
+
|
|
1054
|
+
/* We don't expect actual scans using NoMovementScanDirection */
|
|
1055
|
+
Assert(direction == ForwardScanDirection ||
|
|
1056
|
+
direction == BackwardScanDirection);
|
|
1057
|
+
|
|
1058
|
+
/*
|
|
1059
|
+
* We don't expect direct calls to table_scan_getnextslot with valid
|
|
1060
|
+
* CheckXidAlive for catalog or regular tables. See detailed comments in
|
|
1061
|
+
* xact.c where these variables are declared.
|
|
1062
|
+
*/
|
|
1063
|
+
if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan))
|
|
1064
|
+
elog(ERROR, "unexpected table_scan_getnextslot call during logical decoding");
|
|
1065
|
+
|
|
906
1066
|
return sscan->rs_rd->rd_tableam->scan_getnextslot(sscan, direction, slot);
|
|
907
1067
|
}
|
|
908
1068
|
|
|
1069
|
+
/* ----------------------------------------------------------------------------
|
|
1070
|
+
* TID Range scanning related functions.
|
|
1071
|
+
* ----------------------------------------------------------------------------
|
|
1072
|
+
*/
|
|
1073
|
+
|
|
1074
|
+
/*
|
|
1075
|
+
* table_beginscan_tidrange is the entry point for setting up a TableScanDesc
|
|
1076
|
+
* for a TID range scan.
|
|
1077
|
+
*/
|
|
1078
|
+
static inline TableScanDesc
|
|
1079
|
+
table_beginscan_tidrange(Relation rel, Snapshot snapshot,
|
|
1080
|
+
ItemPointer mintid,
|
|
1081
|
+
ItemPointer maxtid)
|
|
1082
|
+
{
|
|
1083
|
+
TableScanDesc sscan;
|
|
1084
|
+
uint32 flags = SO_TYPE_TIDRANGESCAN | SO_ALLOW_PAGEMODE;
|
|
1085
|
+
|
|
1086
|
+
sscan = rel->rd_tableam->scan_begin(rel, snapshot, 0, NULL, NULL, flags);
|
|
1087
|
+
|
|
1088
|
+
/* Set the range of TIDs to scan */
|
|
1089
|
+
sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid);
|
|
1090
|
+
|
|
1091
|
+
return sscan;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/*
|
|
1095
|
+
* table_rescan_tidrange resets the scan position and sets the minimum and
|
|
1096
|
+
* maximum TID range to scan for a TableScanDesc created by
|
|
1097
|
+
* table_beginscan_tidrange.
|
|
1098
|
+
*/
|
|
1099
|
+
static inline void
|
|
1100
|
+
table_rescan_tidrange(TableScanDesc sscan, ItemPointer mintid,
|
|
1101
|
+
ItemPointer maxtid)
|
|
1102
|
+
{
|
|
1103
|
+
/* Ensure table_beginscan_tidrange() was used. */
|
|
1104
|
+
Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0);
|
|
1105
|
+
|
|
1106
|
+
sscan->rs_rd->rd_tableam->scan_rescan(sscan, NULL, false, false, false, false);
|
|
1107
|
+
sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
/*
|
|
1111
|
+
* Fetch the next tuple from `sscan` for a TID range scan created by
|
|
1112
|
+
* table_beginscan_tidrange(). Stores the tuple in `slot` and returns true,
|
|
1113
|
+
* or returns false if no more tuples exist in the range.
|
|
1114
|
+
*/
|
|
1115
|
+
static inline bool
|
|
1116
|
+
table_scan_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction,
|
|
1117
|
+
TupleTableSlot *slot)
|
|
1118
|
+
{
|
|
1119
|
+
/* Ensure table_beginscan_tidrange() was used. */
|
|
1120
|
+
Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0);
|
|
1121
|
+
|
|
1122
|
+
/* We don't expect actual scans using NoMovementScanDirection */
|
|
1123
|
+
Assert(direction == ForwardScanDirection ||
|
|
1124
|
+
direction == BackwardScanDirection);
|
|
1125
|
+
|
|
1126
|
+
return sscan->rs_rd->rd_tableam->scan_getnextslot_tidrange(sscan,
|
|
1127
|
+
direction,
|
|
1128
|
+
slot);
|
|
1129
|
+
}
|
|
1130
|
+
|
|
909
1131
|
|
|
910
1132
|
/* ----------------------------------------------------------------------------
|
|
911
1133
|
* Parallel table scan related functions.
|
|
@@ -935,7 +1157,7 @@ extern void table_parallelscan_initialize(Relation rel,
|
|
|
935
1157
|
*
|
|
936
1158
|
* Caller must hold a suitable lock on the relation.
|
|
937
1159
|
*/
|
|
938
|
-
extern TableScanDesc table_beginscan_parallel(Relation
|
|
1160
|
+
extern TableScanDesc table_beginscan_parallel(Relation relation,
|
|
939
1161
|
ParallelTableScanDesc pscan);
|
|
940
1162
|
|
|
941
1163
|
/*
|
|
@@ -1017,6 +1239,13 @@ table_index_fetch_tuple(struct IndexFetchTableData *scan,
|
|
|
1017
1239
|
TupleTableSlot *slot,
|
|
1018
1240
|
bool *call_again, bool *all_dead)
|
|
1019
1241
|
{
|
|
1242
|
+
/*
|
|
1243
|
+
* We don't expect direct calls to table_index_fetch_tuple with valid
|
|
1244
|
+
* CheckXidAlive for catalog or regular tables. See detailed comments in
|
|
1245
|
+
* xact.c where these variables are declared.
|
|
1246
|
+
*/
|
|
1247
|
+
if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan))
|
|
1248
|
+
elog(ERROR, "unexpected table_index_fetch_tuple call during logical decoding");
|
|
1020
1249
|
|
|
1021
1250
|
return scan->rel->rd_tableam->index_fetch_tuple(scan, tid, snapshot,
|
|
1022
1251
|
slot, call_again,
|
|
@@ -1056,6 +1285,14 @@ table_tuple_fetch_row_version(Relation rel,
|
|
|
1056
1285
|
Snapshot snapshot,
|
|
1057
1286
|
TupleTableSlot *slot)
|
|
1058
1287
|
{
|
|
1288
|
+
/*
|
|
1289
|
+
* We don't expect direct calls to table_tuple_fetch_row_version with
|
|
1290
|
+
* valid CheckXidAlive for catalog or regular tables. See detailed
|
|
1291
|
+
* comments in xact.c where these variables are declared.
|
|
1292
|
+
*/
|
|
1293
|
+
if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan))
|
|
1294
|
+
elog(ERROR, "unexpected table_tuple_fetch_row_version call during logical decoding");
|
|
1295
|
+
|
|
1059
1296
|
return rel->rd_tableam->tuple_fetch_row_version(rel, tid, snapshot, slot);
|
|
1060
1297
|
}
|
|
1061
1298
|
|
|
@@ -1097,16 +1334,23 @@ table_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot,
|
|
|
1097
1334
|
}
|
|
1098
1335
|
|
|
1099
1336
|
/*
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1102
|
-
*
|
|
1337
|
+
* Determine which index tuples are safe to delete based on their table TID.
|
|
1338
|
+
*
|
|
1339
|
+
* Determines which entries from index AM caller's TM_IndexDeleteOp state
|
|
1340
|
+
* point to vacuumable table tuples. Entries that are found by tableam to be
|
|
1341
|
+
* vacuumable are naturally safe for index AM to delete, and so get directly
|
|
1342
|
+
* marked as deletable. See comments above TM_IndexDelete and comments above
|
|
1343
|
+
* TM_IndexDeleteOp for full details.
|
|
1344
|
+
*
|
|
1345
|
+
* Returns a snapshotConflictHorizon transaction ID that caller places in
|
|
1346
|
+
* its index deletion WAL record. This might be used during subsequent REDO
|
|
1347
|
+
* of the WAL record when in Hot Standby mode -- a recovery conflict for the
|
|
1348
|
+
* index deletion operation might be required on the standby.
|
|
1103
1349
|
*/
|
|
1104
1350
|
static inline TransactionId
|
|
1105
|
-
|
|
1106
|
-
ItemPointerData *items,
|
|
1107
|
-
int nitems)
|
|
1351
|
+
table_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
|
|
1108
1352
|
{
|
|
1109
|
-
return rel->rd_tableam->
|
|
1353
|
+
return rel->rd_tableam->index_delete_tuples(rel, delstate);
|
|
1110
1354
|
}
|
|
1111
1355
|
|
|
1112
1356
|
|
|
@@ -1128,7 +1372,7 @@ table_compute_xid_horizon_for_tuples(Relation rel,
|
|
|
1128
1372
|
* RelationGetBufferForTuple. See that method for more information.
|
|
1129
1373
|
*
|
|
1130
1374
|
* TABLE_INSERT_FROZEN should only be specified for inserts into
|
|
1131
|
-
*
|
|
1375
|
+
* relation storage created during the current subtransaction and when
|
|
1132
1376
|
* there are no prior snapshots or pre-existing portals open.
|
|
1133
1377
|
* This causes rows to be frozen, which is an MVCC violation and
|
|
1134
1378
|
* requires explicit options chosen by user.
|
|
@@ -1286,7 +1530,7 @@ static inline TM_Result
|
|
|
1286
1530
|
table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot,
|
|
1287
1531
|
CommandId cid, Snapshot snapshot, Snapshot crosscheck,
|
|
1288
1532
|
bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode,
|
|
1289
|
-
|
|
1533
|
+
TU_UpdateIndexes *update_indexes)
|
|
1290
1534
|
{
|
|
1291
1535
|
return rel->rd_tableam->tuple_update(rel, otid, slot,
|
|
1292
1536
|
cid, snapshot, crosscheck,
|
|
@@ -1357,33 +1601,34 @@ table_finish_bulk_insert(Relation rel, int options)
|
|
|
1357
1601
|
*/
|
|
1358
1602
|
|
|
1359
1603
|
/*
|
|
1360
|
-
* Create storage for `rel` in `
|
|
1604
|
+
* Create storage for `rel` in `newrlocator`, with persistence set to
|
|
1361
1605
|
* `persistence`.
|
|
1362
1606
|
*
|
|
1363
1607
|
* This is used both during relation creation and various DDL operations to
|
|
1364
|
-
* create
|
|
1365
|
-
* new storage for an existing
|
|
1608
|
+
* create new rel storage that can be filled from scratch. When creating
|
|
1609
|
+
* new storage for an existing relfilelocator, this should be called before the
|
|
1366
1610
|
* relcache entry has been updated.
|
|
1367
1611
|
*
|
|
1368
1612
|
* *freezeXid, *minmulti are set to the xid / multixact horizon for the table
|
|
1369
1613
|
* that pg_class.{relfrozenxid, relminmxid} have to be set to.
|
|
1370
1614
|
*/
|
|
1371
1615
|
static inline void
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1616
|
+
table_relation_set_new_filelocator(Relation rel,
|
|
1617
|
+
const RelFileLocator *newrlocator,
|
|
1618
|
+
char persistence,
|
|
1619
|
+
TransactionId *freezeXid,
|
|
1620
|
+
MultiXactId *minmulti)
|
|
1377
1621
|
{
|
|
1378
|
-
rel->rd_tableam->
|
|
1379
|
-
|
|
1622
|
+
rel->rd_tableam->relation_set_new_filelocator(rel, newrlocator,
|
|
1623
|
+
persistence, freezeXid,
|
|
1624
|
+
minmulti);
|
|
1380
1625
|
}
|
|
1381
1626
|
|
|
1382
1627
|
/*
|
|
1383
1628
|
* Remove all table contents from `rel`, in a non-transactional manner.
|
|
1384
1629
|
* Non-transactional meaning that there's no need to support rollbacks. This
|
|
1385
|
-
* commonly only is used to perform truncations for
|
|
1386
|
-
* current transaction.
|
|
1630
|
+
* commonly only is used to perform truncations for relation storage created in
|
|
1631
|
+
* the current transaction.
|
|
1387
1632
|
*/
|
|
1388
1633
|
static inline void
|
|
1389
1634
|
table_relation_nontransactional_truncate(Relation rel)
|
|
@@ -1392,15 +1637,15 @@ table_relation_nontransactional_truncate(Relation rel)
|
|
|
1392
1637
|
}
|
|
1393
1638
|
|
|
1394
1639
|
/*
|
|
1395
|
-
* Copy data from `rel` into the new
|
|
1396
|
-
*
|
|
1640
|
+
* Copy data from `rel` into the new relfilelocator `newrlocator`. The new
|
|
1641
|
+
* relfilelocator may not have storage associated before this function is
|
|
1397
1642
|
* called. This is only supposed to be used for low level operations like
|
|
1398
1643
|
* changing a relation's tablespace.
|
|
1399
1644
|
*/
|
|
1400
1645
|
static inline void
|
|
1401
|
-
table_relation_copy_data(Relation rel, const
|
|
1646
|
+
table_relation_copy_data(Relation rel, const RelFileLocator *newrlocator)
|
|
1402
1647
|
{
|
|
1403
|
-
rel->rd_tableam->relation_copy_data(rel,
|
|
1648
|
+
rel->rd_tableam->relation_copy_data(rel, newrlocator);
|
|
1404
1649
|
}
|
|
1405
1650
|
|
|
1406
1651
|
/*
|
|
@@ -1413,7 +1658,7 @@ table_relation_copy_data(Relation rel, const RelFileNode *newrnode)
|
|
|
1413
1658
|
* in that index's order; if false and OldIndex is InvalidOid, no sorting is
|
|
1414
1659
|
* performed
|
|
1415
1660
|
* - OldIndex - see use_sort
|
|
1416
|
-
* - OldestXmin - computed by
|
|
1661
|
+
* - OldestXmin - computed by vacuum_get_cutoffs(), even when
|
|
1417
1662
|
* not needed for the relation's AM
|
|
1418
1663
|
* - *xid_cutoff - ditto
|
|
1419
1664
|
* - *multi_cutoff - ditto
|
|
@@ -1650,7 +1895,7 @@ table_relation_toast_am(Relation rel)
|
|
|
1650
1895
|
*
|
|
1651
1896
|
* toastrel is the relation in which the toasted value is stored.
|
|
1652
1897
|
*
|
|
1653
|
-
* valueid
|
|
1898
|
+
* valueid identifies which toast value is to be fetched. For the heap,
|
|
1654
1899
|
* this corresponds to the values stored in the chunk_id column.
|
|
1655
1900
|
*
|
|
1656
1901
|
* attrsize is the total size of the toast value to be fetched.
|
|
@@ -1713,6 +1958,14 @@ static inline bool
|
|
|
1713
1958
|
table_scan_bitmap_next_block(TableScanDesc scan,
|
|
1714
1959
|
struct TBMIterateResult *tbmres)
|
|
1715
1960
|
{
|
|
1961
|
+
/*
|
|
1962
|
+
* We don't expect direct calls to table_scan_bitmap_next_block with valid
|
|
1963
|
+
* CheckXidAlive for catalog or regular tables. See detailed comments in
|
|
1964
|
+
* xact.c where these variables are declared.
|
|
1965
|
+
*/
|
|
1966
|
+
if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan))
|
|
1967
|
+
elog(ERROR, "unexpected table_scan_bitmap_next_block call during logical decoding");
|
|
1968
|
+
|
|
1716
1969
|
return scan->rs_rd->rd_tableam->scan_bitmap_next_block(scan,
|
|
1717
1970
|
tbmres);
|
|
1718
1971
|
}
|
|
@@ -1730,6 +1983,14 @@ table_scan_bitmap_next_tuple(TableScanDesc scan,
|
|
|
1730
1983
|
struct TBMIterateResult *tbmres,
|
|
1731
1984
|
TupleTableSlot *slot)
|
|
1732
1985
|
{
|
|
1986
|
+
/*
|
|
1987
|
+
* We don't expect direct calls to table_scan_bitmap_next_tuple with valid
|
|
1988
|
+
* CheckXidAlive for catalog or regular tables. See detailed comments in
|
|
1989
|
+
* xact.c where these variables are declared.
|
|
1990
|
+
*/
|
|
1991
|
+
if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan))
|
|
1992
|
+
elog(ERROR, "unexpected table_scan_bitmap_next_tuple call during logical decoding");
|
|
1993
|
+
|
|
1733
1994
|
return scan->rs_rd->rd_tableam->scan_bitmap_next_tuple(scan,
|
|
1734
1995
|
tbmres,
|
|
1735
1996
|
slot);
|
|
@@ -1748,6 +2009,13 @@ static inline bool
|
|
|
1748
2009
|
table_scan_sample_next_block(TableScanDesc scan,
|
|
1749
2010
|
struct SampleScanState *scanstate)
|
|
1750
2011
|
{
|
|
2012
|
+
/*
|
|
2013
|
+
* We don't expect direct calls to table_scan_sample_next_block with valid
|
|
2014
|
+
* CheckXidAlive for catalog or regular tables. See detailed comments in
|
|
2015
|
+
* xact.c where these variables are declared.
|
|
2016
|
+
*/
|
|
2017
|
+
if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan))
|
|
2018
|
+
elog(ERROR, "unexpected table_scan_sample_next_block call during logical decoding");
|
|
1751
2019
|
return scan->rs_rd->rd_tableam->scan_sample_next_block(scan, scanstate);
|
|
1752
2020
|
}
|
|
1753
2021
|
|
|
@@ -1764,6 +2032,13 @@ table_scan_sample_next_tuple(TableScanDesc scan,
|
|
|
1764
2032
|
struct SampleScanState *scanstate,
|
|
1765
2033
|
TupleTableSlot *slot)
|
|
1766
2034
|
{
|
|
2035
|
+
/*
|
|
2036
|
+
* We don't expect direct calls to table_scan_sample_next_tuple with valid
|
|
2037
|
+
* CheckXidAlive for catalog or regular tables. See detailed comments in
|
|
2038
|
+
* xact.c where these variables are declared.
|
|
2039
|
+
*/
|
|
2040
|
+
if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan))
|
|
2041
|
+
elog(ERROR, "unexpected table_scan_sample_next_tuple call during logical decoding");
|
|
1767
2042
|
return scan->rs_rd->rd_tableam->scan_sample_next_tuple(scan, scanstate,
|
|
1768
2043
|
slot);
|
|
1769
2044
|
}
|
|
@@ -1779,7 +2054,7 @@ extern void simple_table_tuple_delete(Relation rel, ItemPointer tid,
|
|
|
1779
2054
|
Snapshot snapshot);
|
|
1780
2055
|
extern void simple_table_tuple_update(Relation rel, ItemPointer otid,
|
|
1781
2056
|
TupleTableSlot *slot, Snapshot snapshot,
|
|
1782
|
-
|
|
2057
|
+
TU_UpdateIndexes *update_indexes);
|
|
1783
2058
|
|
|
1784
2059
|
|
|
1785
2060
|
/* ----------------------------------------------------------------------------
|
|
@@ -1793,8 +2068,10 @@ extern Size table_block_parallelscan_initialize(Relation rel,
|
|
|
1793
2068
|
extern void table_block_parallelscan_reinitialize(Relation rel,
|
|
1794
2069
|
ParallelTableScanDesc pscan);
|
|
1795
2070
|
extern BlockNumber table_block_parallelscan_nextpage(Relation rel,
|
|
2071
|
+
ParallelBlockTableScanWorker pbscanwork,
|
|
1796
2072
|
ParallelBlockTableScanDesc pbscan);
|
|
1797
2073
|
extern void table_block_parallelscan_startblock_init(Relation rel,
|
|
2074
|
+
ParallelBlockTableScanWorker pbscanwork,
|
|
1798
2075
|
ParallelBlockTableScanDesc pbscan);
|
|
1799
2076
|
|
|
1800
2077
|
|
|
@@ -1819,7 +2096,5 @@ extern void table_block_relation_estimate_size(Relation rel,
|
|
|
1819
2096
|
|
|
1820
2097
|
extern const TableAmRoutine *GetTableAmRoutine(Oid amhandler);
|
|
1821
2098
|
extern const TableAmRoutine *GetHeapamTableAmRoutine(void);
|
|
1822
|
-
extern bool check_default_table_access_method(char **newval, void **extra,
|
|
1823
|
-
GucSource source);
|
|
1824
2099
|
|
|
1825
2100
|
#endif /* TABLEAM_H */
|