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