pg_query 4.2.1 → 6.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.
Files changed (901) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +61 -0
  3. data/README.md +7 -9
  4. data/Rakefile +5 -6
  5. data/ext/pg_query/ext_symbols_freebsd.sym +1 -0
  6. data/ext/pg_query/ext_symbols_freebsd_with_ruby_abi_version.sym +2 -0
  7. data/ext/pg_query/ext_symbols_openbsd.sym +1 -0
  8. data/ext/pg_query/ext_symbols_openbsd_with_ruby_abi_version.sym +2 -0
  9. data/ext/pg_query/ext_symbols_with_ruby_abi_version.sym +2 -0
  10. data/ext/pg_query/extconf.rb +33 -9
  11. data/ext/pg_query/include/pg_query.h +28 -3
  12. data/ext/pg_query/include/pg_query_enum_defs.c +599 -167
  13. data/ext/pg_query/include/pg_query_fingerprint_conds.c +640 -520
  14. data/ext/pg_query/include/pg_query_fingerprint_defs.c +6400 -4633
  15. data/ext/pg_query/include/pg_query_outfuncs_conds.c +433 -343
  16. data/ext/pg_query/include/pg_query_outfuncs_defs.c +1472 -1152
  17. data/ext/pg_query/include/pg_query_readfuncs_conds.c +154 -124
  18. data/ext/pg_query/include/pg_query_readfuncs_defs.c +1886 -1506
  19. data/ext/pg_query/include/postgres/access/amapi.h +303 -0
  20. data/ext/pg_query/include/postgres/access/attmap.h +54 -0
  21. data/ext/pg_query/include/postgres/access/attnum.h +64 -0
  22. data/ext/pg_query/include/postgres/access/brin_internal.h +116 -0
  23. data/ext/pg_query/include/postgres/access/brin_tuple.h +112 -0
  24. data/ext/pg_query/include/postgres/access/clog.h +62 -0
  25. data/ext/pg_query/include/postgres/access/commit_ts.h +73 -0
  26. data/ext/pg_query/include/postgres/access/detoast.h +82 -0
  27. data/ext/pg_query/include/postgres/access/genam.h +246 -0
  28. data/ext/pg_query/include/postgres/access/gin.h +91 -0
  29. data/ext/pg_query/include/postgres/access/htup.h +89 -0
  30. data/ext/pg_query/include/postgres/access/htup_details.h +811 -0
  31. data/ext/pg_query/include/postgres/access/itup.h +170 -0
  32. data/ext/pg_query/include/postgres/access/parallel.h +81 -0
  33. data/ext/pg_query/include/postgres/access/printtup.h +35 -0
  34. data/ext/pg_query/include/postgres/access/relation.h +28 -0
  35. data/ext/pg_query/include/postgres/access/relscan.h +191 -0
  36. data/ext/pg_query/include/postgres/access/rmgrlist.h +49 -0
  37. data/ext/pg_query/include/postgres/access/sdir.h +67 -0
  38. data/ext/pg_query/include/postgres/access/skey.h +151 -0
  39. data/ext/pg_query/include/postgres/access/slru.h +218 -0
  40. data/ext/pg_query/include/postgres/access/stratnum.h +85 -0
  41. data/ext/pg_query/include/postgres/access/sysattr.h +29 -0
  42. data/ext/pg_query/include/postgres/access/table.h +28 -0
  43. data/ext/pg_query/include/postgres/access/tableam.h +2110 -0
  44. data/ext/pg_query/include/postgres/access/tidstore.h +50 -0
  45. data/ext/pg_query/include/postgres/access/toast_compression.h +73 -0
  46. data/ext/pg_query/include/postgres/access/transam.h +418 -0
  47. data/ext/pg_query/include/postgres/access/tsmapi.h +82 -0
  48. data/ext/pg_query/include/postgres/access/tupconvert.h +54 -0
  49. data/ext/pg_query/include/postgres/access/tupdesc.h +154 -0
  50. data/ext/pg_query/include/postgres/access/tupmacs.h +207 -0
  51. data/ext/pg_query/include/postgres/access/twophase.h +65 -0
  52. data/ext/pg_query/include/postgres/access/xact.h +530 -0
  53. data/ext/pg_query/include/postgres/access/xlog.h +310 -0
  54. data/ext/pg_query/include/postgres/access/xlog_internal.h +405 -0
  55. data/ext/pg_query/include/postgres/access/xlogbackup.h +43 -0
  56. data/ext/pg_query/include/postgres/access/xlogdefs.h +82 -0
  57. data/ext/pg_query/include/postgres/access/xlogprefetcher.h +55 -0
  58. data/ext/pg_query/include/postgres/access/xlogreader.h +444 -0
  59. data/ext/pg_query/include/postgres/access/xlogrecord.h +248 -0
  60. data/ext/pg_query/include/postgres/access/xlogrecovery.h +158 -0
  61. data/ext/pg_query/include/postgres/archive/archive_module.h +67 -0
  62. data/ext/pg_query/include/postgres/c.h +1374 -0
  63. data/ext/pg_query/include/postgres/catalog/catalog.h +47 -0
  64. data/ext/pg_query/include/postgres/catalog/catversion.h +62 -0
  65. data/ext/pg_query/include/postgres/catalog/dependency.h +228 -0
  66. data/ext/pg_query/include/postgres/catalog/genbki.h +149 -0
  67. data/ext/pg_query/include/postgres/catalog/index.h +218 -0
  68. data/ext/pg_query/include/postgres/catalog/indexing.h +54 -0
  69. data/ext/pg_query/include/postgres/catalog/namespace.h +189 -0
  70. data/ext/pg_query/include/postgres/catalog/objectaccess.h +267 -0
  71. data/ext/pg_query/include/postgres/catalog/objectaddress.h +93 -0
  72. data/ext/pg_query/include/postgres/catalog/pg_aggregate.h +182 -0
  73. data/ext/pg_query/include/postgres/catalog/pg_aggregate_d.h +78 -0
  74. data/ext/pg_query/include/postgres/catalog/pg_am.h +66 -0
  75. data/ext/pg_query/include/postgres/catalog/pg_am_d.h +47 -0
  76. data/ext/pg_query/include/postgres/catalog/pg_attribute.h +240 -0
  77. data/ext/pg_query/include/postgres/catalog/pg_attribute_d.h +62 -0
  78. data/ext/pg_query/include/postgres/catalog/pg_authid.h +66 -0
  79. data/ext/pg_query/include/postgres/catalog/pg_authid_d.h +60 -0
  80. data/ext/pg_query/include/postgres/catalog/pg_class.h +235 -0
  81. data/ext/pg_query/include/postgres/catalog/pg_class_d.h +134 -0
  82. data/ext/pg_query/include/postgres/catalog/pg_collation.h +106 -0
  83. data/ext/pg_query/include/postgres/catalog/pg_collation_d.h +66 -0
  84. data/ext/pg_query/include/postgres/catalog/pg_constraint.h +278 -0
  85. data/ext/pg_query/include/postgres/catalog/pg_constraint_d.h +74 -0
  86. data/ext/pg_query/include/postgres/catalog/pg_control.h +260 -0
  87. data/ext/pg_query/include/postgres/catalog/pg_conversion.h +79 -0
  88. data/ext/pg_query/include/postgres/catalog/pg_conversion_d.h +38 -0
  89. data/ext/pg_query/include/postgres/catalog/pg_database.h +129 -0
  90. data/ext/pg_query/include/postgres/catalog/pg_database_d.h +53 -0
  91. data/ext/pg_query/include/postgres/catalog/pg_depend.h +77 -0
  92. data/ext/pg_query/include/postgres/catalog/pg_depend_d.h +36 -0
  93. data/ext/pg_query/include/postgres/catalog/pg_event_trigger.h +60 -0
  94. data/ext/pg_query/include/postgres/catalog/pg_event_trigger_d.h +36 -0
  95. data/ext/pg_query/include/postgres/catalog/pg_index.h +92 -0
  96. data/ext/pg_query/include/postgres/catalog/pg_index_d.h +59 -0
  97. data/ext/pg_query/include/postgres/catalog/pg_language.h +75 -0
  98. data/ext/pg_query/include/postgres/catalog/pg_language_d.h +41 -0
  99. data/ext/pg_query/include/postgres/catalog/pg_namespace.h +67 -0
  100. data/ext/pg_query/include/postgres/catalog/pg_namespace_d.h +36 -0
  101. data/ext/pg_query/include/postgres/catalog/pg_opclass.h +91 -0
  102. data/ext/pg_query/include/postgres/catalog/pg_opclass_d.h +51 -0
  103. data/ext/pg_query/include/postgres/catalog/pg_operator.h +124 -0
  104. data/ext/pg_query/include/postgres/catalog/pg_operator_d.h +142 -0
  105. data/ext/pg_query/include/postgres/catalog/pg_opfamily.h +67 -0
  106. data/ext/pg_query/include/postgres/catalog/pg_opfamily_d.h +51 -0
  107. data/ext/pg_query/include/postgres/catalog/pg_partitioned_table.h +76 -0
  108. data/ext/pg_query/include/postgres/catalog/pg_partitioned_table_d.h +36 -0
  109. data/ext/pg_query/include/postgres/catalog/pg_proc.h +223 -0
  110. data/ext/pg_query/include/postgres/catalog/pg_proc_d.h +101 -0
  111. data/ext/pg_query/include/postgres/catalog/pg_publication.h +161 -0
  112. data/ext/pg_query/include/postgres/catalog/pg_publication_d.h +38 -0
  113. data/ext/pg_query/include/postgres/catalog/pg_replication_origin.h +65 -0
  114. data/ext/pg_query/include/postgres/catalog/pg_replication_origin_d.h +33 -0
  115. data/ext/pg_query/include/postgres/catalog/pg_statistic.h +288 -0
  116. data/ext/pg_query/include/postgres/catalog/pg_statistic_d.h +199 -0
  117. data/ext/pg_query/include/postgres/catalog/pg_statistic_ext.h +91 -0
  118. data/ext/pg_query/include/postgres/catalog/pg_statistic_ext_d.h +45 -0
  119. data/ext/pg_query/include/postgres/catalog/pg_transform.h +51 -0
  120. data/ext/pg_query/include/postgres/catalog/pg_transform_d.h +34 -0
  121. data/ext/pg_query/include/postgres/catalog/pg_trigger.h +153 -0
  122. data/ext/pg_query/include/postgres/catalog/pg_trigger_d.h +109 -0
  123. data/ext/pg_query/include/postgres/catalog/pg_ts_config.h +56 -0
  124. data/ext/pg_query/include/postgres/catalog/pg_ts_config_d.h +34 -0
  125. data/ext/pg_query/include/postgres/catalog/pg_ts_dict.h +62 -0
  126. data/ext/pg_query/include/postgres/catalog/pg_ts_dict_d.h +35 -0
  127. data/ext/pg_query/include/postgres/catalog/pg_ts_parser.h +63 -0
  128. data/ext/pg_query/include/postgres/catalog/pg_ts_parser_d.h +37 -0
  129. data/ext/pg_query/include/postgres/catalog/pg_ts_template.h +54 -0
  130. data/ext/pg_query/include/postgres/catalog/pg_ts_template_d.h +34 -0
  131. data/ext/pg_query/include/postgres/catalog/pg_type.h +407 -0
  132. data/ext/pg_query/include/postgres/catalog/pg_type_d.h +324 -0
  133. data/ext/pg_query/include/postgres/catalog/storage.h +50 -0
  134. data/ext/pg_query/include/postgres/catalog/syscache_ids.h +104 -0
  135. data/ext/pg_query/include/postgres/commands/async.h +49 -0
  136. data/ext/pg_query/include/postgres/commands/dbcommands.h +37 -0
  137. data/ext/pg_query/include/postgres/commands/defrem.h +161 -0
  138. data/ext/pg_query/include/postgres/commands/event_trigger.h +97 -0
  139. data/ext/pg_query/include/postgres/commands/explain.h +145 -0
  140. data/ext/pg_query/include/postgres/commands/prepare.h +61 -0
  141. data/ext/pg_query/include/postgres/commands/tablespace.h +69 -0
  142. data/ext/pg_query/include/postgres/commands/trigger.h +288 -0
  143. data/ext/pg_query/include/postgres/commands/user.h +43 -0
  144. data/ext/pg_query/include/postgres/commands/vacuum.h +388 -0
  145. data/ext/pg_query/include/postgres/common/cryptohash.h +39 -0
  146. data/ext/pg_query/include/postgres/common/file_perm.h +56 -0
  147. data/ext/pg_query/include/postgres/common/file_utils.h +65 -0
  148. data/ext/pg_query/include/postgres/common/hashfn.h +119 -0
  149. data/ext/pg_query/include/postgres/common/hashfn_unstable.h +407 -0
  150. data/ext/pg_query/include/postgres/common/int.h +512 -0
  151. data/ext/pg_query/include/postgres/common/keywords.h +29 -0
  152. data/ext/pg_query/include/postgres/common/kwlookup.h +44 -0
  153. data/ext/pg_query/include/postgres/common/pg_prng.h +62 -0
  154. data/ext/pg_query/include/postgres/common/relpath.h +97 -0
  155. data/ext/pg_query/include/postgres/common/scram-common.h +70 -0
  156. data/ext/pg_query/include/postgres/common/sha2.h +32 -0
  157. data/ext/pg_query/include/postgres/common/string.h +44 -0
  158. data/ext/pg_query/include/postgres/common/unicode_east_asian_fw_table.h +124 -0
  159. data/ext/pg_query/include/postgres/common/unicode_nonspacing_table.h +326 -0
  160. data/ext/pg_query/include/postgres/copyfuncs.funcs.c +5261 -0
  161. data/ext/pg_query/include/postgres/copyfuncs.switch.c +989 -0
  162. data/ext/pg_query/include/postgres/datatype/timestamp.h +269 -0
  163. data/ext/pg_query/include/postgres/equalfuncs.funcs.c +3310 -0
  164. data/ext/pg_query/include/postgres/equalfuncs.switch.c +836 -0
  165. data/ext/pg_query/include/postgres/executor/execdesc.h +70 -0
  166. data/ext/pg_query/include/postgres/executor/executor.h +681 -0
  167. data/ext/pg_query/include/postgres/executor/functions.h +56 -0
  168. data/ext/pg_query/include/postgres/executor/instrument.h +120 -0
  169. data/ext/pg_query/include/postgres/executor/spi.h +207 -0
  170. data/ext/pg_query/include/postgres/executor/tablefunc.h +67 -0
  171. data/ext/pg_query/include/postgres/executor/tuptable.h +523 -0
  172. data/ext/pg_query/include/postgres/fmgr.h +800 -0
  173. data/ext/pg_query/include/postgres/foreign/fdwapi.h +294 -0
  174. data/ext/pg_query/include/postgres/funcapi.h +360 -0
  175. data/ext/pg_query/include/postgres/gram.h +1168 -0
  176. data/ext/pg_query/include/postgres/gramparse.h +75 -0
  177. data/ext/pg_query/include/postgres/jit/jit.h +106 -0
  178. data/ext/pg_query/include/postgres/kwlist_d.h +1164 -0
  179. data/ext/pg_query/include/postgres/lib/dshash.h +130 -0
  180. data/ext/pg_query/include/postgres/lib/ilist.h +1159 -0
  181. data/ext/pg_query/include/postgres/lib/pairingheap.h +102 -0
  182. data/ext/pg_query/include/postgres/lib/simplehash.h +1206 -0
  183. data/ext/pg_query/include/postgres/lib/sort_template.h +445 -0
  184. data/ext/pg_query/include/postgres/lib/stringinfo.h +243 -0
  185. data/ext/pg_query/include/postgres/libpq/auth.h +37 -0
  186. data/ext/pg_query/include/postgres/libpq/crypt.h +47 -0
  187. data/ext/pg_query/include/postgres/libpq/hba.h +186 -0
  188. data/ext/pg_query/include/postgres/libpq/libpq-be.h +361 -0
  189. data/ext/pg_query/include/postgres/libpq/libpq.h +143 -0
  190. data/ext/pg_query/include/postgres/libpq/pqcomm.h +169 -0
  191. data/ext/pg_query/include/postgres/libpq/pqformat.h +209 -0
  192. data/ext/pg_query/include/postgres/libpq/pqsignal.h +54 -0
  193. data/ext/pg_query/include/postgres/libpq/protocol.h +89 -0
  194. data/ext/pg_query/include/postgres/libpq/sasl.h +136 -0
  195. data/ext/pg_query/include/postgres/libpq/scram.h +37 -0
  196. data/ext/pg_query/include/postgres/mb/pg_wchar.h +793 -0
  197. data/ext/pg_query/include/postgres/mb/stringinfo_mb.h +24 -0
  198. data/ext/pg_query/include/postgres/miscadmin.h +527 -0
  199. data/ext/pg_query/include/postgres/nodes/bitmapset.h +140 -0
  200. data/ext/pg_query/include/postgres/nodes/execnodes.h +2855 -0
  201. data/ext/pg_query/include/postgres/nodes/extensible.h +164 -0
  202. data/ext/pg_query/include/postgres/nodes/lockoptions.h +61 -0
  203. data/ext/pg_query/include/postgres/nodes/makefuncs.h +127 -0
  204. data/ext/pg_query/include/postgres/nodes/memnodes.h +152 -0
  205. data/ext/pg_query/include/postgres/nodes/miscnodes.h +56 -0
  206. data/ext/pg_query/include/postgres/nodes/nodeFuncs.h +222 -0
  207. data/ext/pg_query/include/postgres/nodes/nodes.h +435 -0
  208. data/ext/pg_query/include/postgres/nodes/nodetags.h +491 -0
  209. data/ext/pg_query/include/postgres/nodes/params.h +170 -0
  210. data/ext/pg_query/include/postgres/nodes/parsenodes.h +4233 -0
  211. data/ext/pg_query/include/postgres/nodes/pathnodes.h +3438 -0
  212. data/ext/pg_query/include/postgres/nodes/pg_list.h +686 -0
  213. data/ext/pg_query/include/postgres/nodes/plannodes.h +1593 -0
  214. data/ext/pg_query/include/postgres/nodes/primnodes.h +2339 -0
  215. data/ext/pg_query/include/postgres/nodes/print.h +34 -0
  216. data/ext/pg_query/include/postgres/nodes/queryjumble.h +86 -0
  217. data/ext/pg_query/include/postgres/nodes/replnodes.h +132 -0
  218. data/ext/pg_query/include/postgres/nodes/supportnodes.h +346 -0
  219. data/ext/pg_query/include/postgres/nodes/tidbitmap.h +75 -0
  220. data/ext/pg_query/include/postgres/nodes/value.h +90 -0
  221. data/ext/pg_query/include/postgres/optimizer/cost.h +216 -0
  222. data/ext/pg_query/include/postgres/optimizer/geqo.h +90 -0
  223. data/ext/pg_query/include/postgres/optimizer/geqo_gene.h +45 -0
  224. data/ext/pg_query/include/postgres/optimizer/optimizer.h +205 -0
  225. data/ext/pg_query/include/postgres/optimizer/paths.h +271 -0
  226. data/ext/pg_query/include/postgres/optimizer/planmain.h +123 -0
  227. data/ext/pg_query/include/postgres/parser/analyze.h +66 -0
  228. data/ext/pg_query/include/postgres/parser/kwlist.h +518 -0
  229. data/ext/pg_query/include/postgres/parser/parse_agg.h +65 -0
  230. data/ext/pg_query/include/postgres/parser/parse_coerce.h +105 -0
  231. data/ext/pg_query/include/postgres/parser/parse_expr.h +25 -0
  232. data/ext/pg_query/include/postgres/parser/parse_func.h +74 -0
  233. data/ext/pg_query/include/postgres/parser/parse_node.h +358 -0
  234. data/ext/pg_query/include/postgres/parser/parse_oper.h +68 -0
  235. data/ext/pg_query/include/postgres/parser/parse_relation.h +129 -0
  236. data/ext/pg_query/include/postgres/parser/parse_type.h +61 -0
  237. data/ext/pg_query/include/postgres/parser/parser.h +68 -0
  238. data/ext/pg_query/include/postgres/parser/parsetree.h +61 -0
  239. data/ext/pg_query/include/postgres/parser/scanner.h +152 -0
  240. data/ext/pg_query/include/postgres/parser/scansup.h +27 -0
  241. data/ext/pg_query/include/postgres/partitioning/partdefs.h +26 -0
  242. data/ext/pg_query/include/postgres/pg_config.h +985 -0
  243. data/ext/pg_query/include/postgres/pg_config_manual.h +385 -0
  244. data/ext/pg_query/include/postgres/pg_config_os.h +8 -0
  245. data/ext/pg_query/include/postgres/pg_getopt.h +56 -0
  246. data/ext/pg_query/include/postgres/pg_trace.h +17 -0
  247. data/ext/pg_query/include/postgres/pgstat.h +780 -0
  248. data/ext/pg_query/include/postgres/pgtime.h +94 -0
  249. data/ext/pg_query/include/postgres/pl_gram.h +385 -0
  250. data/ext/pg_query/include/postgres/pl_reserved_kwlist.h +52 -0
  251. data/ext/pg_query/include/postgres/pl_reserved_kwlist_d.h +114 -0
  252. data/ext/pg_query/include/postgres/pl_unreserved_kwlist.h +112 -0
  253. data/ext/pg_query/include/postgres/pl_unreserved_kwlist_d.h +246 -0
  254. data/ext/pg_query/include/postgres/plerrcodes.h +998 -0
  255. data/ext/pg_query/include/postgres/plpgsql.h +1342 -0
  256. data/ext/pg_query/include/postgres/port/atomics/arch-arm.h +32 -0
  257. data/ext/pg_query/include/postgres/port/atomics/arch-hppa.h +17 -0
  258. data/ext/pg_query/include/postgres/port/atomics/arch-ppc.h +256 -0
  259. data/ext/pg_query/include/postgres/port/atomics/arch-x86.h +254 -0
  260. data/ext/pg_query/include/postgres/port/atomics/fallback.h +170 -0
  261. data/ext/pg_query/include/postgres/port/atomics/generic-gcc.h +323 -0
  262. data/ext/pg_query/include/postgres/port/atomics/generic-msvc.h +119 -0
  263. data/ext/pg_query/include/postgres/port/atomics/generic-sunpro.h +121 -0
  264. data/ext/pg_query/include/postgres/port/atomics/generic.h +437 -0
  265. data/ext/pg_query/include/postgres/port/atomics.h +606 -0
  266. data/ext/pg_query/include/postgres/port/pg_bitutils.h +421 -0
  267. data/ext/pg_query/include/postgres/port/pg_bswap.h +161 -0
  268. data/ext/pg_query/include/postgres/port/pg_crc32c.h +110 -0
  269. data/ext/pg_query/include/postgres/port/pg_iovec.h +117 -0
  270. data/ext/pg_query/include/postgres/port/simd.h +422 -0
  271. data/ext/pg_query/include/postgres/port/win32/arpa/inet.h +3 -0
  272. data/ext/pg_query/include/postgres/port/win32/dlfcn.h +1 -0
  273. data/ext/pg_query/include/postgres/port/win32/grp.h +1 -0
  274. data/ext/pg_query/include/postgres/port/win32/netdb.h +7 -0
  275. data/ext/pg_query/include/postgres/port/win32/netinet/in.h +3 -0
  276. data/ext/pg_query/include/postgres/port/win32/netinet/tcp.h +7 -0
  277. data/ext/pg_query/include/postgres/port/win32/pwd.h +3 -0
  278. data/ext/pg_query/include/postgres/port/win32/sys/resource.h +20 -0
  279. data/ext/pg_query/include/postgres/port/win32/sys/select.h +3 -0
  280. data/ext/pg_query/include/postgres/port/win32/sys/socket.h +34 -0
  281. data/ext/pg_query/include/postgres/port/win32/sys/un.h +17 -0
  282. data/ext/pg_query/include/postgres/port/win32/sys/wait.h +3 -0
  283. data/ext/pg_query/include/postgres/port/win32.h +59 -0
  284. data/ext/pg_query/include/postgres/port/win32_msvc/dirent.h +34 -0
  285. data/ext/pg_query/include/postgres/port/win32_msvc/sys/file.h +1 -0
  286. data/ext/pg_query/include/postgres/port/win32_msvc/sys/param.h +1 -0
  287. data/ext/pg_query/include/postgres/port/win32_msvc/sys/time.h +1 -0
  288. data/ext/pg_query/include/postgres/port/win32_msvc/unistd.h +9 -0
  289. data/ext/pg_query/include/postgres/port/win32_msvc/utime.h +3 -0
  290. data/ext/pg_query/include/postgres/port/win32_port.h +582 -0
  291. data/ext/pg_query/include/postgres/port.h +555 -0
  292. data/ext/pg_query/include/postgres/portability/instr_time.h +197 -0
  293. data/ext/pg_query/include/postgres/postgres.h +579 -0
  294. data/ext/pg_query/include/postgres/postgres_ext.h +73 -0
  295. data/ext/pg_query/include/postgres/postmaster/autovacuum.h +69 -0
  296. data/ext/pg_query/include/postgres/postmaster/bgworker.h +164 -0
  297. data/ext/pg_query/include/postgres/postmaster/bgworker_internals.h +60 -0
  298. data/ext/pg_query/include/postgres/postmaster/bgwriter.h +45 -0
  299. data/ext/pg_query/include/postgres/postmaster/interrupt.h +32 -0
  300. data/ext/pg_query/include/postgres/postmaster/pgarch.h +36 -0
  301. data/ext/pg_query/include/postgres/postmaster/postmaster.h +101 -0
  302. data/ext/pg_query/include/postgres/postmaster/startup.h +41 -0
  303. data/ext/pg_query/include/postgres/postmaster/syslogger.h +101 -0
  304. data/ext/pg_query/include/postgres/postmaster/walsummarizer.h +35 -0
  305. data/ext/pg_query/include/postgres/postmaster/walwriter.h +23 -0
  306. data/ext/pg_query/include/postgres/regex/regex.h +272 -0
  307. data/ext/pg_query/include/postgres/replication/logicallauncher.h +34 -0
  308. data/ext/pg_query/include/postgres/replication/logicalproto.h +274 -0
  309. data/ext/pg_query/include/postgres/replication/logicalworker.h +33 -0
  310. data/ext/pg_query/include/postgres/replication/origin.h +73 -0
  311. data/ext/pg_query/include/postgres/replication/reorderbuffer.h +734 -0
  312. data/ext/pg_query/include/postgres/replication/slot.h +289 -0
  313. data/ext/pg_query/include/postgres/replication/slotsync.h +38 -0
  314. data/ext/pg_query/include/postgres/replication/syncrep.h +109 -0
  315. data/ext/pg_query/include/postgres/replication/walreceiver.h +504 -0
  316. data/ext/pg_query/include/postgres/replication/walsender.h +76 -0
  317. data/ext/pg_query/include/postgres/rewrite/prs2lock.h +46 -0
  318. data/ext/pg_query/include/postgres/rewrite/rewriteHandler.h +41 -0
  319. data/ext/pg_query/include/postgres/rewrite/rewriteManip.h +96 -0
  320. data/ext/pg_query/include/postgres/rewrite/rewriteSupport.h +26 -0
  321. data/ext/pg_query/include/postgres/storage/block.h +108 -0
  322. data/ext/pg_query/include/postgres/storage/buf.h +46 -0
  323. data/ext/pg_query/include/postgres/storage/bufmgr.h +411 -0
  324. data/ext/pg_query/include/postgres/storage/bufpage.h +510 -0
  325. data/ext/pg_query/include/postgres/storage/condition_variable.h +73 -0
  326. data/ext/pg_query/include/postgres/storage/dsm.h +61 -0
  327. data/ext/pg_query/include/postgres/storage/dsm_impl.h +79 -0
  328. data/ext/pg_query/include/postgres/storage/fd.h +219 -0
  329. data/ext/pg_query/include/postgres/storage/fileset.h +40 -0
  330. data/ext/pg_query/include/postgres/storage/ipc.h +87 -0
  331. data/ext/pg_query/include/postgres/storage/item.h +19 -0
  332. data/ext/pg_query/include/postgres/storage/itemid.h +184 -0
  333. data/ext/pg_query/include/postgres/storage/itemptr.h +245 -0
  334. data/ext/pg_query/include/postgres/storage/large_object.h +100 -0
  335. data/ext/pg_query/include/postgres/storage/latch.h +196 -0
  336. data/ext/pg_query/include/postgres/storage/lmgr.h +126 -0
  337. data/ext/pg_query/include/postgres/storage/lock.h +624 -0
  338. data/ext/pg_query/include/postgres/storage/lockdefs.h +61 -0
  339. data/ext/pg_query/include/postgres/storage/lwlock.h +228 -0
  340. data/ext/pg_query/include/postgres/storage/lwlocknames.h +47 -0
  341. data/ext/pg_query/include/postgres/storage/off.h +57 -0
  342. data/ext/pg_query/include/postgres/storage/pg_sema.h +61 -0
  343. data/ext/pg_query/include/postgres/storage/pg_shmem.h +93 -0
  344. data/ext/pg_query/include/postgres/storage/pmsignal.h +105 -0
  345. data/ext/pg_query/include/postgres/storage/predicate.h +83 -0
  346. data/ext/pg_query/include/postgres/storage/proc.h +488 -0
  347. data/ext/pg_query/include/postgres/storage/procarray.h +103 -0
  348. data/ext/pg_query/include/postgres/storage/proclist_types.h +53 -0
  349. data/ext/pg_query/include/postgres/storage/procnumber.h +43 -0
  350. data/ext/pg_query/include/postgres/storage/procsignal.h +75 -0
  351. data/ext/pg_query/include/postgres/storage/read_stream.h +65 -0
  352. data/ext/pg_query/include/postgres/storage/relfilelocator.h +100 -0
  353. data/ext/pg_query/include/postgres/storage/s_lock.h +847 -0
  354. data/ext/pg_query/include/postgres/storage/sharedfileset.h +37 -0
  355. data/ext/pg_query/include/postgres/storage/shm_mq.h +86 -0
  356. data/ext/pg_query/include/postgres/storage/shm_toc.h +58 -0
  357. data/ext/pg_query/include/postgres/storage/shmem.h +59 -0
  358. data/ext/pg_query/include/postgres/storage/sinval.h +153 -0
  359. data/ext/pg_query/include/postgres/storage/smgr.h +130 -0
  360. data/ext/pg_query/include/postgres/storage/spin.h +77 -0
  361. data/ext/pg_query/include/postgres/storage/standby.h +109 -0
  362. data/ext/pg_query/include/postgres/storage/standbydefs.h +74 -0
  363. data/ext/pg_query/include/postgres/storage/sync.h +66 -0
  364. data/ext/pg_query/include/postgres/tcop/cmdtag.h +62 -0
  365. data/ext/pg_query/include/postgres/tcop/cmdtaglist.h +219 -0
  366. data/ext/pg_query/include/postgres/tcop/deparse_utility.h +108 -0
  367. data/ext/pg_query/include/postgres/tcop/dest.h +148 -0
  368. data/ext/pg_query/include/postgres/tcop/fastpath.h +20 -0
  369. data/ext/pg_query/include/postgres/tcop/pquery.h +51 -0
  370. data/ext/pg_query/include/postgres/tcop/tcopprot.h +98 -0
  371. data/ext/pg_query/include/postgres/tcop/utility.h +112 -0
  372. data/ext/pg_query/include/postgres/tsearch/ts_cache.h +96 -0
  373. data/ext/pg_query/include/postgres/utils/acl.h +290 -0
  374. data/ext/pg_query/include/postgres/utils/aclchk_internal.h +45 -0
  375. data/ext/pg_query/include/postgres/utils/array.h +481 -0
  376. data/ext/pg_query/include/postgres/utils/ascii.h +84 -0
  377. data/ext/pg_query/include/postgres/utils/backend_progress.h +46 -0
  378. data/ext/pg_query/include/postgres/utils/backend_status.h +340 -0
  379. data/ext/pg_query/include/postgres/utils/builtins.h +139 -0
  380. data/ext/pg_query/include/postgres/utils/bytea.h +28 -0
  381. data/ext/pg_query/include/postgres/utils/catcache.h +231 -0
  382. data/ext/pg_query/include/postgres/utils/date.h +118 -0
  383. data/ext/pg_query/include/postgres/utils/datetime.h +367 -0
  384. data/ext/pg_query/include/postgres/utils/datum.h +76 -0
  385. data/ext/pg_query/include/postgres/utils/dsa.h +166 -0
  386. data/ext/pg_query/include/postgres/utils/elog.h +540 -0
  387. data/ext/pg_query/include/postgres/utils/errcodes.h +352 -0
  388. data/ext/pg_query/include/postgres/utils/expandeddatum.h +170 -0
  389. data/ext/pg_query/include/postgres/utils/expandedrecord.h +241 -0
  390. data/ext/pg_query/include/postgres/utils/float.h +357 -0
  391. data/ext/pg_query/include/postgres/utils/fmgroids.h +3347 -0
  392. data/ext/pg_query/include/postgres/utils/fmgrprotos.h +2904 -0
  393. data/ext/pg_query/include/postgres/utils/fmgrtab.h +49 -0
  394. data/ext/pg_query/include/postgres/utils/guc.h +456 -0
  395. data/ext/pg_query/include/postgres/utils/guc_hooks.h +184 -0
  396. data/ext/pg_query/include/postgres/utils/guc_tables.h +323 -0
  397. data/ext/pg_query/include/postgres/utils/hsearch.h +153 -0
  398. data/ext/pg_query/include/postgres/utils/injection_point.h +44 -0
  399. data/ext/pg_query/include/postgres/utils/inval.h +68 -0
  400. data/ext/pg_query/include/postgres/utils/logtape.h +77 -0
  401. data/ext/pg_query/include/postgres/utils/lsyscache.h +215 -0
  402. data/ext/pg_query/include/postgres/utils/memdebug.h +82 -0
  403. data/ext/pg_query/include/postgres/utils/memutils.h +193 -0
  404. data/ext/pg_query/include/postgres/utils/memutils_internal.h +176 -0
  405. data/ext/pg_query/include/postgres/utils/memutils_memorychunk.h +253 -0
  406. data/ext/pg_query/include/postgres/utils/numeric.h +110 -0
  407. data/ext/pg_query/include/postgres/utils/palloc.h +151 -0
  408. data/ext/pg_query/include/postgres/utils/partcache.h +103 -0
  409. data/ext/pg_query/include/postgres/utils/pg_locale.h +136 -0
  410. data/ext/pg_query/include/postgres/utils/pgstat_internal.h +827 -0
  411. data/ext/pg_query/include/postgres/utils/plancache.h +238 -0
  412. data/ext/pg_query/include/postgres/utils/portal.h +252 -0
  413. data/ext/pg_query/include/postgres/utils/probes.h +114 -0
  414. data/ext/pg_query/include/postgres/utils/ps_status.h +47 -0
  415. data/ext/pg_query/include/postgres/utils/queryenvironment.h +74 -0
  416. data/ext/pg_query/include/postgres/utils/regproc.h +39 -0
  417. data/ext/pg_query/include/postgres/utils/rel.h +711 -0
  418. data/ext/pg_query/include/postgres/utils/relcache.h +155 -0
  419. data/ext/pg_query/include/postgres/utils/reltrigger.h +81 -0
  420. data/ext/pg_query/include/postgres/utils/resowner.h +167 -0
  421. data/ext/pg_query/include/postgres/utils/ruleutils.h +52 -0
  422. data/ext/pg_query/include/postgres/utils/sharedtuplestore.h +61 -0
  423. data/ext/pg_query/include/postgres/utils/snapmgr.h +130 -0
  424. data/ext/pg_query/include/postgres/utils/snapshot.h +219 -0
  425. data/ext/pg_query/include/postgres/utils/sortsupport.h +391 -0
  426. data/ext/pg_query/include/postgres/utils/syscache.h +136 -0
  427. data/ext/pg_query/include/postgres/utils/timeout.h +96 -0
  428. data/ext/pg_query/include/postgres/utils/timestamp.h +147 -0
  429. data/ext/pg_query/include/postgres/utils/tuplesort.h +472 -0
  430. data/ext/pg_query/include/postgres/utils/tuplestore.h +88 -0
  431. data/ext/pg_query/include/postgres/utils/typcache.h +210 -0
  432. data/ext/pg_query/include/postgres/utils/varlena.h +53 -0
  433. data/ext/pg_query/include/postgres/utils/wait_event.h +108 -0
  434. data/ext/pg_query/include/postgres/utils/wait_event_types.h +218 -0
  435. data/ext/pg_query/include/postgres/utils/xml.h +94 -0
  436. data/ext/pg_query/include/postgres/varatt.h +358 -0
  437. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +7723 -6368
  438. data/ext/pg_query/include/protobuf/pg_query.pb.h +120022 -87031
  439. data/ext/pg_query/pg_query.c +10 -1
  440. data/ext/pg_query/pg_query.pb-c.c +22595 -17738
  441. data/ext/pg_query/pg_query_deparse.c +1 -10635
  442. data/ext/pg_query/pg_query_fingerprint.c +12 -8
  443. data/ext/pg_query/pg_query_fingerprint.h +1 -1
  444. data/ext/pg_query/pg_query_internal.h +1 -1
  445. data/ext/pg_query/pg_query_json_plpgsql.c +1 -0
  446. data/ext/pg_query/pg_query_normalize.c +43 -2
  447. data/ext/pg_query/pg_query_outfuncs_json.c +9 -1
  448. data/ext/pg_query/pg_query_outfuncs_protobuf.c +3 -2
  449. data/ext/pg_query/pg_query_parse.c +47 -5
  450. data/ext/pg_query/pg_query_parse_plpgsql.c +19 -18
  451. data/ext/pg_query/pg_query_readfuncs_protobuf.c +3 -2
  452. data/ext/pg_query/pg_query_ruby.c +5 -0
  453. data/ext/pg_query/pg_query_scan.c +2 -2
  454. data/ext/pg_query/pg_query_split.c +3 -3
  455. data/ext/pg_query/postgres_deparse.c +11496 -0
  456. data/ext/pg_query/postgres_deparse.h +9 -0
  457. data/ext/pg_query/src_backend_catalog_namespace.c +243 -63
  458. data/ext/pg_query/src_backend_catalog_pg_proc.c +1 -3
  459. data/ext/pg_query/src_backend_commands_define.c +2 -3
  460. data/ext/pg_query/src_backend_nodes_bitmapset.c +140 -156
  461. data/ext/pg_query/src_backend_nodes_copyfuncs.c +96 -6202
  462. data/ext/pg_query/src_backend_nodes_equalfuncs.c +95 -4068
  463. data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
  464. data/ext/pg_query/src_backend_nodes_list.c +16 -8
  465. data/ext/pg_query/src_backend_nodes_makefuncs.c +134 -1
  466. data/ext/pg_query/src_backend_nodes_nodeFuncs.c +391 -133
  467. data/ext/pg_query/src_backend_nodes_value.c +1 -1
  468. data/ext/pg_query/src_backend_parser_gram.c +43710 -39953
  469. data/ext/pg_query/src_backend_parser_parser.c +34 -8
  470. data/ext/pg_query/src_backend_parser_scan.c +6971 -3373
  471. data/ext/pg_query/src_backend_parser_scansup.c +2 -1
  472. data/ext/pg_query/src_backend_storage_ipc_ipc.c +1 -1
  473. data/ext/pg_query/src_backend_tcop_postgres.c +99 -96
  474. data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +2 -2
  475. data/ext/pg_query/src_backend_utils_adt_datum.c +2 -2
  476. data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
  477. data/ext/pg_query/src_backend_utils_adt_format_type.c +1 -1
  478. data/ext/pg_query/src_backend_utils_adt_numutils.c +488 -0
  479. data/ext/pg_query/src_backend_utils_adt_ruleutils.c +177 -30
  480. data/ext/pg_query/src_backend_utils_error_assert.c +4 -7
  481. data/ext/pg_query/src_backend_utils_error_elog.c +397 -270
  482. data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +36 -2
  483. data/ext/pg_query/src_backend_utils_init_globals.c +20 -5
  484. data/ext/pg_query/src_backend_utils_mb_mbutils.c +31 -84
  485. data/ext/pg_query/src_backend_utils_misc_guc_tables.c +502 -0
  486. data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +166 -0
  487. data/ext/pg_query/src_backend_utils_mmgr_aset.c +704 -497
  488. data/ext/pg_query/src_backend_utils_mmgr_bump.c +728 -0
  489. data/ext/pg_query/src_backend_utils_mmgr_generation.c +1115 -0
  490. data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +637 -233
  491. data/ext/pg_query/src_backend_utils_mmgr_slab.c +1079 -0
  492. data/ext/pg_query/src_common_encnames.c +46 -44
  493. data/ext/pg_query/src_common_hashfn.c +1 -1
  494. data/ext/pg_query/src_common_keywords.c +1 -1
  495. data/ext/pg_query/src_common_kwlist_d.h +586 -517
  496. data/ext/pg_query/src_common_kwlookup.c +1 -1
  497. data/ext/pg_query/src_common_psprintf.c +3 -3
  498. data/ext/pg_query/src_common_stringinfo.c +21 -4
  499. data/ext/pg_query/src_common_wchar.c +100 -116
  500. data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +99 -5
  501. data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -1
  502. data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +829 -763
  503. data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
  504. data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +1 -1
  505. data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +19 -1
  506. data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +48 -46
  507. data/ext/pg_query/src_port_pg_bitutils.c +251 -32
  508. data/ext/pg_query/src_port_pgstrcasecmp.c +57 -1
  509. data/ext/pg_query/src_port_snprintf.c +20 -27
  510. data/ext/pg_query/src_port_strerror.c +1 -3
  511. data/ext/pg_query/src_port_strlcpy.c +79 -0
  512. data/lib/pg_query/fingerprint.rb +5 -8
  513. data/lib/pg_query/node.rb +16 -11
  514. data/lib/pg_query/param_refs.rb +2 -2
  515. data/lib/pg_query/parse.rb +6 -8
  516. data/lib/pg_query/parse_error.rb +1 -0
  517. data/lib/pg_query/pg_query_pb.rb +173 -3196
  518. data/lib/pg_query/scan.rb +1 -0
  519. data/lib/pg_query/treewalker.rb +52 -11
  520. data/lib/pg_query/truncate.rb +18 -20
  521. data/lib/pg_query/version.rb +1 -1
  522. metadata +443 -442
  523. data/ext/pg_query/guc-file.c +0 -0
  524. data/ext/pg_query/include/access/amapi.h +0 -290
  525. data/ext/pg_query/include/access/attmap.h +0 -52
  526. data/ext/pg_query/include/access/attnum.h +0 -64
  527. data/ext/pg_query/include/access/clog.h +0 -63
  528. data/ext/pg_query/include/access/commit_ts.h +0 -74
  529. data/ext/pg_query/include/access/detoast.h +0 -82
  530. data/ext/pg_query/include/access/genam.h +0 -231
  531. data/ext/pg_query/include/access/gin.h +0 -78
  532. data/ext/pg_query/include/access/htup.h +0 -89
  533. data/ext/pg_query/include/access/htup_details.h +0 -807
  534. data/ext/pg_query/include/access/itup.h +0 -167
  535. data/ext/pg_query/include/access/parallel.h +0 -82
  536. data/ext/pg_query/include/access/printtup.h +0 -35
  537. data/ext/pg_query/include/access/relation.h +0 -28
  538. data/ext/pg_query/include/access/relscan.h +0 -191
  539. data/ext/pg_query/include/access/rmgrlist.h +0 -49
  540. data/ext/pg_query/include/access/sdir.h +0 -58
  541. data/ext/pg_query/include/access/skey.h +0 -151
  542. data/ext/pg_query/include/access/stratnum.h +0 -85
  543. data/ext/pg_query/include/access/sysattr.h +0 -29
  544. data/ext/pg_query/include/access/table.h +0 -28
  545. data/ext/pg_query/include/access/tableam.h +0 -2077
  546. data/ext/pg_query/include/access/toast_compression.h +0 -73
  547. data/ext/pg_query/include/access/transam.h +0 -375
  548. data/ext/pg_query/include/access/tupconvert.h +0 -51
  549. data/ext/pg_query/include/access/tupdesc.h +0 -154
  550. data/ext/pg_query/include/access/tupmacs.h +0 -247
  551. data/ext/pg_query/include/access/twophase.h +0 -65
  552. data/ext/pg_query/include/access/xact.h +0 -523
  553. data/ext/pg_query/include/access/xlog.h +0 -303
  554. data/ext/pg_query/include/access/xlog_internal.h +0 -366
  555. data/ext/pg_query/include/access/xlogdefs.h +0 -101
  556. data/ext/pg_query/include/access/xlogprefetcher.h +0 -55
  557. data/ext/pg_query/include/access/xlogreader.h +0 -443
  558. data/ext/pg_query/include/access/xlogrecord.h +0 -236
  559. data/ext/pg_query/include/access/xlogrecovery.h +0 -157
  560. data/ext/pg_query/include/c.h +0 -1391
  561. data/ext/pg_query/include/catalog/catalog.h +0 -44
  562. data/ext/pg_query/include/catalog/catversion.h +0 -58
  563. data/ext/pg_query/include/catalog/dependency.h +0 -269
  564. data/ext/pg_query/include/catalog/genbki.h +0 -142
  565. data/ext/pg_query/include/catalog/index.h +0 -214
  566. data/ext/pg_query/include/catalog/indexing.h +0 -54
  567. data/ext/pg_query/include/catalog/namespace.h +0 -190
  568. data/ext/pg_query/include/catalog/objectaccess.h +0 -265
  569. data/ext/pg_query/include/catalog/objectaddress.h +0 -89
  570. data/ext/pg_query/include/catalog/pg_aggregate.h +0 -180
  571. data/ext/pg_query/include/catalog/pg_aggregate_d.h +0 -78
  572. data/ext/pg_query/include/catalog/pg_am.h +0 -63
  573. data/ext/pg_query/include/catalog/pg_am_d.h +0 -47
  574. data/ext/pg_query/include/catalog/pg_attribute.h +0 -221
  575. data/ext/pg_query/include/catalog/pg_attribute_d.h +0 -62
  576. data/ext/pg_query/include/catalog/pg_authid.h +0 -63
  577. data/ext/pg_query/include/catalog/pg_authid_d.h +0 -57
  578. data/ext/pg_query/include/catalog/pg_class.h +0 -230
  579. data/ext/pg_query/include/catalog/pg_class_d.h +0 -132
  580. data/ext/pg_query/include/catalog/pg_collation.h +0 -98
  581. data/ext/pg_query/include/catalog/pg_collation_d.h +0 -62
  582. data/ext/pg_query/include/catalog/pg_constraint.h +0 -273
  583. data/ext/pg_query/include/catalog/pg_constraint_d.h +0 -73
  584. data/ext/pg_query/include/catalog/pg_control.h +0 -250
  585. data/ext/pg_query/include/catalog/pg_conversion.h +0 -75
  586. data/ext/pg_query/include/catalog/pg_conversion_d.h +0 -38
  587. data/ext/pg_query/include/catalog/pg_depend.h +0 -77
  588. data/ext/pg_query/include/catalog/pg_depend_d.h +0 -36
  589. data/ext/pg_query/include/catalog/pg_event_trigger.h +0 -57
  590. data/ext/pg_query/include/catalog/pg_event_trigger_d.h +0 -36
  591. data/ext/pg_query/include/catalog/pg_index.h +0 -90
  592. data/ext/pg_query/include/catalog/pg_index_d.h +0 -59
  593. data/ext/pg_query/include/catalog/pg_language.h +0 -72
  594. data/ext/pg_query/include/catalog/pg_language_d.h +0 -41
  595. data/ext/pg_query/include/catalog/pg_namespace.h +0 -64
  596. data/ext/pg_query/include/catalog/pg_namespace_d.h +0 -36
  597. data/ext/pg_query/include/catalog/pg_opclass.h +0 -88
  598. data/ext/pg_query/include/catalog/pg_opclass_d.h +0 -51
  599. data/ext/pg_query/include/catalog/pg_operator.h +0 -107
  600. data/ext/pg_query/include/catalog/pg_operator_d.h +0 -142
  601. data/ext/pg_query/include/catalog/pg_opfamily.h +0 -63
  602. data/ext/pg_query/include/catalog/pg_opfamily_d.h +0 -49
  603. data/ext/pg_query/include/catalog/pg_parameter_acl.h +0 -60
  604. data/ext/pg_query/include/catalog/pg_parameter_acl_d.h +0 -34
  605. data/ext/pg_query/include/catalog/pg_partitioned_table.h +0 -74
  606. data/ext/pg_query/include/catalog/pg_partitioned_table_d.h +0 -36
  607. data/ext/pg_query/include/catalog/pg_proc.h +0 -220
  608. data/ext/pg_query/include/catalog/pg_proc_d.h +0 -101
  609. data/ext/pg_query/include/catalog/pg_publication.h +0 -161
  610. data/ext/pg_query/include/catalog/pg_publication_d.h +0 -38
  611. data/ext/pg_query/include/catalog/pg_replication_origin.h +0 -62
  612. data/ext/pg_query/include/catalog/pg_replication_origin_d.h +0 -33
  613. data/ext/pg_query/include/catalog/pg_statistic.h +0 -282
  614. data/ext/pg_query/include/catalog/pg_statistic_d.h +0 -195
  615. data/ext/pg_query/include/catalog/pg_statistic_ext.h +0 -88
  616. data/ext/pg_query/include/catalog/pg_statistic_ext_d.h +0 -45
  617. data/ext/pg_query/include/catalog/pg_transform.h +0 -48
  618. data/ext/pg_query/include/catalog/pg_transform_d.h +0 -34
  619. data/ext/pg_query/include/catalog/pg_trigger.h +0 -153
  620. data/ext/pg_query/include/catalog/pg_trigger_d.h +0 -109
  621. data/ext/pg_query/include/catalog/pg_ts_config.h +0 -53
  622. data/ext/pg_query/include/catalog/pg_ts_config_d.h +0 -34
  623. data/ext/pg_query/include/catalog/pg_ts_dict.h +0 -59
  624. data/ext/pg_query/include/catalog/pg_ts_dict_d.h +0 -35
  625. data/ext/pg_query/include/catalog/pg_ts_parser.h +0 -60
  626. data/ext/pg_query/include/catalog/pg_ts_parser_d.h +0 -37
  627. data/ext/pg_query/include/catalog/pg_ts_template.h +0 -51
  628. data/ext/pg_query/include/catalog/pg_ts_template_d.h +0 -34
  629. data/ext/pg_query/include/catalog/pg_type.h +0 -404
  630. data/ext/pg_query/include/catalog/pg_type_d.h +0 -324
  631. data/ext/pg_query/include/catalog/storage.h +0 -50
  632. data/ext/pg_query/include/commands/async.h +0 -53
  633. data/ext/pg_query/include/commands/dbcommands.h +0 -36
  634. data/ext/pg_query/include/commands/defrem.h +0 -160
  635. data/ext/pg_query/include/commands/event_trigger.h +0 -88
  636. data/ext/pg_query/include/commands/explain.h +0 -127
  637. data/ext/pg_query/include/commands/prepare.h +0 -61
  638. data/ext/pg_query/include/commands/tablespace.h +0 -69
  639. data/ext/pg_query/include/commands/trigger.h +0 -287
  640. data/ext/pg_query/include/commands/user.h +0 -37
  641. data/ext/pg_query/include/commands/vacuum.h +0 -340
  642. data/ext/pg_query/include/commands/variable.h +0 -38
  643. data/ext/pg_query/include/common/file_perm.h +0 -56
  644. data/ext/pg_query/include/common/hashfn.h +0 -104
  645. data/ext/pg_query/include/common/ip.h +0 -31
  646. data/ext/pg_query/include/common/keywords.h +0 -29
  647. data/ext/pg_query/include/common/kwlookup.h +0 -44
  648. data/ext/pg_query/include/common/pg_prng.h +0 -60
  649. data/ext/pg_query/include/common/relpath.h +0 -90
  650. data/ext/pg_query/include/common/string.h +0 -42
  651. data/ext/pg_query/include/common/unicode_combining_table.h +0 -308
  652. data/ext/pg_query/include/common/unicode_east_asian_fw_table.h +0 -125
  653. data/ext/pg_query/include/datatype/timestamp.h +0 -236
  654. data/ext/pg_query/include/executor/execdesc.h +0 -70
  655. data/ext/pg_query/include/executor/executor.h +0 -663
  656. data/ext/pg_query/include/executor/functions.h +0 -55
  657. data/ext/pg_query/include/executor/instrument.h +0 -118
  658. data/ext/pg_query/include/executor/spi.h +0 -213
  659. data/ext/pg_query/include/executor/tablefunc.h +0 -67
  660. data/ext/pg_query/include/executor/tuptable.h +0 -487
  661. data/ext/pg_query/include/fmgr.h +0 -781
  662. data/ext/pg_query/include/funcapi.h +0 -360
  663. data/ext/pg_query/include/getaddrinfo.h +0 -162
  664. data/ext/pg_query/include/jit/jit.h +0 -105
  665. data/ext/pg_query/include/kwlist_d.h +0 -1095
  666. data/ext/pg_query/include/lib/dshash.h +0 -112
  667. data/ext/pg_query/include/lib/ilist.h +0 -746
  668. data/ext/pg_query/include/lib/pairingheap.h +0 -102
  669. data/ext/pg_query/include/lib/simplehash.h +0 -1184
  670. data/ext/pg_query/include/lib/sort_template.h +0 -432
  671. data/ext/pg_query/include/lib/stringinfo.h +0 -161
  672. data/ext/pg_query/include/libpq/auth.h +0 -31
  673. data/ext/pg_query/include/libpq/crypt.h +0 -47
  674. data/ext/pg_query/include/libpq/hba.h +0 -179
  675. data/ext/pg_query/include/libpq/libpq-be.h +0 -343
  676. data/ext/pg_query/include/libpq/libpq.h +0 -144
  677. data/ext/pg_query/include/libpq/pqcomm.h +0 -194
  678. data/ext/pg_query/include/libpq/pqformat.h +0 -210
  679. data/ext/pg_query/include/libpq/pqsignal.h +0 -42
  680. data/ext/pg_query/include/mb/pg_wchar.h +0 -755
  681. data/ext/pg_query/include/mb/stringinfo_mb.h +0 -24
  682. data/ext/pg_query/include/miscadmin.h +0 -495
  683. data/ext/pg_query/include/nodes/bitmapset.h +0 -122
  684. data/ext/pg_query/include/nodes/execnodes.h +0 -2715
  685. data/ext/pg_query/include/nodes/extensible.h +0 -162
  686. data/ext/pg_query/include/nodes/lockoptions.h +0 -61
  687. data/ext/pg_query/include/nodes/makefuncs.h +0 -109
  688. data/ext/pg_query/include/nodes/memnodes.h +0 -110
  689. data/ext/pg_query/include/nodes/nodeFuncs.h +0 -162
  690. data/ext/pg_query/include/nodes/nodes.h +0 -861
  691. data/ext/pg_query/include/nodes/params.h +0 -170
  692. data/ext/pg_query/include/nodes/parsenodes.h +0 -3812
  693. data/ext/pg_query/include/nodes/pathnodes.h +0 -2734
  694. data/ext/pg_query/include/nodes/pg_list.h +0 -612
  695. data/ext/pg_query/include/nodes/plannodes.h +0 -1349
  696. data/ext/pg_query/include/nodes/primnodes.h +0 -1593
  697. data/ext/pg_query/include/nodes/print.h +0 -34
  698. data/ext/pg_query/include/nodes/tidbitmap.h +0 -75
  699. data/ext/pg_query/include/nodes/value.h +0 -80
  700. data/ext/pg_query/include/optimizer/cost.h +0 -213
  701. data/ext/pg_query/include/optimizer/geqo.h +0 -90
  702. data/ext/pg_query/include/optimizer/geqo_gene.h +0 -45
  703. data/ext/pg_query/include/optimizer/optimizer.h +0 -202
  704. data/ext/pg_query/include/optimizer/paths.h +0 -257
  705. data/ext/pg_query/include/optimizer/planmain.h +0 -120
  706. data/ext/pg_query/include/parser/analyze.h +0 -63
  707. data/ext/pg_query/include/parser/gram.h +0 -1101
  708. data/ext/pg_query/include/parser/gramparse.h +0 -75
  709. data/ext/pg_query/include/parser/kwlist.h +0 -487
  710. data/ext/pg_query/include/parser/parse_agg.h +0 -63
  711. data/ext/pg_query/include/parser/parse_coerce.h +0 -100
  712. data/ext/pg_query/include/parser/parse_expr.h +0 -25
  713. data/ext/pg_query/include/parser/parse_func.h +0 -74
  714. data/ext/pg_query/include/parser/parse_node.h +0 -339
  715. data/ext/pg_query/include/parser/parse_oper.h +0 -65
  716. data/ext/pg_query/include/parser/parse_relation.h +0 -124
  717. data/ext/pg_query/include/parser/parse_type.h +0 -60
  718. data/ext/pg_query/include/parser/parser.h +0 -68
  719. data/ext/pg_query/include/parser/parsetree.h +0 -61
  720. data/ext/pg_query/include/parser/scanner.h +0 -152
  721. data/ext/pg_query/include/parser/scansup.h +0 -27
  722. data/ext/pg_query/include/partitioning/partdefs.h +0 -26
  723. data/ext/pg_query/include/pg_config.h +0 -1037
  724. data/ext/pg_query/include/pg_config_manual.h +0 -410
  725. data/ext/pg_query/include/pg_config_os.h +0 -8
  726. data/ext/pg_query/include/pg_getopt.h +0 -56
  727. data/ext/pg_query/include/pg_trace.h +0 -17
  728. data/ext/pg_query/include/pgstat.h +0 -699
  729. data/ext/pg_query/include/pgtime.h +0 -94
  730. data/ext/pg_query/include/pl_gram.h +0 -383
  731. data/ext/pg_query/include/pl_reserved_kwlist.h +0 -52
  732. data/ext/pg_query/include/pl_reserved_kwlist_d.h +0 -114
  733. data/ext/pg_query/include/pl_unreserved_kwlist.h +0 -111
  734. data/ext/pg_query/include/pl_unreserved_kwlist_d.h +0 -244
  735. data/ext/pg_query/include/plerrcodes.h +0 -998
  736. data/ext/pg_query/include/plpgsql.h +0 -1345
  737. data/ext/pg_query/include/port/atomics/arch-arm.h +0 -32
  738. data/ext/pg_query/include/port/atomics/arch-ppc.h +0 -254
  739. data/ext/pg_query/include/port/atomics/arch-x86.h +0 -252
  740. data/ext/pg_query/include/port/atomics/fallback.h +0 -170
  741. data/ext/pg_query/include/port/atomics/generic-gcc.h +0 -286
  742. data/ext/pg_query/include/port/atomics/generic.h +0 -401
  743. data/ext/pg_query/include/port/atomics.h +0 -524
  744. data/ext/pg_query/include/port/pg_bitutils.h +0 -302
  745. data/ext/pg_query/include/port/pg_bswap.h +0 -161
  746. data/ext/pg_query/include/port/pg_crc32c.h +0 -101
  747. data/ext/pg_query/include/port.h +0 -553
  748. data/ext/pg_query/include/portability/instr_time.h +0 -256
  749. data/ext/pg_query/include/postgres.h +0 -808
  750. data/ext/pg_query/include/postgres_ext.h +0 -74
  751. data/ext/pg_query/include/postmaster/autovacuum.h +0 -83
  752. data/ext/pg_query/include/postmaster/auxprocess.h +0 -20
  753. data/ext/pg_query/include/postmaster/bgworker.h +0 -162
  754. data/ext/pg_query/include/postmaster/bgworker_internals.h +0 -64
  755. data/ext/pg_query/include/postmaster/bgwriter.h +0 -45
  756. data/ext/pg_query/include/postmaster/fork_process.h +0 -17
  757. data/ext/pg_query/include/postmaster/interrupt.h +0 -32
  758. data/ext/pg_query/include/postmaster/pgarch.h +0 -73
  759. data/ext/pg_query/include/postmaster/postmaster.h +0 -78
  760. data/ext/pg_query/include/postmaster/startup.h +0 -39
  761. data/ext/pg_query/include/postmaster/syslogger.h +0 -103
  762. data/ext/pg_query/include/postmaster/walwriter.h +0 -21
  763. data/ext/pg_query/include/regex/regex.h +0 -186
  764. data/ext/pg_query/include/replication/logicallauncher.h +0 -29
  765. data/ext/pg_query/include/replication/logicalproto.h +0 -254
  766. data/ext/pg_query/include/replication/logicalworker.h +0 -19
  767. data/ext/pg_query/include/replication/origin.h +0 -73
  768. data/ext/pg_query/include/replication/reorderbuffer.h +0 -685
  769. data/ext/pg_query/include/replication/slot.h +0 -230
  770. data/ext/pg_query/include/replication/syncrep.h +0 -115
  771. data/ext/pg_query/include/replication/walreceiver.h +0 -472
  772. data/ext/pg_query/include/replication/walsender.h +0 -74
  773. data/ext/pg_query/include/rewrite/prs2lock.h +0 -46
  774. data/ext/pg_query/include/rewrite/rewriteHandler.h +0 -38
  775. data/ext/pg_query/include/rewrite/rewriteManip.h +0 -87
  776. data/ext/pg_query/include/rewrite/rewriteSupport.h +0 -26
  777. data/ext/pg_query/include/storage/backendid.h +0 -37
  778. data/ext/pg_query/include/storage/block.h +0 -115
  779. data/ext/pg_query/include/storage/buf.h +0 -46
  780. data/ext/pg_query/include/storage/bufmgr.h +0 -297
  781. data/ext/pg_query/include/storage/bufpage.h +0 -457
  782. data/ext/pg_query/include/storage/condition_variable.h +0 -73
  783. data/ext/pg_query/include/storage/dsm.h +0 -64
  784. data/ext/pg_query/include/storage/dsm_impl.h +0 -76
  785. data/ext/pg_query/include/storage/fd.h +0 -198
  786. data/ext/pg_query/include/storage/fileset.h +0 -40
  787. data/ext/pg_query/include/storage/ipc.h +0 -84
  788. data/ext/pg_query/include/storage/item.h +0 -19
  789. data/ext/pg_query/include/storage/itemid.h +0 -184
  790. data/ext/pg_query/include/storage/itemptr.h +0 -208
  791. data/ext/pg_query/include/storage/large_object.h +0 -100
  792. data/ext/pg_query/include/storage/latch.h +0 -186
  793. data/ext/pg_query/include/storage/lmgr.h +0 -115
  794. data/ext/pg_query/include/storage/lock.h +0 -616
  795. data/ext/pg_query/include/storage/lockdefs.h +0 -59
  796. data/ext/pg_query/include/storage/lwlock.h +0 -206
  797. data/ext/pg_query/include/storage/lwlocknames.h +0 -50
  798. data/ext/pg_query/include/storage/off.h +0 -57
  799. data/ext/pg_query/include/storage/pg_sema.h +0 -61
  800. data/ext/pg_query/include/storage/pg_shmem.h +0 -92
  801. data/ext/pg_query/include/storage/pmsignal.h +0 -105
  802. data/ext/pg_query/include/storage/predicate.h +0 -87
  803. data/ext/pg_query/include/storage/proc.h +0 -461
  804. data/ext/pg_query/include/storage/procarray.h +0 -98
  805. data/ext/pg_query/include/storage/proclist_types.h +0 -51
  806. data/ext/pg_query/include/storage/procsignal.h +0 -71
  807. data/ext/pg_query/include/storage/relfilenode.h +0 -99
  808. data/ext/pg_query/include/storage/s_lock.h +0 -1110
  809. data/ext/pg_query/include/storage/sharedfileset.h +0 -37
  810. data/ext/pg_query/include/storage/shm_mq.h +0 -86
  811. data/ext/pg_query/include/storage/shm_toc.h +0 -58
  812. data/ext/pg_query/include/storage/shmem.h +0 -81
  813. data/ext/pg_query/include/storage/sinval.h +0 -153
  814. data/ext/pg_query/include/storage/sinvaladt.h +0 -43
  815. data/ext/pg_query/include/storage/smgr.h +0 -111
  816. data/ext/pg_query/include/storage/spin.h +0 -77
  817. data/ext/pg_query/include/storage/standby.h +0 -98
  818. data/ext/pg_query/include/storage/standbydefs.h +0 -74
  819. data/ext/pg_query/include/storage/sync.h +0 -66
  820. data/ext/pg_query/include/tcop/cmdtag.h +0 -58
  821. data/ext/pg_query/include/tcop/cmdtaglist.h +0 -218
  822. data/ext/pg_query/include/tcop/deparse_utility.h +0 -108
  823. data/ext/pg_query/include/tcop/dest.h +0 -149
  824. data/ext/pg_query/include/tcop/fastpath.h +0 -20
  825. data/ext/pg_query/include/tcop/pquery.h +0 -51
  826. data/ext/pg_query/include/tcop/tcopprot.h +0 -97
  827. data/ext/pg_query/include/tcop/utility.h +0 -112
  828. data/ext/pg_query/include/tsearch/ts_cache.h +0 -98
  829. data/ext/pg_query/include/utils/acl.h +0 -333
  830. data/ext/pg_query/include/utils/aclchk_internal.h +0 -45
  831. data/ext/pg_query/include/utils/array.h +0 -464
  832. data/ext/pg_query/include/utils/backend_progress.h +0 -44
  833. data/ext/pg_query/include/utils/backend_status.h +0 -321
  834. data/ext/pg_query/include/utils/builtins.h +0 -127
  835. data/ext/pg_query/include/utils/bytea.h +0 -28
  836. data/ext/pg_query/include/utils/catcache.h +0 -231
  837. data/ext/pg_query/include/utils/date.h +0 -90
  838. data/ext/pg_query/include/utils/datetime.h +0 -344
  839. data/ext/pg_query/include/utils/datum.h +0 -76
  840. data/ext/pg_query/include/utils/dsa.h +0 -123
  841. data/ext/pg_query/include/utils/dynahash.h +0 -20
  842. data/ext/pg_query/include/utils/elog.h +0 -470
  843. data/ext/pg_query/include/utils/errcodes.h +0 -354
  844. data/ext/pg_query/include/utils/expandeddatum.h +0 -159
  845. data/ext/pg_query/include/utils/expandedrecord.h +0 -231
  846. data/ext/pg_query/include/utils/float.h +0 -356
  847. data/ext/pg_query/include/utils/fmgroids.h +0 -3261
  848. data/ext/pg_query/include/utils/fmgrprotos.h +0 -2829
  849. data/ext/pg_query/include/utils/fmgrtab.h +0 -49
  850. data/ext/pg_query/include/utils/guc.h +0 -469
  851. data/ext/pg_query/include/utils/guc_tables.h +0 -276
  852. data/ext/pg_query/include/utils/hsearch.h +0 -153
  853. data/ext/pg_query/include/utils/inval.h +0 -68
  854. data/ext/pg_query/include/utils/lsyscache.h +0 -208
  855. data/ext/pg_query/include/utils/memdebug.h +0 -82
  856. data/ext/pg_query/include/utils/memutils.h +0 -230
  857. data/ext/pg_query/include/utils/numeric.h +0 -90
  858. data/ext/pg_query/include/utils/palloc.h +0 -158
  859. data/ext/pg_query/include/utils/partcache.h +0 -102
  860. data/ext/pg_query/include/utils/pg_locale.h +0 -127
  861. data/ext/pg_query/include/utils/pg_lsn.h +0 -29
  862. data/ext/pg_query/include/utils/pgstat_internal.h +0 -784
  863. data/ext/pg_query/include/utils/pidfile.h +0 -56
  864. data/ext/pg_query/include/utils/plancache.h +0 -236
  865. data/ext/pg_query/include/utils/portal.h +0 -252
  866. data/ext/pg_query/include/utils/probes.h +0 -114
  867. data/ext/pg_query/include/utils/ps_status.h +0 -25
  868. data/ext/pg_query/include/utils/queryenvironment.h +0 -74
  869. data/ext/pg_query/include/utils/queryjumble.h +0 -88
  870. data/ext/pg_query/include/utils/regproc.h +0 -39
  871. data/ext/pg_query/include/utils/rel.h +0 -695
  872. data/ext/pg_query/include/utils/relcache.h +0 -153
  873. data/ext/pg_query/include/utils/reltrigger.h +0 -81
  874. data/ext/pg_query/include/utils/resowner.h +0 -86
  875. data/ext/pg_query/include/utils/rls.h +0 -50
  876. data/ext/pg_query/include/utils/ruleutils.h +0 -47
  877. data/ext/pg_query/include/utils/sharedtuplestore.h +0 -61
  878. data/ext/pg_query/include/utils/snapmgr.h +0 -179
  879. data/ext/pg_query/include/utils/snapshot.h +0 -219
  880. data/ext/pg_query/include/utils/sortsupport.h +0 -391
  881. data/ext/pg_query/include/utils/syscache.h +0 -224
  882. data/ext/pg_query/include/utils/timeout.h +0 -95
  883. data/ext/pg_query/include/utils/timestamp.h +0 -117
  884. data/ext/pg_query/include/utils/tuplesort.h +0 -291
  885. data/ext/pg_query/include/utils/tuplestore.h +0 -91
  886. data/ext/pg_query/include/utils/typcache.h +0 -209
  887. data/ext/pg_query/include/utils/tzparser.h +0 -39
  888. data/ext/pg_query/include/utils/varlena.h +0 -41
  889. data/ext/pg_query/include/utils/wait_event.h +0 -289
  890. data/ext/pg_query/include/utils/xml.h +0 -84
  891. data/ext/pg_query/src_backend_postmaster_postmaster.c +0 -2201
  892. data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -371
  893. data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1116
  894. data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1993
  895. data/ext/pg_query/src_common_pg_prng.c +0 -152
  896. data/ext/pg_query/src_common_string.c +0 -92
  897. data/ext/pg_query/src_port_pgsleep.c +0 -69
  898. data/ext/pg_query/src_port_strnlen.c +0 -39
  899. /data/ext/pg_query/{pg_query_ruby.sym → ext_symbols.sym} +0 -0
  900. /data/ext/pg_query/include/{access → postgres/access}/rmgr.h +0 -0
  901. /data/ext/pg_query/include/{pg_config_ext.h → postgres/pg_config_ext.h} +0 -0
