pg_query 5.0.0 → 6.0.0

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