@@ -1,2715 +0,0 @@
1
- /*-------------------------------------------------------------------------
2
- *
3
- * execnodes.h
4
- * definitions for executor state nodes
5
- *
6
- *
7
- * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
8
- * Portions Copyright (c) 1994, Regents of the University of California
9
- *
10
- * src/include/nodes/execnodes.h
11
- *
12
- *-------------------------------------------------------------------------
13
- */
14
- #ifndef EXECNODES_H
15
- #define EXECNODES_H
16
-
17
- #include "access/tupconvert.h"
18
- #include "executor/instrument.h"
19
- #include "fmgr.h"
20
- #include "lib/ilist.h"
21
- #include "lib/pairingheap.h"
22
- #include "nodes/params.h"
23
- #include "nodes/plannodes.h"
24
- #include "nodes/tidbitmap.h"
25
- #include "partitioning/partdefs.h"
26
- #include "storage/condition_variable.h"
27
- #include "utils/hsearch.h"
28
- #include "utils/queryenvironment.h"
29
- #include "utils/reltrigger.h"
30
- #include "utils/sharedtuplestore.h"
31
- #include "utils/snapshot.h"
32
- #include "utils/sortsupport.h"
33
- #include "utils/tuplesort.h"
34
- #include "utils/tuplestore.h"
35
-
36
- struct PlanState; /* forward references in this file */
37
- struct ParallelHashJoinState;
38
- struct ExecRowMark;
39
- struct ExprState;
40
- struct ExprContext;
41
- struct RangeTblEntry; /* avoid including parsenodes.h here */
42
- struct ExprEvalStep; /* avoid including execExpr.h everywhere */
43
- struct CopyMultiInsertBuffer;
44
- struct LogicalTapeSet;
45
-
46
-
47
- /* ----------------
48
- * ExprState node
49
- *
50
- * ExprState is the top-level node for expression evaluation.
51
- * It contains instructions (in ->steps) to evaluate the expression.
52
- * ----------------
53
- */
54
- typedef Datum (*ExprStateEvalFunc) (struct ExprState *expression,
55
- struct ExprContext *econtext,
56
- bool *isNull);
57
-
58
- /* Bits in ExprState->flags (see also execExpr.h for private flag bits): */
59
- /* expression is for use with ExecQual() */
60
- #define EEO_FLAG_IS_QUAL (1 << 0)
61
-
62
- typedef struct ExprState
63
- {
64
- NodeTag type;
65
-
66
- uint8 flags; /* bitmask of EEO_FLAG_* bits, see above */
67
-
68
- /*
69
- * Storage for result value of a scalar expression, or for individual
70
- * column results within expressions built by ExecBuildProjectionInfo().
71
- */
72
- #define FIELDNO_EXPRSTATE_RESNULL 2
73
- bool resnull;
74
- #define FIELDNO_EXPRSTATE_RESVALUE 3
75
- Datum resvalue;
76
-
77
- /*
78
- * If projecting a tuple result, this slot holds the result; else NULL.
79
- */
80
- #define FIELDNO_EXPRSTATE_RESULTSLOT 4
81
- TupleTableSlot *resultslot;
82
-
83
- /*
84
- * Instructions to compute expression's return value.
85
- */
86
- struct ExprEvalStep *steps;
87
-
88
- /*
89
- * Function that actually evaluates the expression. This can be set to
90
- * different values depending on the complexity of the expression.
91
- */
92
- ExprStateEvalFunc evalfunc;
93
-
94
- /* original expression tree, for debugging only */
95
- Expr *expr;
96
-
97
- /* private state for an evalfunc */
98
- void *evalfunc_private;
99
-
100
- /*
101
- * XXX: following fields only needed during "compilation" (ExecInitExpr);
102
- * could be thrown away afterwards.
103
- */
104
-
105
- int steps_len; /* number of steps currently */
106
- int steps_alloc; /* allocated length of steps array */
107
-
108
- #define FIELDNO_EXPRSTATE_PARENT 11
109
- struct PlanState *parent; /* parent PlanState node, if any */
110
- ParamListInfo ext_params; /* for compiling PARAM_EXTERN nodes */
111
-
112
- Datum *innermost_caseval;
113
- bool *innermost_casenull;
114
-
115
- Datum *innermost_domainval;
116
- bool *innermost_domainnull;
117
- } ExprState;
118
-
119
-
120
- /* ----------------
121
- * IndexInfo information
122
- *
123
- * this struct holds the information needed to construct new index
124
- * entries for a particular index. Used for both index_build and
125
- * retail creation of index entries.
126
- *
127
- * NumIndexAttrs total number of columns in this index
128
- * NumIndexKeyAttrs number of key columns in index
129
- * IndexAttrNumbers underlying-rel attribute numbers used as keys
130
- * (zeroes indicate expressions). It also contains
131
- * info about included columns.
132
- * Expressions expr trees for expression entries, or NIL if none
133
- * ExpressionsState exec state for expressions, or NIL if none
134
- * Predicate partial-index predicate, or NIL if none
135
- * PredicateState exec state for predicate, or NIL if none
136
- * ExclusionOps Per-column exclusion operators, or NULL if none
137
- * ExclusionProcs Underlying function OIDs for ExclusionOps
138
- * ExclusionStrats Opclass strategy numbers for ExclusionOps
139
- * UniqueOps These are like Exclusion*, but for unique indexes
140
- * UniqueProcs
141
- * UniqueStrats
142
- * Unique is it a unique index?
143
- * OpclassOptions opclass-specific options, or NULL if none
144
- * ReadyForInserts is it valid for inserts?
145
- * CheckedUnchanged IndexUnchanged status determined yet?
146
- * IndexUnchanged aminsert hint, cached for retail inserts
147
- * Concurrent are we doing a concurrent index build?
148
- * BrokenHotChain did we detect any broken HOT chains?
149
- * ParallelWorkers # of workers requested (excludes leader)
150
- * Am Oid of index AM
151
- * AmCache private cache area for index AM
152
- * Context memory context holding this IndexInfo
153
- *
154
- * ii_Concurrent, ii_BrokenHotChain, and ii_ParallelWorkers are used only
155
- * during index build; they're conventionally zeroed otherwise.
156
- * ----------------
157
- */
158
- typedef struct IndexInfo
159
- {
160
- NodeTag type;
161
- int ii_NumIndexAttrs; /* total number of columns in index */
162
- int ii_NumIndexKeyAttrs; /* number of key columns in index */
163
- AttrNumber ii_IndexAttrNumbers[INDEX_MAX_KEYS];
164
- List *ii_Expressions; /* list of Expr */
165
- List *ii_ExpressionsState; /* list of ExprState */
166
- List *ii_Predicate; /* list of Expr */
167
- ExprState *ii_PredicateState;
168
- Oid *ii_ExclusionOps; /* array with one entry per column */
169
- Oid *ii_ExclusionProcs; /* array with one entry per column */
170
- uint16 *ii_ExclusionStrats; /* array with one entry per column */
171
- Oid *ii_UniqueOps; /* array with one entry per column */
172
- Oid *ii_UniqueProcs; /* array with one entry per column */
173
- uint16 *ii_UniqueStrats; /* array with one entry per column */
174
- Datum *ii_OpclassOptions; /* array with one entry per column */
175
- bool ii_Unique;
176
- bool ii_NullsNotDistinct;
177
- bool ii_ReadyForInserts;
178
- bool ii_CheckedUnchanged;
179
- bool ii_IndexUnchanged;
180
- bool ii_Concurrent;
181
- bool ii_BrokenHotChain;
182
- int ii_ParallelWorkers;
183
- Oid ii_Am;
184
- void *ii_AmCache;
185
- MemoryContext ii_Context;
186
- } IndexInfo;
187
-
188
- /* ----------------
189
- * ExprContext_CB
190
- *
191
- * List of callbacks to be called at ExprContext shutdown.
192
- * ----------------
193
- */
194
- typedef void (*ExprContextCallbackFunction) (Datum arg);
195
-
196
- typedef struct ExprContext_CB
197
- {
198
- struct ExprContext_CB *next;
199
- ExprContextCallbackFunction function;
200
- Datum arg;
201
- } ExprContext_CB;
202
-
203
- /* ----------------
204
- * ExprContext
205
- *
206
- * This class holds the "current context" information
207
- * needed to evaluate expressions for doing tuple qualifications
208
- * and tuple projections. For example, if an expression refers
209
- * to an attribute in the current inner tuple then we need to know
210
- * what the current inner tuple is and so we look at the expression
211
- * context.
212
- *
213
- * There are two memory contexts associated with an ExprContext:
214
- * * ecxt_per_query_memory is a query-lifespan context, typically the same
215
- * context the ExprContext node itself is allocated in. This context
216
- * can be used for purposes such as storing function call cache info.
217
- * * ecxt_per_tuple_memory is a short-term context for expression results.
218
- * As the name suggests, it will typically be reset once per tuple,
219
- * before we begin to evaluate expressions for that tuple. Each
220
- * ExprContext normally has its very own per-tuple memory context.
221
- *
222
- * CurrentMemoryContext should be set to ecxt_per_tuple_memory before
223
- * calling ExecEvalExpr() --- see ExecEvalExprSwitchContext().
224
- * ----------------
225
- */
226
- typedef struct ExprContext
227
- {
228
- NodeTag type;
229
-
230
- /* Tuples that Var nodes in expression may refer to */
231
- #define FIELDNO_EXPRCONTEXT_SCANTUPLE 1
232
- TupleTableSlot *ecxt_scantuple;
233
- #define FIELDNO_EXPRCONTEXT_INNERTUPLE 2
234
- TupleTableSlot *ecxt_innertuple;
235
- #define FIELDNO_EXPRCONTEXT_OUTERTUPLE 3
236
- TupleTableSlot *ecxt_outertuple;
237
-
238
- /* Memory contexts for expression evaluation --- see notes above */
239
- MemoryContext ecxt_per_query_memory;
240
- MemoryContext ecxt_per_tuple_memory;
241
-
242
- /* Values to substitute for Param nodes in expression */
243
- ParamExecData *ecxt_param_exec_vals; /* for PARAM_EXEC params */
244
- ParamListInfo ecxt_param_list_info; /* for other param types */
245
-
246
- /*
247
- * Values to substitute for Aggref nodes in the expressions of an Agg
248
- * node, or for WindowFunc nodes within a WindowAgg node.
249
- */
250
- #define FIELDNO_EXPRCONTEXT_AGGVALUES 8
251
- Datum *ecxt_aggvalues; /* precomputed values for aggs/windowfuncs */
252
- #define FIELDNO_EXPRCONTEXT_AGGNULLS 9
253
- bool *ecxt_aggnulls; /* null flags for aggs/windowfuncs */
254
-
255
- /* Value to substitute for CaseTestExpr nodes in expression */
256
- #define FIELDNO_EXPRCONTEXT_CASEDATUM 10
257
- Datum caseValue_datum;
258
- #define FIELDNO_EXPRCONTEXT_CASENULL 11
259
- bool caseValue_isNull;
260
-
261
- /* Value to substitute for CoerceToDomainValue nodes in expression */
262
- #define FIELDNO_EXPRCONTEXT_DOMAINDATUM 12
263
- Datum domainValue_datum;
264
- #define FIELDNO_EXPRCONTEXT_DOMAINNULL 13
265
- bool domainValue_isNull;
266
-
267
- /* Link to containing EState (NULL if a standalone ExprContext) */
268
- struct EState *ecxt_estate;
269
-
270
- /* Functions to call back when ExprContext is shut down or rescanned */
271
- ExprContext_CB *ecxt_callbacks;
272
- } ExprContext;
273
-
274
- /*
275
- * Set-result status used when evaluating functions potentially returning a
276
- * set.
277
- */
278
- typedef enum
279
- {
280
- ExprSingleResult, /* expression does not return a set */
281
- ExprMultipleResult, /* this result is an element of a set */
282
- ExprEndResult /* there are no more elements in the set */
283
- } ExprDoneCond;
284
-
285
- /*
286
- * Return modes for functions returning sets. Note values must be chosen
287
- * as separate bits so that a bitmask can be formed to indicate supported
288
- * modes. SFRM_Materialize_Random and SFRM_Materialize_Preferred are
289
- * auxiliary flags about SFRM_Materialize mode, rather than separate modes.
290
- */
291
- typedef enum
292
- {
293
- SFRM_ValuePerCall = 0x01, /* one value returned per call */
294
- SFRM_Materialize = 0x02, /* result set instantiated in Tuplestore */
295
- SFRM_Materialize_Random = 0x04, /* Tuplestore needs randomAccess */
296
- SFRM_Materialize_Preferred = 0x08 /* caller prefers Tuplestore */
297
- } SetFunctionReturnMode;
298
-
299
- /*
300
- * When calling a function that might return a set (multiple rows),
301
- * a node of this type is passed as fcinfo->resultinfo to allow
302
- * return status to be passed back. A function returning set should
303
- * raise an error if no such resultinfo is provided.
304
- */
305
- typedef struct ReturnSetInfo
306
- {
307
- NodeTag type;
308
- /* values set by caller: */
309
- ExprContext *econtext; /* context function is being called in */
310
- TupleDesc expectedDesc; /* tuple descriptor expected by caller */
311
- int allowedModes; /* bitmask: return modes caller can handle */
312
- /* result status from function (but pre-initialized by caller): */
313
- SetFunctionReturnMode returnMode; /* actual return mode */
314
- ExprDoneCond isDone; /* status for ValuePerCall mode */
315
- /* fields filled by function in Materialize return mode: */
316
- Tuplestorestate *setResult; /* holds the complete returned tuple set */
317
- TupleDesc setDesc; /* actual descriptor for returned tuples */
318
- } ReturnSetInfo;
319
-
320
- /* ----------------
321
- * ProjectionInfo node information
322
- *
323
- * This is all the information needed to perform projections ---
324
- * that is, form new tuples by evaluation of targetlist expressions.
325
- * Nodes which need to do projections create one of these.
326
- *
327
- * The target tuple slot is kept in ProjectionInfo->pi_state.resultslot.
328
- * ExecProject() evaluates the tlist, forms a tuple, and stores it
329
- * in the given slot. Note that the result will be a "virtual" tuple
330
- * unless ExecMaterializeSlot() is then called to force it to be
331
- * converted to a physical tuple. The slot must have a tupledesc
332
- * that matches the output of the tlist!
333
- * ----------------
334
- */
335
- typedef struct ProjectionInfo
336
- {
337
- NodeTag type;
338
- /* instructions to evaluate projection */
339
- ExprState pi_state;
340
- /* expression context in which to evaluate expression */
341
- ExprContext *pi_exprContext;
342
- } ProjectionInfo;
343
-
344
- /* ----------------
345
- * JunkFilter
346
- *
347
- * This class is used to store information regarding junk attributes.
348
- * A junk attribute is an attribute in a tuple that is needed only for
349
- * storing intermediate information in the executor, and does not belong
350
- * in emitted tuples. For example, when we do an UPDATE query,
351
- * the planner adds a "junk" entry to the targetlist so that the tuples
352
- * returned to ExecutePlan() contain an extra attribute: the ctid of
353
- * the tuple to be updated. This is needed to do the update, but we
354
- * don't want the ctid to be part of the stored new tuple! So, we
355
- * apply a "junk filter" to remove the junk attributes and form the
356
- * real output tuple. The junkfilter code also provides routines to
357
- * extract the values of the junk attribute(s) from the input tuple.
358
- *
359
- * targetList: the original target list (including junk attributes).
360
- * cleanTupType: the tuple descriptor for the "clean" tuple (with
361
- * junk attributes removed).
362
- * cleanMap: A map with the correspondence between the non-junk
363
- * attribute numbers of the "original" tuple and the
364
- * attribute numbers of the "clean" tuple.
365
- * resultSlot: tuple slot used to hold cleaned tuple.
366
- * ----------------
367
- */
368
- typedef struct JunkFilter
369
- {
370
- NodeTag type;
371
- List *jf_targetList;
372
- TupleDesc jf_cleanTupType;
373
- AttrNumber *jf_cleanMap;
374
- TupleTableSlot *jf_resultSlot;
375
- } JunkFilter;
376
-
377
- /*
378
- * OnConflictSetState
379
- *
380
- * Executor state of an ON CONFLICT DO UPDATE operation.
381
- */
382
- typedef struct OnConflictSetState
383
- {
384
- NodeTag type;
385
-
386
- TupleTableSlot *oc_Existing; /* slot to store existing target tuple in */
387
- TupleTableSlot *oc_ProjSlot; /* CONFLICT ... SET ... projection target */
388
- ProjectionInfo *oc_ProjInfo; /* for ON CONFLICT DO UPDATE SET */
389
- ExprState *oc_WhereClause; /* state for the WHERE clause */
390
- } OnConflictSetState;
391
-
392
- /* ----------------
393
- * MergeActionState information
394
- *
395
- * Executor state for a MERGE action.
396
- * ----------------
397
- */
398
- typedef struct MergeActionState
399
- {
400
- NodeTag type;
401
-
402
- MergeAction *mas_action; /* associated MergeAction node */
403
- ProjectionInfo *mas_proj; /* projection of the action's targetlist for
404
- * this rel */
405
- ExprState *mas_whenqual; /* WHEN [NOT] MATCHED AND conditions */
406
- } MergeActionState;
407
-
408
- /*
409
- * ResultRelInfo
410
- *
411
- * Whenever we update an existing relation, we have to update indexes on the
412
- * relation, and perhaps also fire triggers. ResultRelInfo holds all the
413
- * information needed about a result relation, including indexes.
414
- *
415
- * Normally, a ResultRelInfo refers to a table that is in the query's range
416
- * table; then ri_RangeTableIndex is the RT index and ri_RelationDesc is
417
- * just a copy of the relevant es_relations[] entry. However, in some
418
- * situations we create ResultRelInfos for relations that are not in the
419
- * range table, namely for targets of tuple routing in a partitioned table,
420
- * and when firing triggers in tables other than the target tables (See
421
- * ExecGetTriggerResultRel). In these situations, ri_RangeTableIndex is 0
422
- * and ri_RelationDesc is a separately-opened relcache pointer that needs to
423
- * be separately closed.
424
- */
425
- typedef struct ResultRelInfo
426
- {
427
- NodeTag type;
428
-
429
- /* result relation's range table index, or 0 if not in range table */
430
- Index ri_RangeTableIndex;
431
-
432
- /* relation descriptor for result relation */
433
- Relation ri_RelationDesc;
434
-
435
- /* # of indices existing on result relation */
436
- int ri_NumIndices;
437
-
438
- /* array of relation descriptors for indices */
439
- RelationPtr ri_IndexRelationDescs;
440
-
441
- /* array of key/attr info for indices */
442
- IndexInfo **ri_IndexRelationInfo;
443
-
444
- /*
445
- * For UPDATE/DELETE result relations, the attribute number of the row
446
- * identity junk attribute in the source plan's output tuples
447
- */
448
- AttrNumber ri_RowIdAttNo;
449
-
450
- /* Projection to generate new tuple in an INSERT/UPDATE */
451
- ProjectionInfo *ri_projectNew;
452
- /* Slot to hold that tuple */
453
- TupleTableSlot *ri_newTupleSlot;
454
- /* Slot to hold the old tuple being updated */
455
- TupleTableSlot *ri_oldTupleSlot;
456
- /* Have the projection and the slots above been initialized? */
457
- bool ri_projectNewInfoValid;
458
-
459
- /* triggers to be fired, if any */
460
- TriggerDesc *ri_TrigDesc;
461
-
462
- /* cached lookup info for trigger functions */
463
- FmgrInfo *ri_TrigFunctions;
464
-
465
- /* array of trigger WHEN expr states */
466
- ExprState **ri_TrigWhenExprs;
467
-
468
- /* optional runtime measurements for triggers */
469
- Instrumentation *ri_TrigInstrument;
470
-
471
- /* On-demand created slots for triggers / returning processing */
472
- TupleTableSlot *ri_ReturningSlot; /* for trigger output tuples */
473
- TupleTableSlot *ri_TrigOldSlot; /* for a trigger's old tuple */
474
- TupleTableSlot *ri_TrigNewSlot; /* for a trigger's new tuple */
475
-
476
- /* FDW callback functions, if foreign table */
477
- struct FdwRoutine *ri_FdwRoutine;
478
-
479
- /* available to save private state of FDW */
480
- void *ri_FdwState;
481
-
482
- /* true when modifying foreign table directly */
483
- bool ri_usesFdwDirectModify;
484
-
485
- /* batch insert stuff */
486
- int ri_NumSlots; /* number of slots in the array */
487
- int ri_NumSlotsInitialized; /* number of initialized slots */
488
- int ri_BatchSize; /* max slots inserted in a single batch */
489
- TupleTableSlot **ri_Slots; /* input tuples for batch insert */
490
- TupleTableSlot **ri_PlanSlots;
491
-
492
- /* list of WithCheckOption's to be checked */
493
- List *ri_WithCheckOptions;
494
-
495
- /* list of WithCheckOption expr states */
496
- List *ri_WithCheckOptionExprs;
497
-
498
- /* array of constraint-checking expr states */
499
- ExprState **ri_ConstraintExprs;
500
-
501
- /* array of stored generated columns expr states */
502
- ExprState **ri_GeneratedExprs;
503
-
504
- /* number of stored generated columns we need to compute */
505
- int ri_NumGeneratedNeeded;
506
-
507
- /* list of RETURNING expressions */
508
- List *ri_returningList;
509
-
510
- /* for computing a RETURNING list */
511
- ProjectionInfo *ri_projectReturning;
512
-
513
- /* list of arbiter indexes to use to check conflicts */
514
- List *ri_onConflictArbiterIndexes;
515
-
516
- /* ON CONFLICT evaluation state */
517
- OnConflictSetState *ri_onConflict;
518
-
519
- /* for MERGE, lists of MergeActionState */
520
- List *ri_matchedMergeAction;
521
- List *ri_notMatchedMergeAction;
522
-
523
- /* partition check expression state (NULL if not set up yet) */
524
- ExprState *ri_PartitionCheckExpr;
525
-
526
- /*
527
- * Information needed by tuple routing target relations
528
- *
529
- * RootResultRelInfo gives the target relation mentioned in the query, if
530
- * it's a partitioned table. It is not set if the target relation
531
- * mentioned in the query is an inherited table, nor when tuple routing is
532
- * not needed.
533
- *
534
- * RootToPartitionMap and PartitionTupleSlot, initialized by
535
- * ExecInitRoutingInfo, are non-NULL if partition has a different tuple
536
- * format than the root table.
537
- */
538
- struct ResultRelInfo *ri_RootResultRelInfo;
539
- TupleConversionMap *ri_RootToPartitionMap;
540
- TupleTableSlot *ri_PartitionTupleSlot;
541
-
542
- /*
543
- * Map to convert child result relation tuples to the format of the table
544
- * actually mentioned in the query (called "root"). Computed only if
545
- * needed. A NULL map value indicates that no conversion is needed, so we
546
- * must have a separate flag to show if the map has been computed.
547
- */
548
- TupleConversionMap *ri_ChildToRootMap;
549
- bool ri_ChildToRootMapValid;
550
-
551
- /* for use by copyfrom.c when performing multi-inserts */
552
- struct CopyMultiInsertBuffer *ri_CopyMultiInsertBuffer;
553
-
554
- /*
555
- * Used when a leaf partition is involved in a cross-partition update of
556
- * one of its ancestors; see ExecCrossPartitionUpdateForeignKey().
557
- */
558
- List *ri_ancestorResultRels;
559
- } ResultRelInfo;
560
-
561
- /* ----------------
562
- * AsyncRequest
563
- *
564
- * State for an asynchronous tuple request.
565
- * ----------------
566
- */
567
- typedef struct AsyncRequest
568
- {
569
- struct PlanState *requestor; /* Node that wants a tuple */
570
- struct PlanState *requestee; /* Node from which a tuple is wanted */
571
- int request_index; /* Scratch space for requestor */
572
- bool callback_pending; /* Callback is needed */
573
- bool request_complete; /* Request complete, result valid */
574
- TupleTableSlot *result; /* Result (NULL or an empty slot if no more
575
- * tuples) */
576
- } AsyncRequest;
577
-
578
- /* ----------------
579
- * EState information
580
- *
581
- * Working state for an Executor invocation
582
- * ----------------
583
- */
584
- typedef struct EState
585
- {
586
- NodeTag type;
587
-
588
- /* Basic state for all query types: */
589
- ScanDirection es_direction; /* current scan direction */
590
- Snapshot es_snapshot; /* time qual to use */
591
- Snapshot es_crosscheck_snapshot; /* crosscheck time qual for RI */
592
- List *es_range_table; /* List of RangeTblEntry */
593
- Index es_range_table_size; /* size of the range table arrays */
594
- Relation *es_relations; /* Array of per-range-table-entry Relation
595
- * pointers, or NULL if not yet opened */
596
- struct ExecRowMark **es_rowmarks; /* Array of per-range-table-entry
597
- * ExecRowMarks, or NULL if none */
598
- PlannedStmt *es_plannedstmt; /* link to top of plan tree */
599
- const char *es_sourceText; /* Source text from QueryDesc */
600
-
601
- JunkFilter *es_junkFilter; /* top-level junk filter, if any */
602
-
603
- /* If query can insert/delete tuples, the command ID to mark them with */
604
- CommandId es_output_cid;
605
-
606
- /* Info about target table(s) for insert/update/delete queries: */
607
- ResultRelInfo **es_result_relations; /* Array of per-range-table-entry
608
- * ResultRelInfo pointers, or NULL
609
- * if not a target table */
610
- List *es_opened_result_relations; /* List of non-NULL entries in
611
- * es_result_relations in no
612
- * specific order */
613
-
614
- PartitionDirectory es_partition_directory; /* for PartitionDesc lookup */
615
-
616
- /*
617
- * The following list contains ResultRelInfos created by the tuple routing
618
- * code for partitions that aren't found in the es_result_relations array.
619
- */
620
- List *es_tuple_routing_result_relations;
621
-
622
- /* Stuff used for firing triggers: */
623
- List *es_trig_target_relations; /* trigger-only ResultRelInfos */
624
-
625
- /* Parameter info: */
626
- ParamListInfo es_param_list_info; /* values of external params */
627
- ParamExecData *es_param_exec_vals; /* values of internal params */
628
-
629
- QueryEnvironment *es_queryEnv; /* query environment */
630
-
631
- /* Other working state: */
632
- MemoryContext es_query_cxt; /* per-query context in which EState lives */
633
-
634
- List *es_tupleTable; /* List of TupleTableSlots */
635
-
636
- uint64 es_processed; /* # of tuples processed */
637
-
638
- int es_top_eflags; /* eflags passed to ExecutorStart */
639
- int es_instrument; /* OR of InstrumentOption flags */
640
- bool es_finished; /* true when ExecutorFinish is done */
641
-
642
- List *es_exprcontexts; /* List of ExprContexts within EState */
643
-
644
- List *es_subplanstates; /* List of PlanState for SubPlans */
645
-
646
- List *es_auxmodifytables; /* List of secondary ModifyTableStates */
647
-
648
- /*
649
- * this ExprContext is for per-output-tuple operations, such as constraint
650
- * checks and index-value computations. It will be reset for each output
651
- * tuple. Note that it will be created only if needed.
652
- */
653
- ExprContext *es_per_tuple_exprcontext;
654
-
655
- /*
656
- * If not NULL, this is an EPQState's EState. This is a field in EState
657
- * both to allow EvalPlanQual aware executor nodes to detect that they
658
- * need to perform EPQ related work, and to provide necessary information
659
- * to do so.
660
- */
661
- struct EPQState *es_epq_active;
662
-
663
- bool es_use_parallel_mode; /* can we use parallel workers? */
664
-
665
- /* The per-query shared memory area to use for parallel execution. */
666
- struct dsa_area *es_query_dsa;
667
-
668
- /*
669
- * JIT information. es_jit_flags indicates whether JIT should be performed
670
- * and with which options. es_jit is created on-demand when JITing is
671
- * performed.
672
- *
673
- * es_jit_worker_instr is the combined, on demand allocated,
674
- * instrumentation from all workers. The leader's instrumentation is kept
675
- * separate, and is combined on demand by ExplainPrintJITSummary().
676
- */
677
- int es_jit_flags;
678
- struct JitContext *es_jit;
679
- struct JitInstrumentation *es_jit_worker_instr;
680
- } EState;
681
-
682
-
683
- /*
684
- * ExecRowMark -
685
- * runtime representation of FOR [KEY] UPDATE/SHARE clauses
686
- *
687
- * When doing UPDATE, DELETE, or SELECT FOR [KEY] UPDATE/SHARE, we will have an
688
- * ExecRowMark for each non-target relation in the query (except inheritance
689
- * parent RTEs, which can be ignored at runtime). Virtual relations such as
690
- * subqueries-in-FROM will have an ExecRowMark with relation == NULL. See
691
- * PlanRowMark for details about most of the fields. In addition to fields
692
- * directly derived from PlanRowMark, we store an activity flag (to denote
693
- * inactive children of inheritance trees), curCtid, which is used by the
694
- * WHERE CURRENT OF code, and ermExtra, which is available for use by the plan
695
- * node that sources the relation (e.g., for a foreign table the FDW can use
696
- * ermExtra to hold information).
697
- *
698
- * EState->es_rowmarks is an array of these structs, indexed by RT index,
699
- * with NULLs for irrelevant RT indexes. es_rowmarks itself is NULL if
700
- * there are no rowmarks.
701
- */
702
- typedef struct ExecRowMark
703
- {
704
- Relation relation; /* opened and suitably locked relation */
705
- Oid relid; /* its OID (or InvalidOid, if subquery) */
706
- Index rti; /* its range table index */
707
- Index prti; /* parent range table index, if child */
708
- Index rowmarkId; /* unique identifier for resjunk columns */
709
- RowMarkType markType; /* see enum in nodes/plannodes.h */
710
- LockClauseStrength strength; /* LockingClause's strength, or LCS_NONE */
711
- LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
712
- bool ermActive; /* is this mark relevant for current tuple? */
713
- ItemPointerData curCtid; /* ctid of currently locked tuple, if any */
714
- void *ermExtra; /* available for use by relation source node */
715
- } ExecRowMark;
716
-
717
- /*
718
- * ExecAuxRowMark -
719
- * additional runtime representation of FOR [KEY] UPDATE/SHARE clauses
720
- *
721
- * Each LockRows and ModifyTable node keeps a list of the rowmarks it needs to
722
- * deal with. In addition to a pointer to the related entry in es_rowmarks,
723
- * this struct carries the column number(s) of the resjunk columns associated
724
- * with the rowmark (see comments for PlanRowMark for more detail).
725
- */
726
- typedef struct ExecAuxRowMark
727
- {
728
- ExecRowMark *rowmark; /* related entry in es_rowmarks */
729
- AttrNumber ctidAttNo; /* resno of ctid junk attribute, if any */
730
- AttrNumber toidAttNo; /* resno of tableoid junk attribute, if any */
731
- AttrNumber wholeAttNo; /* resno of whole-row junk attribute, if any */
732
- } ExecAuxRowMark;
733
-
734
-
735
- /* ----------------------------------------------------------------
736
- * Tuple Hash Tables
737
- *
738
- * All-in-memory tuple hash tables are used for a number of purposes.
739
- *
740
- * Note: tab_hash_funcs are for the key datatype(s) stored in the table,
741
- * and tab_eq_funcs are non-cross-type equality operators for those types.
742
- * Normally these are the only functions used, but FindTupleHashEntry()
743
- * supports searching a hashtable using cross-data-type hashing. For that,
744
- * the caller must supply hash functions for the LHS datatype as well as
745
- * the cross-type equality operators to use. in_hash_funcs and cur_eq_func
746
- * are set to point to the caller's function arrays while doing such a search.
747
- * During LookupTupleHashEntry(), they point to tab_hash_funcs and
748
- * tab_eq_func respectively.
749
- * ----------------------------------------------------------------
750
- */
751
- typedef struct TupleHashEntryData *TupleHashEntry;
752
- typedef struct TupleHashTableData *TupleHashTable;
753
-
754
- typedef struct TupleHashEntryData
755
- {
756
- MinimalTuple firstTuple; /* copy of first tuple in this group */
757
- void *additional; /* user data */
758
- uint32 status; /* hash status */
759
- uint32 hash; /* hash value (cached) */
760
- } TupleHashEntryData;
761
-
762
- /* define parameters necessary to generate the tuple hash table interface */
763
- #define SH_PREFIX tuplehash
764
- #define SH_ELEMENT_TYPE TupleHashEntryData
765
- #define SH_KEY_TYPE MinimalTuple
766
- #define SH_SCOPE extern
767
- #define SH_DECLARE
768
- #include "lib/simplehash.h"
769
-
770
- typedef struct TupleHashTableData
771
- {
772
- tuplehash_hash *hashtab; /* underlying hash table */
773
- int numCols; /* number of columns in lookup key */
774
- AttrNumber *keyColIdx; /* attr numbers of key columns */
775
- FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */
776
- ExprState *tab_eq_func; /* comparator for table datatype(s) */
777
- Oid *tab_collations; /* collations for hash and comparison */
778
- MemoryContext tablecxt; /* memory context containing table */
779
- MemoryContext tempcxt; /* context for function evaluations */
780
- Size entrysize; /* actual size to make each hash entry */
781
- TupleTableSlot *tableslot; /* slot for referencing table entries */
782
- /* The following fields are set transiently for each table search: */
783
- TupleTableSlot *inputslot; /* current input tuple's slot */
784
- FmgrInfo *in_hash_funcs; /* hash functions for input datatype(s) */
785
- ExprState *cur_eq_func; /* comparator for input vs. table */
786
- uint32 hash_iv; /* hash-function IV */
787
- ExprContext *exprcontext; /* expression context */
788
- } TupleHashTableData;
789
-
790
- typedef tuplehash_iterator TupleHashIterator;
791
-
792
- /*
793
- * Use InitTupleHashIterator/TermTupleHashIterator for a read/write scan.
794
- * Use ResetTupleHashIterator if the table can be frozen (in this case no
795
- * explicit scan termination is needed).
796
- */
797
- #define InitTupleHashIterator(htable, iter) \
798
- tuplehash_start_iterate(htable->hashtab, iter)
799
- #define TermTupleHashIterator(iter) \
800
- ((void) 0)
801
- #define ResetTupleHashIterator(htable, iter) \
802
- InitTupleHashIterator(htable, iter)
803
- #define ScanTupleHashTable(htable, iter) \
804
- tuplehash_iterate(htable->hashtab, iter)
805
-
806
-
807
- /* ----------------------------------------------------------------
808
- * Expression State Nodes
809
- *
810
- * Formerly, there was a separate executor expression state node corresponding
811
- * to each node in a planned expression tree. That's no longer the case; for
812
- * common expression node types, all the execution info is embedded into
813
- * step(s) in a single ExprState node. But we still have a few executor state
814
- * node types for selected expression node types, mostly those in which info
815
- * has to be shared with other parts of the execution state tree.
816
- * ----------------------------------------------------------------
817
- */
818
-
819
- /* ----------------
820
- * WindowFuncExprState node
821
- * ----------------
822
- */
823
- typedef struct WindowFuncExprState
824
- {
825
- NodeTag type;
826
- WindowFunc *wfunc; /* expression plan node */
827
- List *args; /* ExprStates for argument expressions */
828
- ExprState *aggfilter; /* FILTER expression */
829
- int wfuncno; /* ID number for wfunc within its plan node */
830
- } WindowFuncExprState;
831
-
832
-
833
- /* ----------------
834
- * SetExprState node
835
- *
836
- * State for evaluating a potentially set-returning expression (like FuncExpr
837
- * or OpExpr). In some cases, like some of the expressions in ROWS FROM(...)
838
- * the expression might not be a SRF, but nonetheless it uses the same
839
- * machinery as SRFs; it will be treated as a SRF returning a single row.
840
- * ----------------
841
- */
842
- typedef struct SetExprState
843
- {
844
- NodeTag type;
845
- Expr *expr; /* expression plan node */
846
- List *args; /* ExprStates for argument expressions */
847
-
848
- /*
849
- * In ROWS FROM, functions can be inlined, removing the FuncExpr normally
850
- * inside. In such a case this is the compiled expression (which cannot
851
- * return a set), which'll be evaluated using regular ExecEvalExpr().
852
- */
853
- ExprState *elidedFuncState;
854
-
855
- /*
856
- * Function manager's lookup info for the target function. If func.fn_oid
857
- * is InvalidOid, we haven't initialized it yet (nor any of the following
858
- * fields, except funcReturnsSet).
859
- */
860
- FmgrInfo func;
861
-
862
- /*
863
- * For a set-returning function (SRF) that returns a tuplestore, we keep
864
- * the tuplestore here and dole out the result rows one at a time. The
865
- * slot holds the row currently being returned.
866
- */
867
- Tuplestorestate *funcResultStore;
868
- TupleTableSlot *funcResultSlot;
869
-
870
- /*
871
- * In some cases we need to compute a tuple descriptor for the function's
872
- * output. If so, it's stored here.
873
- */
874
- TupleDesc funcResultDesc;
875
- bool funcReturnsTuple; /* valid when funcResultDesc isn't NULL */
876
-
877
- /*
878
- * Remember whether the function is declared to return a set. This is set
879
- * by ExecInitExpr, and is valid even before the FmgrInfo is set up.
880
- */
881
- bool funcReturnsSet;
882
-
883
- /*
884
- * setArgsValid is true when we are evaluating a set-returning function
885
- * that uses value-per-call mode and we are in the middle of a call
886
- * series; we want to pass the same argument values to the function again
887
- * (and again, until it returns ExprEndResult). This indicates that
888
- * fcinfo_data already contains valid argument data.
889
- */
890
- bool setArgsValid;
891
-
892
- /*
893
- * Flag to remember whether we have registered a shutdown callback for
894
- * this SetExprState. We do so only if funcResultStore or setArgsValid
895
- * has been set at least once (since all the callback is for is to release
896
- * the tuplestore or clear setArgsValid).
897
- */
898
- bool shutdown_reg; /* a shutdown callback is registered */
899
-
900
- /*
901
- * Call parameter structure for the function. This has been initialized
902
- * (by InitFunctionCallInfoData) if func.fn_oid is valid. It also saves
903
- * argument values between calls, when setArgsValid is true.
904
- */
905
- FunctionCallInfo fcinfo;
906
- } SetExprState;
907
-
908
- /* ----------------
909
- * SubPlanState node
910
- * ----------------
911
- */
912
- typedef struct SubPlanState
913
- {
914
- NodeTag type;
915
- SubPlan *subplan; /* expression plan node */
916
- struct PlanState *planstate; /* subselect plan's state tree */
917
- struct PlanState *parent; /* parent plan node's state tree */
918
- ExprState *testexpr; /* state of combining expression */
919
- List *args; /* states of argument expression(s) */
920
- HeapTuple curTuple; /* copy of most recent tuple from subplan */
921
- Datum curArray; /* most recent array from ARRAY() subplan */
922
- /* these are used when hashing the subselect's output: */
923
- TupleDesc descRight; /* subselect desc after projection */
924
- ProjectionInfo *projLeft; /* for projecting lefthand exprs */
925
- ProjectionInfo *projRight; /* for projecting subselect output */
926
- TupleHashTable hashtable; /* hash table for no-nulls subselect rows */
927
- TupleHashTable hashnulls; /* hash table for rows with null(s) */
928
- bool havehashrows; /* true if hashtable is not empty */
929
- bool havenullrows; /* true if hashnulls is not empty */
930
- MemoryContext hashtablecxt; /* memory context containing hash tables */
931
- MemoryContext hashtempcxt; /* temp memory context for hash tables */
932
- ExprContext *innerecontext; /* econtext for computing inner tuples */
933
- int numCols; /* number of columns being hashed */
934
- /* each of the remaining fields is an array of length numCols: */
935
- AttrNumber *keyColIdx; /* control data for hash tables */
936
- Oid *tab_eq_funcoids; /* equality func oids for table
937
- * datatype(s) */
938
- Oid *tab_collations; /* collations for hash and comparison */
939
- FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */
940
- FmgrInfo *tab_eq_funcs; /* equality functions for table datatype(s) */
941
- FmgrInfo *lhs_hash_funcs; /* hash functions for lefthand datatype(s) */
942
- FmgrInfo *cur_eq_funcs; /* equality functions for LHS vs. table */
943
- ExprState *cur_eq_comp; /* equality comparator for LHS vs. table */
944
- } SubPlanState;
945
-
946
- /*
947
- * DomainConstraintState - one item to check during CoerceToDomain
948
- *
949
- * Note: we consider this to be part of an ExprState tree, so we give it
950
- * a name following the xxxState convention. But there's no directly
951
- * associated plan-tree node.
952
- */
953
- typedef enum DomainConstraintType
954
- {
955
- DOM_CONSTRAINT_NOTNULL,
956
- DOM_CONSTRAINT_CHECK
957
- } DomainConstraintType;
958
-
959
- typedef struct DomainConstraintState
960
- {
961
- NodeTag type;
962
- DomainConstraintType constrainttype; /* constraint type */
963
- char *name; /* name of constraint (for error msgs) */
964
- Expr *check_expr; /* for CHECK, a boolean expression */
965
- ExprState *check_exprstate; /* check_expr's eval state, or NULL */
966
- } DomainConstraintState;
967
-
968
-
969
- /* ----------------------------------------------------------------
970
- * Executor State Trees
971
- *
972
- * An executing query has a PlanState tree paralleling the Plan tree
973
- * that describes the plan.
974
- * ----------------------------------------------------------------
975
- */
976
-
977
- /* ----------------
978
- * ExecProcNodeMtd
979
- *
980
- * This is the method called by ExecProcNode to return the next tuple
981
- * from an executor node. It returns NULL, or an empty TupleTableSlot,
982
- * if no more tuples are available.
983
- * ----------------
984
- */
985
- typedef TupleTableSlot *(*ExecProcNodeMtd) (struct PlanState *pstate);
986
-
987
- /* ----------------
988
- * PlanState node
989
- *
990
- * We never actually instantiate any PlanState nodes; this is just the common
991
- * abstract superclass for all PlanState-type nodes.
992
- * ----------------
993
- */
994
- typedef struct PlanState
995
- {
996
- NodeTag type;
997
-
998
- Plan *plan; /* associated Plan node */
999
-
1000
- EState *state; /* at execution time, states of individual
1001
- * nodes point to one EState for the whole
1002
- * top-level plan */
1003
-
1004
- ExecProcNodeMtd ExecProcNode; /* function to return next tuple */
1005
- ExecProcNodeMtd ExecProcNodeReal; /* actual function, if above is a
1006
- * wrapper */
1007
-
1008
- Instrumentation *instrument; /* Optional runtime stats for this node */
1009
- WorkerInstrumentation *worker_instrument; /* per-worker instrumentation */
1010
-
1011
- /* Per-worker JIT instrumentation */
1012
- struct SharedJitInstrumentation *worker_jit_instrument;
1013
-
1014
- /*
1015
- * Common structural data for all Plan types. These links to subsidiary
1016
- * state trees parallel links in the associated plan tree (except for the
1017
- * subPlan list, which does not exist in the plan tree).
1018
- */
1019
- ExprState *qual; /* boolean qual condition */
1020
- struct PlanState *lefttree; /* input plan tree(s) */
1021
- struct PlanState *righttree;
1022
-
1023
- List *initPlan; /* Init SubPlanState nodes (un-correlated expr
1024
- * subselects) */
1025
- List *subPlan; /* SubPlanState nodes in my expressions */
1026
-
1027
- /*
1028
- * State for management of parameter-change-driven rescanning
1029
- */
1030
- Bitmapset *chgParam; /* set of IDs of changed Params */
1031
-
1032
- /*
1033
- * Other run-time state needed by most if not all node types.
1034
- */
1035
- TupleDesc ps_ResultTupleDesc; /* node's return type */
1036
- TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */
1037
- ExprContext *ps_ExprContext; /* node's expression-evaluation context */
1038
- ProjectionInfo *ps_ProjInfo; /* info for doing tuple projection */
1039
-
1040
- bool async_capable; /* true if node is async-capable */
1041
-
1042
- /*
1043
- * Scanslot's descriptor if known. This is a bit of a hack, but otherwise
1044
- * it's hard for expression compilation to optimize based on the
1045
- * descriptor, without encoding knowledge about all executor nodes.
1046
- */
1047
- TupleDesc scandesc;
1048
-
1049
- /*
1050
- * Define the slot types for inner, outer and scanslots for expression
1051
- * contexts with this state as a parent. If *opsset is set, then
1052
- * *opsfixed indicates whether *ops is guaranteed to be the type of slot
1053
- * used. That means that every slot in the corresponding
1054
- * ExprContext.ecxt_*tuple will point to a slot of that type, while
1055
- * evaluating the expression. If *opsfixed is false, but *ops is set,
1056
- * that indicates the most likely type of slot.
1057
- *
1058
- * The scan* fields are set by ExecInitScanTupleSlot(). If that's not
1059
- * called, nodes can initialize the fields themselves.
1060
- *
1061
- * If outer/inneropsset is false, the information is inferred on-demand
1062
- * using ExecGetResultSlotOps() on ->righttree/lefttree, using the
1063
- * corresponding node's resultops* fields.
1064
- *
1065
- * The result* fields are automatically set when ExecInitResultSlot is
1066
- * used (be it directly or when the slot is created by
1067
- * ExecAssignScanProjectionInfo() /
1068
- * ExecConditionalAssignProjectionInfo()). If no projection is necessary
1069
- * ExecConditionalAssignProjectionInfo() defaults those fields to the scan
1070
- * operations.
1071
- */
1072
- const TupleTableSlotOps *scanops;
1073
- const TupleTableSlotOps *outerops;
1074
- const TupleTableSlotOps *innerops;
1075
- const TupleTableSlotOps *resultops;
1076
- bool scanopsfixed;
1077
- bool outeropsfixed;
1078
- bool inneropsfixed;
1079
- bool resultopsfixed;
1080
- bool scanopsset;
1081
- bool outeropsset;
1082
- bool inneropsset;
1083
- bool resultopsset;
1084
- } PlanState;
1085
-
1086
- /* ----------------
1087
- * these are defined to avoid confusion problems with "left"
1088
- * and "right" and "inner" and "outer". The convention is that
1089
- * the "left" plan is the "outer" plan and the "right" plan is
1090
- * the inner plan, but these make the code more readable.
1091
- * ----------------
1092
- */
1093
- #define innerPlanState(node) (((PlanState *)(node))->righttree)
1094
- #define outerPlanState(node) (((PlanState *)(node))->lefttree)
1095
-
1096
- /* Macros for inline access to certain instrumentation counters */
1097
- #define InstrCountTuples2(node, delta) \
1098
- do { \
1099
- if (((PlanState *)(node))->instrument) \
1100
- ((PlanState *)(node))->instrument->ntuples2 += (delta); \
1101
- } while (0)
1102
- #define InstrCountFiltered1(node, delta) \
1103
- do { \
1104
- if (((PlanState *)(node))->instrument) \
1105
- ((PlanState *)(node))->instrument->nfiltered1 += (delta); \
1106
- } while(0)
1107
- #define InstrCountFiltered2(node, delta) \
1108
- do { \
1109
- if (((PlanState *)(node))->instrument) \
1110
- ((PlanState *)(node))->instrument->nfiltered2 += (delta); \
1111
- } while(0)
1112
-
1113
- /*
1114
- * EPQState is state for executing an EvalPlanQual recheck on a candidate
1115
- * tuples e.g. in ModifyTable or LockRows.
1116
- *
1117
- * To execute EPQ a separate EState is created (stored in ->recheckestate),
1118
- * which shares some resources, like the rangetable, with the main query's
1119
- * EState (stored in ->parentestate). The (sub-)tree of the plan that needs to
1120
- * be rechecked (in ->plan), is separately initialized (into
1121
- * ->recheckplanstate), but shares plan nodes with the corresponding nodes in
1122
- * the main query. The scan nodes in that separate executor tree are changed
1123
- * to return only the current tuple of interest for the respective
1124
- * table. Those tuples are either provided by the caller (using
1125
- * EvalPlanQualSlot), and/or found using the rowmark mechanism (non-locking
1126
- * rowmarks by the EPQ machinery itself, locking ones by the caller).
1127
- *
1128
- * While the plan to be checked may be changed using EvalPlanQualSetPlan(),
1129
- * all such plans need to share the same EState.
1130
- */
1131
- typedef struct EPQState
1132
- {
1133
- /* Initialized at EvalPlanQualInit() time: */
1134
-
1135
- EState *parentestate; /* main query's EState */
1136
- int epqParam; /* ID of Param to force scan node re-eval */
1137
-
1138
- /*
1139
- * Tuples to be substituted by scan nodes. They need to set up, before
1140
- * calling EvalPlanQual()/EvalPlanQualNext(), into the slot returned by
1141
- * EvalPlanQualSlot(scanrelid). The array is indexed by scanrelid - 1.
1142
- */
1143
- List *tuple_table; /* tuple table for relsubs_slot */
1144
- TupleTableSlot **relsubs_slot;
1145
-
1146
- /*
1147
- * Initialized by EvalPlanQualInit(), may be changed later with
1148
- * EvalPlanQualSetPlan():
1149
- */
1150
-
1151
- Plan *plan; /* plan tree to be executed */
1152
- List *arowMarks; /* ExecAuxRowMarks (non-locking only) */
1153
-
1154
-
1155
- /*
1156
- * The original output tuple to be rechecked. Set by
1157
- * EvalPlanQualSetSlot(), before EvalPlanQualNext() or EvalPlanQual() may
1158
- * be called.
1159
- */
1160
- TupleTableSlot *origslot;
1161
-
1162
-
1163
- /* Initialized or reset by EvalPlanQualBegin(): */
1164
-
1165
- EState *recheckestate; /* EState for EPQ execution, see above */
1166
-
1167
- /*
1168
- * Rowmarks that can be fetched on-demand using
1169
- * EvalPlanQualFetchRowMark(), indexed by scanrelid - 1. Only non-locking
1170
- * rowmarks.
1171
- */
1172
- ExecAuxRowMark **relsubs_rowmark;
1173
-
1174
- /*
1175
- * True if a relation's EPQ tuple has been fetched for relation, indexed
1176
- * by scanrelid - 1.
1177
- */
1178
- bool *relsubs_done;
1179
-
1180
- PlanState *recheckplanstate; /* EPQ specific exec nodes, for ->plan */
1181
- } EPQState;
1182
-
1183
-
1184
- /* ----------------
1185
- * ResultState information
1186
- * ----------------
1187
- */
1188
- typedef struct ResultState
1189
- {
1190
- PlanState ps; /* its first field is NodeTag */
1191
- ExprState *resconstantqual;
1192
- bool rs_done; /* are we done? */
1193
- bool rs_checkqual; /* do we need to check the qual? */
1194
- } ResultState;
1195
-
1196
- /* ----------------
1197
- * ProjectSetState information
1198
- *
1199
- * Note: at least one of the "elems" will be a SetExprState; the rest are
1200
- * regular ExprStates.
1201
- * ----------------
1202
- */
1203
- typedef struct ProjectSetState
1204
- {
1205
- PlanState ps; /* its first field is NodeTag */
1206
- Node **elems; /* array of expression states */
1207
- ExprDoneCond *elemdone; /* array of per-SRF is-done states */
1208
- int nelems; /* length of elemdone[] array */
1209
- bool pending_srf_tuples; /* still evaluating srfs in tlist? */
1210
- MemoryContext argcontext; /* context for SRF arguments */
1211
- } ProjectSetState;
1212
-
1213
-
1214
- /* flags for mt_merge_subcommands */
1215
- #define MERGE_INSERT 0x01
1216
- #define MERGE_UPDATE 0x02
1217
- #define MERGE_DELETE 0x04
1218
-
1219
- /* ----------------
1220
- * ModifyTableState information
1221
- * ----------------
1222
- */
1223
- typedef struct ModifyTableState
1224
- {
1225
- PlanState ps; /* its first field is NodeTag */
1226
- CmdType operation; /* INSERT, UPDATE, DELETE, or MERGE */
1227
- bool canSetTag; /* do we set the command tag/es_processed? */
1228
- bool mt_done; /* are we done? */
1229
- int mt_nrels; /* number of entries in resultRelInfo[] */
1230
- ResultRelInfo *resultRelInfo; /* info about target relation(s) */
1231
-
1232
- /*
1233
- * Target relation mentioned in the original statement, used to fire
1234
- * statement-level triggers and as the root for tuple routing. (This
1235
- * might point to one of the resultRelInfo[] entries, but it can also be a
1236
- * distinct struct.)
1237
- */
1238
- ResultRelInfo *rootResultRelInfo;
1239
-
1240
- EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */
1241
- bool fireBSTriggers; /* do we need to fire stmt triggers? */
1242
-
1243
- /*
1244
- * These fields are used for inherited UPDATE and DELETE, to track which
1245
- * target relation a given tuple is from. If there are a lot of target
1246
- * relations, we use a hash table to translate table OIDs to
1247
- * resultRelInfo[] indexes; otherwise mt_resultOidHash is NULL.
1248
- */
1249
- int mt_resultOidAttno; /* resno of "tableoid" junk attr */
1250
- Oid mt_lastResultOid; /* last-seen value of tableoid */
1251
- int mt_lastResultIndex; /* corresponding index in resultRelInfo[] */
1252
- HTAB *mt_resultOidHash; /* optional hash table to speed lookups */
1253
-
1254
- /*
1255
- * Slot for storing tuples in the root partitioned table's rowtype during
1256
- * an UPDATE of a partitioned table.
1257
- */
1258
- TupleTableSlot *mt_root_tuple_slot;
1259
-
1260
- /* Tuple-routing support info */
1261
- struct PartitionTupleRouting *mt_partition_tuple_routing;
1262
-
1263
- /* controls transition table population for specified operation */
1264
- struct TransitionCaptureState *mt_transition_capture;
1265
-
1266
- /* controls transition table population for INSERT...ON CONFLICT UPDATE */
1267
- struct TransitionCaptureState *mt_oc_transition_capture;
1268
-
1269
- /* Flags showing which subcommands are present INS/UPD/DEL/DO NOTHING */
1270
- int mt_merge_subcommands;
1271
-
1272
- /* tuple counters for MERGE */
1273
- double mt_merge_inserted;
1274
- double mt_merge_updated;
1275
- double mt_merge_deleted;
1276
- } ModifyTableState;
1277
-
1278
- /* ----------------
1279
- * AppendState information
1280
- *
1281
- * nplans how many plans are in the array
1282
- * whichplan which synchronous plan is being executed (0 .. n-1)
1283
- * or a special negative value. See nodeAppend.c.
1284
- * prune_state details required to allow partitions to be
1285
- * eliminated from the scan, or NULL if not possible.
1286
- * valid_subplans for runtime pruning, valid synchronous appendplans
1287
- * indexes to scan.
1288
- * ----------------
1289
- */
1290
-
1291
- struct AppendState;
1292
- typedef struct AppendState AppendState;
1293
- struct ParallelAppendState;
1294
- typedef struct ParallelAppendState ParallelAppendState;
1295
- struct PartitionPruneState;
1296
-
1297
- struct AppendState
1298
- {
1299
- PlanState ps; /* its first field is NodeTag */
1300
- PlanState **appendplans; /* array of PlanStates for my inputs */
1301
- int as_nplans;
1302
- int as_whichplan;
1303
- bool as_begun; /* false means need to initialize */
1304
- Bitmapset *as_asyncplans; /* asynchronous plans indexes */
1305
- int as_nasyncplans; /* # of asynchronous plans */
1306
- AsyncRequest **as_asyncrequests; /* array of AsyncRequests */
1307
- TupleTableSlot **as_asyncresults; /* unreturned results of async plans */
1308
- int as_nasyncresults; /* # of valid entries in as_asyncresults */
1309
- bool as_syncdone; /* true if all synchronous plans done in
1310
- * asynchronous mode, else false */
1311
- int as_nasyncremain; /* # of remaining asynchronous plans */
1312
- Bitmapset *as_needrequest; /* asynchronous plans needing a new request */
1313
- struct WaitEventSet *as_eventset; /* WaitEventSet used to configure file
1314
- * descriptor wait events */
1315
- int as_first_partial_plan; /* Index of 'appendplans' containing
1316
- * the first partial plan */
1317
- ParallelAppendState *as_pstate; /* parallel coordination info */
1318
- Size pstate_len; /* size of parallel coordination info */
1319
- struct PartitionPruneState *as_prune_state;
1320
- Bitmapset *as_valid_subplans;
1321
- Bitmapset *as_valid_asyncplans; /* valid asynchronous plans indexes */
1322
- bool (*choose_next_subplan) (AppendState *);
1323
- };
1324
-
1325
- /* ----------------
1326
- * MergeAppendState information
1327
- *
1328
- * nplans how many plans are in the array
1329
- * nkeys number of sort key columns
1330
- * sortkeys sort keys in SortSupport representation
1331
- * slots current output tuple of each subplan
1332
- * heap heap of active tuples
1333
- * initialized true if we have fetched first tuple from each subplan
1334
- * prune_state details required to allow partitions to be
1335
- * eliminated from the scan, or NULL if not possible.
1336
- * valid_subplans for runtime pruning, valid mergeplans indexes to
1337
- * scan.
1338
- * ----------------
1339
- */
1340
- typedef struct MergeAppendState
1341
- {
1342
- PlanState ps; /* its first field is NodeTag */
1343
- PlanState **mergeplans; /* array of PlanStates for my inputs */
1344
- int ms_nplans;
1345
- int ms_nkeys;
1346
- SortSupport ms_sortkeys; /* array of length ms_nkeys */
1347
- TupleTableSlot **ms_slots; /* array of length ms_nplans */
1348
- struct binaryheap *ms_heap; /* binary heap of slot indices */
1349
- bool ms_initialized; /* are subplans started? */
1350
- struct PartitionPruneState *ms_prune_state;
1351
- Bitmapset *ms_valid_subplans;
1352
- } MergeAppendState;
1353
-
1354
- /* ----------------
1355
- * RecursiveUnionState information
1356
- *
1357
- * RecursiveUnionState is used for performing a recursive union.
1358
- *
1359
- * recursing T when we're done scanning the non-recursive term
1360
- * intermediate_empty T if intermediate_table is currently empty
1361
- * working_table working table (to be scanned by recursive term)
1362
- * intermediate_table current recursive output (next generation of WT)
1363
- * ----------------
1364
- */
1365
- typedef struct RecursiveUnionState
1366
- {
1367
- PlanState ps; /* its first field is NodeTag */
1368
- bool recursing;
1369
- bool intermediate_empty;
1370
- Tuplestorestate *working_table;
1371
- Tuplestorestate *intermediate_table;
1372
- /* Remaining fields are unused in UNION ALL case */
1373
- Oid *eqfuncoids; /* per-grouping-field equality fns */
1374
- FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
1375
- MemoryContext tempContext; /* short-term context for comparisons */
1376
- TupleHashTable hashtable; /* hash table for tuples already seen */
1377
- MemoryContext tableContext; /* memory context containing hash table */
1378
- } RecursiveUnionState;
1379
-
1380
- /* ----------------
1381
- * BitmapAndState information
1382
- * ----------------
1383
- */
1384
- typedef struct BitmapAndState
1385
- {
1386
- PlanState ps; /* its first field is NodeTag */
1387
- PlanState **bitmapplans; /* array of PlanStates for my inputs */
1388
- int nplans; /* number of input plans */
1389
- } BitmapAndState;
1390
-
1391
- /* ----------------
1392
- * BitmapOrState information
1393
- * ----------------
1394
- */
1395
- typedef struct BitmapOrState
1396
- {
1397
- PlanState ps; /* its first field is NodeTag */
1398
- PlanState **bitmapplans; /* array of PlanStates for my inputs */
1399
- int nplans; /* number of input plans */
1400
- } BitmapOrState;
1401
-
1402
- /* ----------------------------------------------------------------
1403
- * Scan State Information
1404
- * ----------------------------------------------------------------
1405
- */
1406
-
1407
- /* ----------------
1408
- * ScanState information
1409
- *
1410
- * ScanState extends PlanState for node types that represent
1411
- * scans of an underlying relation. It can also be used for nodes
1412
- * that scan the output of an underlying plan node --- in that case,
1413
- * only ScanTupleSlot is actually useful, and it refers to the tuple
1414
- * retrieved from the subplan.
1415
- *
1416
- * currentRelation relation being scanned (NULL if none)
1417
- * currentScanDesc current scan descriptor for scan (NULL if none)
1418
- * ScanTupleSlot pointer to slot in tuple table holding scan tuple
1419
- * ----------------
1420
- */
1421
- typedef struct ScanState
1422
- {
1423
- PlanState ps; /* its first field is NodeTag */
1424
- Relation ss_currentRelation;
1425
- struct TableScanDescData *ss_currentScanDesc;
1426
- TupleTableSlot *ss_ScanTupleSlot;
1427
- } ScanState;
1428
-
1429
- /* ----------------
1430
- * SeqScanState information
1431
- * ----------------
1432
- */
1433
- typedef struct SeqScanState
1434
- {
1435
- ScanState ss; /* its first field is NodeTag */
1436
- Size pscan_len; /* size of parallel heap scan descriptor */
1437
- } SeqScanState;
1438
-
1439
- /* ----------------
1440
- * SampleScanState information
1441
- * ----------------
1442
- */
1443
- typedef struct SampleScanState
1444
- {
1445
- ScanState ss;
1446
- List *args; /* expr states for TABLESAMPLE params */
1447
- ExprState *repeatable; /* expr state for REPEATABLE expr */
1448
- /* use struct pointer to avoid including tsmapi.h here */
1449
- struct TsmRoutine *tsmroutine; /* descriptor for tablesample method */
1450
- void *tsm_state; /* tablesample method can keep state here */
1451
- bool use_bulkread; /* use bulkread buffer access strategy? */
1452
- bool use_pagemode; /* use page-at-a-time visibility checking? */
1453
- bool begun; /* false means need to call BeginSampleScan */
1454
- uint32 seed; /* random seed */
1455
- int64 donetuples; /* number of tuples already returned */
1456
- bool haveblock; /* has a block for sampling been determined */
1457
- bool done; /* exhausted all tuples? */
1458
- } SampleScanState;
1459
-
1460
- /*
1461
- * These structs store information about index quals that don't have simple
1462
- * constant right-hand sides. See comments for ExecIndexBuildScanKeys()
1463
- * for discussion.
1464
- */
1465
- typedef struct
1466
- {
1467
- struct ScanKeyData *scan_key; /* scankey to put value into */
1468
- ExprState *key_expr; /* expr to evaluate to get value */
1469
- bool key_toastable; /* is expr's result a toastable datatype? */
1470
- } IndexRuntimeKeyInfo;
1471
-
1472
- typedef struct
1473
- {
1474
- struct ScanKeyData *scan_key; /* scankey to put value into */
1475
- ExprState *array_expr; /* expr to evaluate to get array value */
1476
- int next_elem; /* next array element to use */
1477
- int num_elems; /* number of elems in current array value */
1478
- Datum *elem_values; /* array of num_elems Datums */
1479
- bool *elem_nulls; /* array of num_elems is-null flags */
1480
- } IndexArrayKeyInfo;
1481
-
1482
- /* ----------------
1483
- * IndexScanState information
1484
- *
1485
- * indexqualorig execution state for indexqualorig expressions
1486
- * indexorderbyorig execution state for indexorderbyorig expressions
1487
- * ScanKeys Skey structures for index quals
1488
- * NumScanKeys number of ScanKeys
1489
- * OrderByKeys Skey structures for index ordering operators
1490
- * NumOrderByKeys number of OrderByKeys
1491
- * RuntimeKeys info about Skeys that must be evaluated at runtime
1492
- * NumRuntimeKeys number of RuntimeKeys
1493
- * RuntimeKeysReady true if runtime Skeys have been computed
1494
- * RuntimeContext expr context for evaling runtime Skeys
1495
- * RelationDesc index relation descriptor
1496
- * ScanDesc index scan descriptor
1497
- *
1498
- * ReorderQueue tuples that need reordering due to re-check
1499
- * ReachedEnd have we fetched all tuples from index already?
1500
- * OrderByValues values of ORDER BY exprs of last fetched tuple
1501
- * OrderByNulls null flags for OrderByValues
1502
- * SortSupport for reordering ORDER BY exprs
1503
- * OrderByTypByVals is the datatype of order by expression pass-by-value?
1504
- * OrderByTypLens typlens of the datatypes of order by expressions
1505
- * PscanLen size of parallel index scan descriptor
1506
- * ----------------
1507
- */
1508
- typedef struct IndexScanState
1509
- {
1510
- ScanState ss; /* its first field is NodeTag */
1511
- ExprState *indexqualorig;
1512
- List *indexorderbyorig;
1513
- struct ScanKeyData *iss_ScanKeys;
1514
- int iss_NumScanKeys;
1515
- struct ScanKeyData *iss_OrderByKeys;
1516
- int iss_NumOrderByKeys;
1517
- IndexRuntimeKeyInfo *iss_RuntimeKeys;
1518
- int iss_NumRuntimeKeys;
1519
- bool iss_RuntimeKeysReady;
1520
- ExprContext *iss_RuntimeContext;
1521
- Relation iss_RelationDesc;
1522
- struct IndexScanDescData *iss_ScanDesc;
1523
-
1524
- /* These are needed for re-checking ORDER BY expr ordering */
1525
- pairingheap *iss_ReorderQueue;
1526
- bool iss_ReachedEnd;
1527
- Datum *iss_OrderByValues;
1528
- bool *iss_OrderByNulls;
1529
- SortSupport iss_SortSupport;
1530
- bool *iss_OrderByTypByVals;
1531
- int16 *iss_OrderByTypLens;
1532
- Size iss_PscanLen;
1533
- } IndexScanState;
1534
-
1535
- /* ----------------
1536
- * IndexOnlyScanState information
1537
- *
1538
- * recheckqual execution state for recheckqual expressions
1539
- * ScanKeys Skey structures for index quals
1540
- * NumScanKeys number of ScanKeys
1541
- * OrderByKeys Skey structures for index ordering operators
1542
- * NumOrderByKeys number of OrderByKeys
1543
- * RuntimeKeys info about Skeys that must be evaluated at runtime
1544
- * NumRuntimeKeys number of RuntimeKeys
1545
- * RuntimeKeysReady true if runtime Skeys have been computed
1546
- * RuntimeContext expr context for evaling runtime Skeys
1547
- * RelationDesc index relation descriptor
1548
- * ScanDesc index scan descriptor
1549
- * TableSlot slot for holding tuples fetched from the table
1550
- * VMBuffer buffer in use for visibility map testing, if any
1551
- * PscanLen size of parallel index-only scan descriptor
1552
- * ----------------
1553
- */
1554
- typedef struct IndexOnlyScanState
1555
- {
1556
- ScanState ss; /* its first field is NodeTag */
1557
- ExprState *recheckqual;
1558
- struct ScanKeyData *ioss_ScanKeys;
1559
- int ioss_NumScanKeys;
1560
- struct ScanKeyData *ioss_OrderByKeys;
1561
- int ioss_NumOrderByKeys;
1562
- IndexRuntimeKeyInfo *ioss_RuntimeKeys;
1563
- int ioss_NumRuntimeKeys;
1564
- bool ioss_RuntimeKeysReady;
1565
- ExprContext *ioss_RuntimeContext;
1566
- Relation ioss_RelationDesc;
1567
- struct IndexScanDescData *ioss_ScanDesc;
1568
- TupleTableSlot *ioss_TableSlot;
1569
- Buffer ioss_VMBuffer;
1570
- Size ioss_PscanLen;
1571
- } IndexOnlyScanState;
1572
-
1573
- /* ----------------
1574
- * BitmapIndexScanState information
1575
- *
1576
- * result bitmap to return output into, or NULL
1577
- * ScanKeys Skey structures for index quals
1578
- * NumScanKeys number of ScanKeys
1579
- * RuntimeKeys info about Skeys that must be evaluated at runtime
1580
- * NumRuntimeKeys number of RuntimeKeys
1581
- * ArrayKeys info about Skeys that come from ScalarArrayOpExprs
1582
- * NumArrayKeys number of ArrayKeys
1583
- * RuntimeKeysReady true if runtime Skeys have been computed
1584
- * RuntimeContext expr context for evaling runtime Skeys
1585
- * RelationDesc index relation descriptor
1586
- * ScanDesc index scan descriptor
1587
- * ----------------
1588
- */
1589
- typedef struct BitmapIndexScanState
1590
- {
1591
- ScanState ss; /* its first field is NodeTag */
1592
- TIDBitmap *biss_result;
1593
- struct ScanKeyData *biss_ScanKeys;
1594
- int biss_NumScanKeys;
1595
- IndexRuntimeKeyInfo *biss_RuntimeKeys;
1596
- int biss_NumRuntimeKeys;
1597
- IndexArrayKeyInfo *biss_ArrayKeys;
1598
- int biss_NumArrayKeys;
1599
- bool biss_RuntimeKeysReady;
1600
- ExprContext *biss_RuntimeContext;
1601
- Relation biss_RelationDesc;
1602
- struct IndexScanDescData *biss_ScanDesc;
1603
- } BitmapIndexScanState;
1604
-
1605
- /* ----------------
1606
- * SharedBitmapState information
1607
- *
1608
- * BM_INITIAL TIDBitmap creation is not yet started, so first worker
1609
- * to see this state will set the state to BM_INPROGRESS
1610
- * and that process will be responsible for creating
1611
- * TIDBitmap.
1612
- * BM_INPROGRESS TIDBitmap creation is in progress; workers need to
1613
- * sleep until it's finished.
1614
- * BM_FINISHED TIDBitmap creation is done, so now all workers can
1615
- * proceed to iterate over TIDBitmap.
1616
- * ----------------
1617
- */
1618
- typedef enum
1619
- {
1620
- BM_INITIAL,
1621
- BM_INPROGRESS,
1622
- BM_FINISHED
1623
- } SharedBitmapState;
1624
-
1625
- /* ----------------
1626
- * ParallelBitmapHeapState information
1627
- * tbmiterator iterator for scanning current pages
1628
- * prefetch_iterator iterator for prefetching ahead of current page
1629
- * mutex mutual exclusion for the prefetching variable
1630
- * and state
1631
- * prefetch_pages # pages prefetch iterator is ahead of current
1632
- * prefetch_target current target prefetch distance
1633
- * state current state of the TIDBitmap
1634
- * cv conditional wait variable
1635
- * phs_snapshot_data snapshot data shared to workers
1636
- * ----------------
1637
- */
1638
- typedef struct ParallelBitmapHeapState
1639
- {
1640
- dsa_pointer tbmiterator;
1641
- dsa_pointer prefetch_iterator;
1642
- slock_t mutex;
1643
- int prefetch_pages;
1644
- int prefetch_target;
1645
- SharedBitmapState state;
1646
- ConditionVariable cv;
1647
- char phs_snapshot_data[FLEXIBLE_ARRAY_MEMBER];
1648
- } ParallelBitmapHeapState;
1649
-
1650
- /* ----------------
1651
- * BitmapHeapScanState information
1652
- *
1653
- * bitmapqualorig execution state for bitmapqualorig expressions
1654
- * tbm bitmap obtained from child index scan(s)
1655
- * tbmiterator iterator for scanning current pages
1656
- * tbmres current-page data
1657
- * can_skip_fetch can we potentially skip tuple fetches in this scan?
1658
- * return_empty_tuples number of empty tuples to return
1659
- * vmbuffer buffer for visibility-map lookups
1660
- * pvmbuffer ditto, for prefetched pages
1661
- * exact_pages total number of exact pages retrieved
1662
- * lossy_pages total number of lossy pages retrieved
1663
- * prefetch_iterator iterator for prefetching ahead of current page
1664
- * prefetch_pages # pages prefetch iterator is ahead of current
1665
- * prefetch_target current target prefetch distance
1666
- * prefetch_maximum maximum value for prefetch_target
1667
- * pscan_len size of the shared memory for parallel bitmap
1668
- * initialized is node is ready to iterate
1669
- * shared_tbmiterator shared iterator
1670
- * shared_prefetch_iterator shared iterator for prefetching
1671
- * pstate shared state for parallel bitmap scan
1672
- * ----------------
1673
- */
1674
- typedef struct BitmapHeapScanState
1675
- {
1676
- ScanState ss; /* its first field is NodeTag */
1677
- ExprState *bitmapqualorig;
1678
- TIDBitmap *tbm;
1679
- TBMIterator *tbmiterator;
1680
- TBMIterateResult *tbmres;
1681
- bool can_skip_fetch;
1682
- int return_empty_tuples;
1683
- Buffer vmbuffer;
1684
- Buffer pvmbuffer;
1685
- long exact_pages;
1686
- long lossy_pages;
1687
- TBMIterator *prefetch_iterator;
1688
- int prefetch_pages;
1689
- int prefetch_target;
1690
- int prefetch_maximum;
1691
- Size pscan_len;
1692
- bool initialized;
1693
- TBMSharedIterator *shared_tbmiterator;
1694
- TBMSharedIterator *shared_prefetch_iterator;
1695
- ParallelBitmapHeapState *pstate;
1696
- } BitmapHeapScanState;
1697
-
1698
- /* ----------------
1699
- * TidScanState information
1700
- *
1701
- * tidexprs list of TidExpr structs (see nodeTidscan.c)
1702
- * isCurrentOf scan has a CurrentOfExpr qual
1703
- * NumTids number of tids in this scan
1704
- * TidPtr index of currently fetched tid
1705
- * TidList evaluated item pointers (array of size NumTids)
1706
- * htup currently-fetched tuple, if any
1707
- * ----------------
1708
- */
1709
- typedef struct TidScanState
1710
- {
1711
- ScanState ss; /* its first field is NodeTag */
1712
- List *tss_tidexprs;
1713
- bool tss_isCurrentOf;
1714
- int tss_NumTids;
1715
- int tss_TidPtr;
1716
- ItemPointerData *tss_TidList;
1717
- HeapTupleData tss_htup;
1718
- } TidScanState;
1719
-
1720
- /* ----------------
1721
- * TidRangeScanState information
1722
- *
1723
- * trss_tidexprs list of TidOpExpr structs (see nodeTidrangescan.c)
1724
- * trss_mintid the lowest TID in the scan range
1725
- * trss_maxtid the highest TID in the scan range
1726
- * trss_inScan is a scan currently in progress?
1727
- * ----------------
1728
- */
1729
- typedef struct TidRangeScanState
1730
- {
1731
- ScanState ss; /* its first field is NodeTag */
1732
- List *trss_tidexprs;
1733
- ItemPointerData trss_mintid;
1734
- ItemPointerData trss_maxtid;
1735
- bool trss_inScan;
1736
- } TidRangeScanState;
1737
-
1738
- /* ----------------
1739
- * SubqueryScanState information
1740
- *
1741
- * SubqueryScanState is used for scanning a sub-query in the range table.
1742
- * ScanTupleSlot references the current output tuple of the sub-query.
1743
- * ----------------
1744
- */
1745
- typedef struct SubqueryScanState
1746
- {
1747
- ScanState ss; /* its first field is NodeTag */
1748
- PlanState *subplan;
1749
- } SubqueryScanState;
1750
-
1751
- /* ----------------
1752
- * FunctionScanState information
1753
- *
1754
- * Function nodes are used to scan the results of a
1755
- * function appearing in FROM (typically a function returning set).
1756
- *
1757
- * eflags node's capability flags
1758
- * ordinality is this scan WITH ORDINALITY?
1759
- * simple true if we have 1 function and no ordinality
1760
- * ordinal current ordinal column value
1761
- * nfuncs number of functions being executed
1762
- * funcstates per-function execution states (private in
1763
- * nodeFunctionscan.c)
1764
- * argcontext memory context to evaluate function arguments in
1765
- * ----------------
1766
- */
1767
- struct FunctionScanPerFuncState;
1768
-
1769
- typedef struct FunctionScanState
1770
- {
1771
- ScanState ss; /* its first field is NodeTag */
1772
- int eflags;
1773
- bool ordinality;
1774
- bool simple;
1775
- int64 ordinal;
1776
- int nfuncs;
1777
- struct FunctionScanPerFuncState *funcstates; /* array of length nfuncs */
1778
- MemoryContext argcontext;
1779
- } FunctionScanState;
1780
-
1781
- /* ----------------
1782
- * ValuesScanState information
1783
- *
1784
- * ValuesScan nodes are used to scan the results of a VALUES list
1785
- *
1786
- * rowcontext per-expression-list context
1787
- * exprlists array of expression lists being evaluated
1788
- * exprstatelists array of expression state lists, for SubPlans only
1789
- * array_len size of above arrays
1790
- * curr_idx current array index (0-based)
1791
- *
1792
- * Note: ss.ps.ps_ExprContext is used to evaluate any qual or projection
1793
- * expressions attached to the node. We create a second ExprContext,
1794
- * rowcontext, in which to build the executor expression state for each
1795
- * Values sublist. Resetting this context lets us get rid of expression
1796
- * state for each row, avoiding major memory leakage over a long values list.
1797
- * However, that doesn't work for sublists containing SubPlans, because a
1798
- * SubPlan has to be connected up to the outer plan tree to work properly.
1799
- * Therefore, for only those sublists containing SubPlans, we do expression
1800
- * state construction at executor start, and store those pointers in
1801
- * exprstatelists[]. NULL entries in that array correspond to simple
1802
- * subexpressions that are handled as described above.
1803
- * ----------------
1804
- */
1805
- typedef struct ValuesScanState
1806
- {
1807
- ScanState ss; /* its first field is NodeTag */
1808
- ExprContext *rowcontext;
1809
- List **exprlists;
1810
- List **exprstatelists;
1811
- int array_len;
1812
- int curr_idx;
1813
- } ValuesScanState;
1814
-
1815
- /* ----------------
1816
- * TableFuncScanState node
1817
- *
1818
- * Used in table-expression functions like XMLTABLE.
1819
- * ----------------
1820
- */
1821
- typedef struct TableFuncScanState
1822
- {
1823
- ScanState ss; /* its first field is NodeTag */
1824
- ExprState *docexpr; /* state for document expression */
1825
- ExprState *rowexpr; /* state for row-generating expression */
1826
- List *colexprs; /* state for column-generating expression */
1827
- List *coldefexprs; /* state for column default expressions */
1828
- List *ns_names; /* same as TableFunc.ns_names */
1829
- List *ns_uris; /* list of states of namespace URI exprs */
1830
- Bitmapset *notnulls; /* nullability flag for each output column */
1831
- void *opaque; /* table builder private space */
1832
- const struct TableFuncRoutine *routine; /* table builder methods */
1833
- FmgrInfo *in_functions; /* input function for each column */
1834
- Oid *typioparams; /* typioparam for each column */
1835
- int64 ordinal; /* row number to be output next */
1836
- MemoryContext perTableCxt; /* per-table context */
1837
- Tuplestorestate *tupstore; /* output tuple store */
1838
- } TableFuncScanState;
1839
-
1840
- /* ----------------
1841
- * CteScanState information
1842
- *
1843
- * CteScan nodes are used to scan a CommonTableExpr query.
1844
- *
1845
- * Multiple CteScan nodes can read out from the same CTE query. We use
1846
- * a tuplestore to hold rows that have been read from the CTE query but
1847
- * not yet consumed by all readers.
1848
- * ----------------
1849
- */
1850
- typedef struct CteScanState
1851
- {
1852
- ScanState ss; /* its first field is NodeTag */
1853
- int eflags; /* capability flags to pass to tuplestore */
1854
- int readptr; /* index of my tuplestore read pointer */
1855
- PlanState *cteplanstate; /* PlanState for the CTE query itself */
1856
- /* Link to the "leader" CteScanState (possibly this same node) */
1857
- struct CteScanState *leader;
1858
- /* The remaining fields are only valid in the "leader" CteScanState */
1859
- Tuplestorestate *cte_table; /* rows already read from the CTE query */
1860
- bool eof_cte; /* reached end of CTE query? */
1861
- } CteScanState;
1862
-
1863
- /* ----------------
1864
- * NamedTuplestoreScanState information
1865
- *
1866
- * NamedTuplestoreScan nodes are used to scan a Tuplestore created and
1867
- * named prior to execution of the query. An example is a transition
1868
- * table for an AFTER trigger.
1869
- *
1870
- * Multiple NamedTuplestoreScan nodes can read out from the same Tuplestore.
1871
- * ----------------
1872
- */
1873
- typedef struct NamedTuplestoreScanState
1874
- {
1875
- ScanState ss; /* its first field is NodeTag */
1876
- int readptr; /* index of my tuplestore read pointer */
1877
- TupleDesc tupdesc; /* format of the tuples in the tuplestore */
1878
- Tuplestorestate *relation; /* the rows */
1879
- } NamedTuplestoreScanState;
1880
-
1881
- /* ----------------
1882
- * WorkTableScanState information
1883
- *
1884
- * WorkTableScan nodes are used to scan the work table created by
1885
- * a RecursiveUnion node. We locate the RecursiveUnion node
1886
- * during executor startup.
1887
- * ----------------
1888
- */
1889
- typedef struct WorkTableScanState
1890
- {
1891
- ScanState ss; /* its first field is NodeTag */
1892
- RecursiveUnionState *rustate;
1893
- } WorkTableScanState;
1894
-
1895
- /* ----------------
1896
- * ForeignScanState information
1897
- *
1898
- * ForeignScan nodes are used to scan foreign-data tables.
1899
- * ----------------
1900
- */
1901
- typedef struct ForeignScanState
1902
- {
1903
- ScanState ss; /* its first field is NodeTag */
1904
- ExprState *fdw_recheck_quals; /* original quals not in ss.ps.qual */
1905
- Size pscan_len; /* size of parallel coordination information */
1906
- ResultRelInfo *resultRelInfo; /* result rel info, if UPDATE or DELETE */
1907
- /* use struct pointer to avoid including fdwapi.h here */
1908
- struct FdwRoutine *fdwroutine;
1909
- void *fdw_state; /* foreign-data wrapper can keep state here */
1910
- } ForeignScanState;
1911
-
1912
- /* ----------------
1913
- * CustomScanState information
1914
- *
1915
- * CustomScan nodes are used to execute custom code within executor.
1916
- *
1917
- * Core code must avoid assuming that the CustomScanState is only as large as
1918
- * the structure declared here; providers are allowed to make it the first
1919
- * element in a larger structure, and typically would need to do so. The
1920
- * struct is actually allocated by the CreateCustomScanState method associated
1921
- * with the plan node. Any additional fields can be initialized there, or in
1922
- * the BeginCustomScan method.
1923
- * ----------------
1924
- */
1925
- struct CustomExecMethods;
1926
-
1927
- typedef struct CustomScanState
1928
- {
1929
- ScanState ss;
1930
- uint32 flags; /* mask of CUSTOMPATH_* flags, see
1931
- * nodes/extensible.h */
1932
- List *custom_ps; /* list of child PlanState nodes, if any */
1933
- Size pscan_len; /* size of parallel coordination information */
1934
- const struct CustomExecMethods *methods;
1935
- } CustomScanState;
1936
-
1937
- /* ----------------------------------------------------------------
1938
- * Join State Information
1939
- * ----------------------------------------------------------------
1940
- */
1941
-
1942
- /* ----------------
1943
- * JoinState information
1944
- *
1945
- * Superclass for state nodes of join plans.
1946
- * ----------------
1947
- */
1948
- typedef struct JoinState
1949
- {
1950
- PlanState ps;
1951
- JoinType jointype;
1952
- bool single_match; /* True if we should skip to next outer tuple
1953
- * after finding one inner match */
1954
- ExprState *joinqual; /* JOIN quals (in addition to ps.qual) */
1955
- } JoinState;
1956
-
1957
- /* ----------------
1958
- * NestLoopState information
1959
- *
1960
- * NeedNewOuter true if need new outer tuple on next call
1961
- * MatchedOuter true if found a join match for current outer tuple
1962
- * NullInnerTupleSlot prepared null tuple for left outer joins
1963
- * ----------------
1964
- */
1965
- typedef struct NestLoopState
1966
- {
1967
- JoinState js; /* its first field is NodeTag */
1968
- bool nl_NeedNewOuter;
1969
- bool nl_MatchedOuter;
1970
- TupleTableSlot *nl_NullInnerTupleSlot;
1971
- } NestLoopState;
1972
-
1973
- /* ----------------
1974
- * MergeJoinState information
1975
- *
1976
- * NumClauses number of mergejoinable join clauses
1977
- * Clauses info for each mergejoinable clause
1978
- * JoinState current state of ExecMergeJoin state machine
1979
- * SkipMarkRestore true if we may skip Mark and Restore operations
1980
- * ExtraMarks true to issue extra Mark operations on inner scan
1981
- * ConstFalseJoin true if we have a constant-false joinqual
1982
- * FillOuter true if should emit unjoined outer tuples anyway
1983
- * FillInner true if should emit unjoined inner tuples anyway
1984
- * MatchedOuter true if found a join match for current outer tuple
1985
- * MatchedInner true if found a join match for current inner tuple
1986
- * OuterTupleSlot slot in tuple table for cur outer tuple
1987
- * InnerTupleSlot slot in tuple table for cur inner tuple
1988
- * MarkedTupleSlot slot in tuple table for marked tuple
1989
- * NullOuterTupleSlot prepared null tuple for right outer joins
1990
- * NullInnerTupleSlot prepared null tuple for left outer joins
1991
- * OuterEContext workspace for computing outer tuple's join values
1992
- * InnerEContext workspace for computing inner tuple's join values
1993
- * ----------------
1994
- */
1995
- /* private in nodeMergejoin.c: */
1996
- typedef struct MergeJoinClauseData *MergeJoinClause;
1997
-
1998
- typedef struct MergeJoinState
1999
- {
2000
- JoinState js; /* its first field is NodeTag */
2001
- int mj_NumClauses;
2002
- MergeJoinClause mj_Clauses; /* array of length mj_NumClauses */
2003
- int mj_JoinState;
2004
- bool mj_SkipMarkRestore;
2005
- bool mj_ExtraMarks;
2006
- bool mj_ConstFalseJoin;
2007
- bool mj_FillOuter;
2008
- bool mj_FillInner;
2009
- bool mj_MatchedOuter;
2010
- bool mj_MatchedInner;
2011
- TupleTableSlot *mj_OuterTupleSlot;
2012
- TupleTableSlot *mj_InnerTupleSlot;
2013
- TupleTableSlot *mj_MarkedTupleSlot;
2014
- TupleTableSlot *mj_NullOuterTupleSlot;
2015
- TupleTableSlot *mj_NullInnerTupleSlot;
2016
- ExprContext *mj_OuterEContext;
2017
- ExprContext *mj_InnerEContext;
2018
- } MergeJoinState;
2019
-
2020
- /* ----------------
2021
- * HashJoinState information
2022
- *
2023
- * hashclauses original form of the hashjoin condition
2024
- * hj_OuterHashKeys the outer hash keys in the hashjoin condition
2025
- * hj_HashOperators the join operators in the hashjoin condition
2026
- * hj_HashTable hash table for the hashjoin
2027
- * (NULL if table not built yet)
2028
- * hj_CurHashValue hash value for current outer tuple
2029
- * hj_CurBucketNo regular bucket# for current outer tuple
2030
- * hj_CurSkewBucketNo skew bucket# for current outer tuple
2031
- * hj_CurTuple last inner tuple matched to current outer
2032
- * tuple, or NULL if starting search
2033
- * (hj_CurXXX variables are undefined if
2034
- * OuterTupleSlot is empty!)
2035
- * hj_OuterTupleSlot tuple slot for outer tuples
2036
- * hj_HashTupleSlot tuple slot for inner (hashed) tuples
2037
- * hj_NullOuterTupleSlot prepared null tuple for right/full outer joins
2038
- * hj_NullInnerTupleSlot prepared null tuple for left/full outer joins
2039
- * hj_FirstOuterTupleSlot first tuple retrieved from outer plan
2040
- * hj_JoinState current state of ExecHashJoin state machine
2041
- * hj_MatchedOuter true if found a join match for current outer
2042
- * hj_OuterNotEmpty true if outer relation known not empty
2043
- * ----------------
2044
- */
2045
-
2046
- /* these structs are defined in executor/hashjoin.h: */
2047
- typedef struct HashJoinTupleData *HashJoinTuple;
2048
- typedef struct HashJoinTableData *HashJoinTable;
2049
-
2050
- typedef struct HashJoinState
2051
- {
2052
- JoinState js; /* its first field is NodeTag */
2053
- ExprState *hashclauses;
2054
- List *hj_OuterHashKeys; /* list of ExprState nodes */
2055
- List *hj_HashOperators; /* list of operator OIDs */
2056
- List *hj_Collations;
2057
- HashJoinTable hj_HashTable;
2058
- uint32 hj_CurHashValue;
2059
- int hj_CurBucketNo;
2060
- int hj_CurSkewBucketNo;
2061
- HashJoinTuple hj_CurTuple;
2062
- TupleTableSlot *hj_OuterTupleSlot;
2063
- TupleTableSlot *hj_HashTupleSlot;
2064
- TupleTableSlot *hj_NullOuterTupleSlot;
2065
- TupleTableSlot *hj_NullInnerTupleSlot;
2066
- TupleTableSlot *hj_FirstOuterTupleSlot;
2067
- int hj_JoinState;
2068
- bool hj_MatchedOuter;
2069
- bool hj_OuterNotEmpty;
2070
- } HashJoinState;
2071
-
2072
-
2073
- /* ----------------------------------------------------------------
2074
- * Materialization State Information
2075
- * ----------------------------------------------------------------
2076
- */
2077
-
2078
- /* ----------------
2079
- * MaterialState information
2080
- *
2081
- * materialize nodes are used to materialize the results
2082
- * of a subplan into a temporary file.
2083
- *
2084
- * ss.ss_ScanTupleSlot refers to output of underlying plan.
2085
- * ----------------
2086
- */
2087
- typedef struct MaterialState
2088
- {
2089
- ScanState ss; /* its first field is NodeTag */
2090
- int eflags; /* capability flags to pass to tuplestore */
2091
- bool eof_underlying; /* reached end of underlying plan? */
2092
- Tuplestorestate *tuplestorestate;
2093
- } MaterialState;
2094
-
2095
- struct MemoizeEntry;
2096
- struct MemoizeTuple;
2097
- struct MemoizeKey;
2098
-
2099
- typedef struct MemoizeInstrumentation
2100
- {
2101
- uint64 cache_hits; /* number of rescans where we've found the
2102
- * scan parameter values to be cached */
2103
- uint64 cache_misses; /* number of rescans where we've not found the
2104
- * scan parameter values to be cached. */
2105
- uint64 cache_evictions; /* number of cache entries removed due to
2106
- * the need to free memory */
2107
- uint64 cache_overflows; /* number of times we've had to bypass the
2108
- * cache when filling it due to not being
2109
- * able to free enough space to store the
2110
- * current scan's tuples. */
2111
- uint64 mem_peak; /* peak memory usage in bytes */
2112
- } MemoizeInstrumentation;
2113
-
2114
- /* ----------------
2115
- * Shared memory container for per-worker memoize information
2116
- * ----------------
2117
- */
2118
- typedef struct SharedMemoizeInfo
2119
- {
2120
- int num_workers;
2121
- MemoizeInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER];
2122
- } SharedMemoizeInfo;
2123
-
2124
- /* ----------------
2125
- * MemoizeState information
2126
- *
2127
- * memoize nodes are used to cache recent and commonly seen results from
2128
- * a parameterized scan.
2129
- * ----------------
2130
- */
2131
- typedef struct MemoizeState
2132
- {
2133
- ScanState ss; /* its first field is NodeTag */
2134
- int mstatus; /* value of ExecMemoize state machine */
2135
- int nkeys; /* number of cache keys */
2136
- struct memoize_hash *hashtable; /* hash table for cache entries */
2137
- TupleDesc hashkeydesc; /* tuple descriptor for cache keys */
2138
- TupleTableSlot *tableslot; /* min tuple slot for existing cache entries */
2139
- TupleTableSlot *probeslot; /* virtual slot used for hash lookups */
2140
- ExprState *cache_eq_expr; /* Compare exec params to hash key */
2141
- ExprState **param_exprs; /* exprs containing the parameters to this
2142
- * node */
2143
- FmgrInfo *hashfunctions; /* lookup data for hash funcs nkeys in size */
2144
- Oid *collations; /* collation for comparisons nkeys in size */
2145
- uint64 mem_used; /* bytes of memory used by cache */
2146
- uint64 mem_limit; /* memory limit in bytes for the cache */
2147
- MemoryContext tableContext; /* memory context to store cache data */
2148
- dlist_head lru_list; /* least recently used entry list */
2149
- struct MemoizeTuple *last_tuple; /* Used to point to the last tuple
2150
- * returned during a cache hit and the
2151
- * tuple we last stored when
2152
- * populating the cache. */
2153
- struct MemoizeEntry *entry; /* the entry that 'last_tuple' belongs to or
2154
- * NULL if 'last_tuple' is NULL. */
2155
- bool singlerow; /* true if the cache entry is to be marked as
2156
- * complete after caching the first tuple. */
2157
- bool binary_mode; /* true when cache key should be compared bit
2158
- * by bit, false when using hash equality ops */
2159
- MemoizeInstrumentation stats; /* execution statistics */
2160
- SharedMemoizeInfo *shared_info; /* statistics for parallel workers */
2161
- Bitmapset *keyparamids; /* Param->paramids of expressions belonging to
2162
- * param_exprs */
2163
- } MemoizeState;
2164
-
2165
- /* ----------------
2166
- * When performing sorting by multiple keys, it's possible that the input
2167
- * dataset is already sorted on a prefix of those keys. We call these
2168
- * "presorted keys".
2169
- * PresortedKeyData represents information about one such key.
2170
- * ----------------
2171
- */
2172
- typedef struct PresortedKeyData
2173
- {
2174
- FmgrInfo flinfo; /* comparison function info */
2175
- FunctionCallInfo fcinfo; /* comparison function call info */
2176
- OffsetNumber attno; /* attribute number in tuple */
2177
- } PresortedKeyData;
2178
-
2179
- /* ----------------
2180
- * Shared memory container for per-worker sort information
2181
- * ----------------
2182
- */
2183
- typedef struct SharedSortInfo
2184
- {
2185
- int num_workers;
2186
- TuplesortInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER];
2187
- } SharedSortInfo;
2188
-
2189
- /* ----------------
2190
- * SortState information
2191
- * ----------------
2192
- */
2193
- typedef struct SortState
2194
- {
2195
- ScanState ss; /* its first field is NodeTag */
2196
- bool randomAccess; /* need random access to sort output? */
2197
- bool bounded; /* is the result set bounded? */
2198
- int64 bound; /* if bounded, how many tuples are needed */
2199
- bool sort_Done; /* sort completed yet? */
2200
- bool bounded_Done; /* value of bounded we did the sort with */
2201
- int64 bound_Done; /* value of bound we did the sort with */
2202
- void *tuplesortstate; /* private state of tuplesort.c */
2203
- bool am_worker; /* are we a worker? */
2204
- bool datumSort; /* Datum sort instead of tuple sort? */
2205
- SharedSortInfo *shared_info; /* one entry per worker */
2206
- } SortState;
2207
-
2208
- /* ----------------
2209
- * Instrumentation information for IncrementalSort
2210
- * ----------------
2211
- */
2212
- typedef struct IncrementalSortGroupInfo
2213
- {
2214
- int64 groupCount;
2215
- int64 maxDiskSpaceUsed;
2216
- int64 totalDiskSpaceUsed;
2217
- int64 maxMemorySpaceUsed;
2218
- int64 totalMemorySpaceUsed;
2219
- bits32 sortMethods; /* bitmask of TuplesortMethod */
2220
- } IncrementalSortGroupInfo;
2221
-
2222
- typedef struct IncrementalSortInfo
2223
- {
2224
- IncrementalSortGroupInfo fullsortGroupInfo;
2225
- IncrementalSortGroupInfo prefixsortGroupInfo;
2226
- } IncrementalSortInfo;
2227
-
2228
- /* ----------------
2229
- * Shared memory container for per-worker incremental sort information
2230
- * ----------------
2231
- */
2232
- typedef struct SharedIncrementalSortInfo
2233
- {
2234
- int num_workers;
2235
- IncrementalSortInfo sinfo[FLEXIBLE_ARRAY_MEMBER];
2236
- } SharedIncrementalSortInfo;
2237
-
2238
- /* ----------------
2239
- * IncrementalSortState information
2240
- * ----------------
2241
- */
2242
- typedef enum
2243
- {
2244
- INCSORT_LOADFULLSORT,
2245
- INCSORT_LOADPREFIXSORT,
2246
- INCSORT_READFULLSORT,
2247
- INCSORT_READPREFIXSORT,
2248
- } IncrementalSortExecutionStatus;
2249
-
2250
- typedef struct IncrementalSortState
2251
- {
2252
- ScanState ss; /* its first field is NodeTag */
2253
- bool bounded; /* is the result set bounded? */
2254
- int64 bound; /* if bounded, how many tuples are needed */
2255
- bool outerNodeDone; /* finished fetching tuples from outer node */
2256
- int64 bound_Done; /* value of bound we did the sort with */
2257
- IncrementalSortExecutionStatus execution_status;
2258
- int64 n_fullsort_remaining;
2259
- Tuplesortstate *fullsort_state; /* private state of tuplesort.c */
2260
- Tuplesortstate *prefixsort_state; /* private state of tuplesort.c */
2261
- /* the keys by which the input path is already sorted */
2262
- PresortedKeyData *presorted_keys;
2263
-
2264
- IncrementalSortInfo incsort_info;
2265
-
2266
- /* slot for pivot tuple defining values of presorted keys within group */
2267
- TupleTableSlot *group_pivot;
2268
- TupleTableSlot *transfer_tuple;
2269
- bool am_worker; /* are we a worker? */
2270
- SharedIncrementalSortInfo *shared_info; /* one entry per worker */
2271
- } IncrementalSortState;
2272
-
2273
- /* ---------------------
2274
- * GroupState information
2275
- * ---------------------
2276
- */
2277
- typedef struct GroupState
2278
- {
2279
- ScanState ss; /* its first field is NodeTag */
2280
- ExprState *eqfunction; /* equality function */
2281
- bool grp_done; /* indicates completion of Group scan */
2282
- } GroupState;
2283
-
2284
- /* ---------------------
2285
- * per-worker aggregate information
2286
- * ---------------------
2287
- */
2288
- typedef struct AggregateInstrumentation
2289
- {
2290
- Size hash_mem_peak; /* peak hash table memory usage */
2291
- uint64 hash_disk_used; /* kB of disk space used */
2292
- int hash_batches_used; /* batches used during entire execution */
2293
- } AggregateInstrumentation;
2294
-
2295
- /* ----------------
2296
- * Shared memory container for per-worker aggregate information
2297
- * ----------------
2298
- */
2299
- typedef struct SharedAggInfo
2300
- {
2301
- int num_workers;
2302
- AggregateInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER];
2303
- } SharedAggInfo;
2304
-
2305
- /* ---------------------
2306
- * AggState information
2307
- *
2308
- * ss.ss_ScanTupleSlot refers to output of underlying plan.
2309
- *
2310
- * Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and
2311
- * ecxt_aggnulls arrays, which hold the computed agg values for the current
2312
- * input group during evaluation of an Agg node's output tuple(s). We
2313
- * create a second ExprContext, tmpcontext, in which to evaluate input
2314
- * expressions and run the aggregate transition functions.
2315
- * ---------------------
2316
- */
2317
- /* these structs are private in nodeAgg.c: */
2318
- typedef struct AggStatePerAggData *AggStatePerAgg;
2319
- typedef struct AggStatePerTransData *AggStatePerTrans;
2320
- typedef struct AggStatePerGroupData *AggStatePerGroup;
2321
- typedef struct AggStatePerPhaseData *AggStatePerPhase;
2322
- typedef struct AggStatePerHashData *AggStatePerHash;
2323
-
2324
- typedef struct AggState
2325
- {
2326
- ScanState ss; /* its first field is NodeTag */
2327
- List *aggs; /* all Aggref nodes in targetlist & quals */
2328
- int numaggs; /* length of list (could be zero!) */
2329
- int numtrans; /* number of pertrans items */
2330
- AggStrategy aggstrategy; /* strategy mode */
2331
- AggSplit aggsplit; /* agg-splitting mode, see nodes.h */
2332
- AggStatePerPhase phase; /* pointer to current phase data */
2333
- int numphases; /* number of phases (including phase 0) */
2334
- int current_phase; /* current phase number */
2335
- AggStatePerAgg peragg; /* per-Aggref information */
2336
- AggStatePerTrans pertrans; /* per-Trans state information */
2337
- ExprContext *hashcontext; /* econtexts for long-lived data (hashtable) */
2338
- ExprContext **aggcontexts; /* econtexts for long-lived data (per GS) */
2339
- ExprContext *tmpcontext; /* econtext for input expressions */
2340
- #define FIELDNO_AGGSTATE_CURAGGCONTEXT 14
2341
- ExprContext *curaggcontext; /* currently active aggcontext */
2342
- AggStatePerAgg curperagg; /* currently active aggregate, if any */
2343
- #define FIELDNO_AGGSTATE_CURPERTRANS 16
2344
- AggStatePerTrans curpertrans; /* currently active trans state, if any */
2345
- bool input_done; /* indicates end of input */
2346
- bool agg_done; /* indicates completion of Agg scan */
2347
- int projected_set; /* The last projected grouping set */
2348
- #define FIELDNO_AGGSTATE_CURRENT_SET 20
2349
- int current_set; /* The current grouping set being evaluated */
2350
- Bitmapset *grouped_cols; /* grouped cols in current projection */
2351
- List *all_grouped_cols; /* list of all grouped cols in DESC order */
2352
- Bitmapset *colnos_needed; /* all columns needed from the outer plan */
2353
- int max_colno_needed; /* highest colno needed from outer plan */
2354
- bool all_cols_needed; /* are all cols from outer plan needed? */
2355
- /* These fields are for grouping set phase data */
2356
- int maxsets; /* The max number of sets in any phase */
2357
- AggStatePerPhase phases; /* array of all phases */
2358
- Tuplesortstate *sort_in; /* sorted input to phases > 1 */
2359
- Tuplesortstate *sort_out; /* input is copied here for next phase */
2360
- TupleTableSlot *sort_slot; /* slot for sort results */
2361
- /* these fields are used in AGG_PLAIN and AGG_SORTED modes: */
2362
- AggStatePerGroup *pergroups; /* grouping set indexed array of per-group
2363
- * pointers */
2364
- HeapTuple grp_firstTuple; /* copy of first tuple of current group */
2365
- /* these fields are used in AGG_HASHED and AGG_MIXED modes: */
2366
- bool table_filled; /* hash table filled yet? */
2367
- int num_hashes;
2368
- MemoryContext hash_metacxt; /* memory for hash table itself */
2369
- struct LogicalTapeSet *hash_tapeset; /* tape set for hash spill tapes */
2370
- struct HashAggSpill *hash_spills; /* HashAggSpill for each grouping set,
2371
- * exists only during first pass */
2372
- TupleTableSlot *hash_spill_rslot; /* for reading spill files */
2373
- TupleTableSlot *hash_spill_wslot; /* for writing spill files */
2374
- List *hash_batches; /* hash batches remaining to be processed */
2375
- bool hash_ever_spilled; /* ever spilled during this execution? */
2376
- bool hash_spill_mode; /* we hit a limit during the current batch
2377
- * and we must not create new groups */
2378
- Size hash_mem_limit; /* limit before spilling hash table */
2379
- uint64 hash_ngroups_limit; /* limit before spilling hash table */
2380
- int hash_planned_partitions; /* number of partitions planned
2381
- * for first pass */
2382
- double hashentrysize; /* estimate revised during execution */
2383
- Size hash_mem_peak; /* peak hash table memory usage */
2384
- uint64 hash_ngroups_current; /* number of groups currently in
2385
- * memory in all hash tables */
2386
- uint64 hash_disk_used; /* kB of disk space used */
2387
- int hash_batches_used; /* batches used during entire execution */
2388
-
2389
- AggStatePerHash perhash; /* array of per-hashtable data */
2390
- AggStatePerGroup *hash_pergroup; /* grouping set indexed array of
2391
- * per-group pointers */
2392
-
2393
- /* support for evaluation of agg input expressions: */
2394
- #define FIELDNO_AGGSTATE_ALL_PERGROUPS 53
2395
- AggStatePerGroup *all_pergroups; /* array of first ->pergroups, than
2396
- * ->hash_pergroup */
2397
- ProjectionInfo *combinedproj; /* projection machinery */
2398
- SharedAggInfo *shared_info; /* one entry per worker */
2399
- } AggState;
2400
-
2401
- /* ----------------
2402
- * WindowAggState information
2403
- * ----------------
2404
- */
2405
- /* these structs are private in nodeWindowAgg.c: */
2406
- typedef struct WindowStatePerFuncData *WindowStatePerFunc;
2407
- typedef struct WindowStatePerAggData *WindowStatePerAgg;
2408
-
2409
- /*
2410
- * WindowAggStatus -- Used to track the status of WindowAggState
2411
- */
2412
- typedef enum WindowAggStatus
2413
- {
2414
- WINDOWAGG_DONE, /* No more processing to do */
2415
- WINDOWAGG_RUN, /* Normal processing of window funcs */
2416
- WINDOWAGG_PASSTHROUGH, /* Don't eval window funcs */
2417
- WINDOWAGG_PASSTHROUGH_STRICT /* Pass-through plus don't store new
2418
- * tuples during spool */
2419
- } WindowAggStatus;
2420
-
2421
- typedef struct WindowAggState
2422
- {
2423
- ScanState ss; /* its first field is NodeTag */
2424
-
2425
- /* these fields are filled in by ExecInitExpr: */
2426
- List *funcs; /* all WindowFunc nodes in targetlist */
2427
- int numfuncs; /* total number of window functions */
2428
- int numaggs; /* number that are plain aggregates */
2429
-
2430
- WindowStatePerFunc perfunc; /* per-window-function information */
2431
- WindowStatePerAgg peragg; /* per-plain-aggregate information */
2432
- ExprState *partEqfunction; /* equality funcs for partition columns */
2433
- ExprState *ordEqfunction; /* equality funcs for ordering columns */
2434
- Tuplestorestate *buffer; /* stores rows of current partition */
2435
- int current_ptr; /* read pointer # for current row */
2436
- int framehead_ptr; /* read pointer # for frame head, if used */
2437
- int frametail_ptr; /* read pointer # for frame tail, if used */
2438
- int grouptail_ptr; /* read pointer # for group tail, if used */
2439
- int64 spooled_rows; /* total # of rows in buffer */
2440
- int64 currentpos; /* position of current row in partition */
2441
- int64 frameheadpos; /* current frame head position */
2442
- int64 frametailpos; /* current frame tail position (frame end+1) */
2443
- /* use struct pointer to avoid including windowapi.h here */
2444
- struct WindowObjectData *agg_winobj; /* winobj for aggregate fetches */
2445
- int64 aggregatedbase; /* start row for current aggregates */
2446
- int64 aggregatedupto; /* rows before this one are aggregated */
2447
- WindowAggStatus status; /* run status of WindowAggState */
2448
-
2449
- int frameOptions; /* frame_clause options, see WindowDef */
2450
- ExprState *startOffset; /* expression for starting bound offset */
2451
- ExprState *endOffset; /* expression for ending bound offset */
2452
- Datum startOffsetValue; /* result of startOffset evaluation */
2453
- Datum endOffsetValue; /* result of endOffset evaluation */
2454
-
2455
- /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */
2456
- FmgrInfo startInRangeFunc; /* in_range function for startOffset */
2457
- FmgrInfo endInRangeFunc; /* in_range function for endOffset */
2458
- Oid inRangeColl; /* collation for in_range tests */
2459
- bool inRangeAsc; /* use ASC sort order for in_range tests? */
2460
- bool inRangeNullsFirst; /* nulls sort first for in_range tests? */
2461
-
2462
- /* these fields are used in GROUPS mode: */
2463
- int64 currentgroup; /* peer group # of current row in partition */
2464
- int64 frameheadgroup; /* peer group # of frame head row */
2465
- int64 frametailgroup; /* peer group # of frame tail row */
2466
- int64 groupheadpos; /* current row's peer group head position */
2467
- int64 grouptailpos; /* " " " " tail position (group end+1) */
2468
-
2469
- MemoryContext partcontext; /* context for partition-lifespan data */
2470
- MemoryContext aggcontext; /* shared context for aggregate working data */
2471
- MemoryContext curaggcontext; /* current aggregate's working data */
2472
- ExprContext *tmpcontext; /* short-term evaluation context */
2473
-
2474
- ExprState *runcondition; /* Condition which must remain true otherwise
2475
- * execution of the WindowAgg will finish or
2476
- * go into pass-through mode. NULL when there
2477
- * is no such condition. */
2478
-
2479
- bool use_pass_through; /* When false, stop execution when
2480
- * runcondition is no longer true. Else
2481
- * just stop evaluating window funcs. */
2482
- bool top_window; /* true if this is the top-most WindowAgg or
2483
- * the only WindowAgg in this query level */
2484
- bool all_first; /* true if the scan is starting */
2485
- bool partition_spooled; /* true if all tuples in current partition
2486
- * have been spooled into tuplestore */
2487
- bool more_partitions; /* true if there's more partitions after
2488
- * this one */
2489
- bool framehead_valid; /* true if frameheadpos is known up to
2490
- * date for current row */
2491
- bool frametail_valid; /* true if frametailpos is known up to
2492
- * date for current row */
2493
- bool grouptail_valid; /* true if grouptailpos is known up to
2494
- * date for current row */
2495
-
2496
- TupleTableSlot *first_part_slot; /* first tuple of current or next
2497
- * partition */
2498
- TupleTableSlot *framehead_slot; /* first tuple of current frame */
2499
- TupleTableSlot *frametail_slot; /* first tuple after current frame */
2500
-
2501
- /* temporary slots for tuples fetched back from tuplestore */
2502
- TupleTableSlot *agg_row_slot;
2503
- TupleTableSlot *temp_slot_1;
2504
- TupleTableSlot *temp_slot_2;
2505
- } WindowAggState;
2506
-
2507
- /* ----------------
2508
- * UniqueState information
2509
- *
2510
- * Unique nodes are used "on top of" sort nodes to discard
2511
- * duplicate tuples returned from the sort phase. Basically
2512
- * all it does is compare the current tuple from the subplan
2513
- * with the previously fetched tuple (stored in its result slot).
2514
- * If the two are identical in all interesting fields, then
2515
- * we just fetch another tuple from the sort and try again.
2516
- * ----------------
2517
- */
2518
- typedef struct UniqueState
2519
- {
2520
- PlanState ps; /* its first field is NodeTag */
2521
- ExprState *eqfunction; /* tuple equality qual */
2522
- } UniqueState;
2523
-
2524
- /* ----------------
2525
- * GatherState information
2526
- *
2527
- * Gather nodes launch 1 or more parallel workers, run a subplan
2528
- * in those workers, and collect the results.
2529
- * ----------------
2530
- */
2531
- typedef struct GatherState
2532
- {
2533
- PlanState ps; /* its first field is NodeTag */
2534
- bool initialized; /* workers launched? */
2535
- bool need_to_scan_locally; /* need to read from local plan? */
2536
- int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */
2537
- /* these fields are set up once: */
2538
- TupleTableSlot *funnel_slot;
2539
- struct ParallelExecutorInfo *pei;
2540
- /* all remaining fields are reinitialized during a rescan: */
2541
- int nworkers_launched; /* original number of workers */
2542
- int nreaders; /* number of still-active workers */
2543
- int nextreader; /* next one to try to read from */
2544
- struct TupleQueueReader **reader; /* array with nreaders active entries */
2545
- } GatherState;
2546
-
2547
- /* ----------------
2548
- * GatherMergeState information
2549
- *
2550
- * Gather merge nodes launch 1 or more parallel workers, run a
2551
- * subplan which produces sorted output in each worker, and then
2552
- * merge the results into a single sorted stream.
2553
- * ----------------
2554
- */
2555
- struct GMReaderTupleBuffer; /* private in nodeGatherMerge.c */
2556
-
2557
- typedef struct GatherMergeState
2558
- {
2559
- PlanState ps; /* its first field is NodeTag */
2560
- bool initialized; /* workers launched? */
2561
- bool gm_initialized; /* gather_merge_init() done? */
2562
- bool need_to_scan_locally; /* need to read from local plan? */
2563
- int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */
2564
- /* these fields are set up once: */
2565
- TupleDesc tupDesc; /* descriptor for subplan result tuples */
2566
- int gm_nkeys; /* number of sort columns */
2567
- SortSupport gm_sortkeys; /* array of length gm_nkeys */
2568
- struct ParallelExecutorInfo *pei;
2569
- /* all remaining fields are reinitialized during a rescan */
2570
- /* (but the arrays are not reallocated, just cleared) */
2571
- int nworkers_launched; /* original number of workers */
2572
- int nreaders; /* number of active workers */
2573
- TupleTableSlot **gm_slots; /* array with nreaders+1 entries */
2574
- struct TupleQueueReader **reader; /* array with nreaders active entries */
2575
- struct GMReaderTupleBuffer *gm_tuple_buffers; /* nreaders tuple buffers */
2576
- struct binaryheap *gm_heap; /* binary heap of slot indices */
2577
- } GatherMergeState;
2578
-
2579
- /* ----------------
2580
- * Values displayed by EXPLAIN ANALYZE
2581
- * ----------------
2582
- */
2583
- typedef struct HashInstrumentation
2584
- {
2585
- int nbuckets; /* number of buckets at end of execution */
2586
- int nbuckets_original; /* planned number of buckets */
2587
- int nbatch; /* number of batches at end of execution */
2588
- int nbatch_original; /* planned number of batches */
2589
- Size space_peak; /* peak memory usage in bytes */
2590
- } HashInstrumentation;
2591
-
2592
- /* ----------------
2593
- * Shared memory container for per-worker hash information
2594
- * ----------------
2595
- */
2596
- typedef struct SharedHashInfo
2597
- {
2598
- int num_workers;
2599
- HashInstrumentation hinstrument[FLEXIBLE_ARRAY_MEMBER];
2600
- } SharedHashInfo;
2601
-
2602
- /* ----------------
2603
- * HashState information
2604
- * ----------------
2605
- */
2606
- typedef struct HashState
2607
- {
2608
- PlanState ps; /* its first field is NodeTag */
2609
- HashJoinTable hashtable; /* hash table for the hashjoin */
2610
- List *hashkeys; /* list of ExprState nodes */
2611
-
2612
- /*
2613
- * In a parallelized hash join, the leader retains a pointer to the
2614
- * shared-memory stats area in its shared_info field, and then copies the
2615
- * shared-memory info back to local storage before DSM shutdown. The
2616
- * shared_info field remains NULL in workers, or in non-parallel joins.
2617
- */
2618
- SharedHashInfo *shared_info;
2619
-
2620
- /*
2621
- * If we are collecting hash stats, this points to an initially-zeroed
2622
- * collection area, which could be either local storage or in shared
2623
- * memory; either way it's for just one process.
2624
- */
2625
- HashInstrumentation *hinstrument;
2626
-
2627
- /* Parallel hash state. */
2628
- struct ParallelHashJoinState *parallel_state;
2629
- } HashState;
2630
-
2631
- /* ----------------
2632
- * SetOpState information
2633
- *
2634
- * Even in "sorted" mode, SetOp nodes are more complex than a simple
2635
- * Unique, since we have to count how many duplicates to return. But
2636
- * we also support hashing, so this is really more like a cut-down
2637
- * form of Agg.
2638
- * ----------------
2639
- */
2640
- /* this struct is private in nodeSetOp.c: */
2641
- typedef struct SetOpStatePerGroupData *SetOpStatePerGroup;
2642
-
2643
- typedef struct SetOpState
2644
- {
2645
- PlanState ps; /* its first field is NodeTag */
2646
- ExprState *eqfunction; /* equality comparator */
2647
- Oid *eqfuncoids; /* per-grouping-field equality fns */
2648
- FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
2649
- bool setop_done; /* indicates completion of output scan */
2650
- long numOutput; /* number of dups left to output */
2651
- /* these fields are used in SETOP_SORTED mode: */
2652
- SetOpStatePerGroup pergroup; /* per-group working state */
2653
- HeapTuple grp_firstTuple; /* copy of first tuple of current group */
2654
- /* these fields are used in SETOP_HASHED mode: */
2655
- TupleHashTable hashtable; /* hash table with one entry per group */
2656
- MemoryContext tableContext; /* memory context containing hash table */
2657
- bool table_filled; /* hash table filled yet? */
2658
- TupleHashIterator hashiter; /* for iterating through hash table */
2659
- } SetOpState;
2660
-
2661
- /* ----------------
2662
- * LockRowsState information
2663
- *
2664
- * LockRows nodes are used to enforce FOR [KEY] UPDATE/SHARE locking.
2665
- * ----------------
2666
- */
2667
- typedef struct LockRowsState
2668
- {
2669
- PlanState ps; /* its first field is NodeTag */
2670
- List *lr_arowMarks; /* List of ExecAuxRowMarks */
2671
- EPQState lr_epqstate; /* for evaluating EvalPlanQual rechecks */
2672
- } LockRowsState;
2673
-
2674
- /* ----------------
2675
- * LimitState information
2676
- *
2677
- * Limit nodes are used to enforce LIMIT/OFFSET clauses.
2678
- * They just select the desired subrange of their subplan's output.
2679
- *
2680
- * offset is the number of initial tuples to skip (0 does nothing).
2681
- * count is the number of tuples to return after skipping the offset tuples.
2682
- * If no limit count was specified, count is undefined and noCount is true.
2683
- * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet.
2684
- * ----------------
2685
- */
2686
- typedef enum
2687
- {
2688
- LIMIT_INITIAL, /* initial state for LIMIT node */
2689
- LIMIT_RESCAN, /* rescan after recomputing parameters */
2690
- LIMIT_EMPTY, /* there are no returnable rows */
2691
- LIMIT_INWINDOW, /* have returned a row in the window */
2692
- LIMIT_WINDOWEND_TIES, /* have returned a tied row */
2693
- LIMIT_SUBPLANEOF, /* at EOF of subplan (within window) */
2694
- LIMIT_WINDOWEND, /* stepped off end of window */
2695
- LIMIT_WINDOWSTART /* stepped off beginning of window */
2696
- } LimitStateCond;
2697
-
2698
- typedef struct LimitState
2699
- {
2700
- PlanState ps; /* its first field is NodeTag */
2701
- ExprState *limitOffset; /* OFFSET parameter, or NULL if none */
2702
- ExprState *limitCount; /* COUNT parameter, or NULL if none */
2703
- LimitOption limitOption; /* limit specification type */
2704
- int64 offset; /* current OFFSET value */
2705
- int64 count; /* current COUNT, if any */
2706
- bool noCount; /* if true, ignore count */
2707
- LimitStateCond lstate; /* state machine status, as above */
2708
- int64 position; /* 1-based index of last tuple returned */
2709
- TupleTableSlot *subSlot; /* tuple last obtained from subplan */
2710
- ExprState *eqfunction; /* tuple equality qual in case of WITH TIES
2711
- * option */
2712
- TupleTableSlot *last_slot; /* slot for evaluation of ties */
2713
- } LimitState;
2714
-
2715
- #endif /* EXECNODES_H */