pg_query 5.1.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (490) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/README.md +1 -1
  4. data/Rakefile +4 -4
  5. data/ext/pg_query/ext_symbols_freebsd.sym +1 -0
  6. data/ext/pg_query/ext_symbols_freebsd_with_ruby_abi_version.sym +2 -0
  7. data/ext/pg_query/ext_symbols_openbsd.sym +1 -0
  8. data/ext/pg_query/ext_symbols_openbsd_with_ruby_abi_version.sym +2 -0
  9. data/ext/pg_query/ext_symbols_with_ruby_abi_version.sym +2 -0
  10. data/ext/pg_query/extconf.rb +20 -6
  11. data/ext/pg_query/include/pg_query.h +4 -3
  12. data/ext/pg_query/include/pg_query_enum_defs.c +424 -154
  13. data/ext/pg_query/include/pg_query_fingerprint_conds.c +68 -4
  14. data/ext/pg_query/include/pg_query_fingerprint_defs.c +2952 -1845
  15. data/ext/pg_query/include/pg_query_outfuncs_conds.c +51 -3
  16. data/ext/pg_query/include/pg_query_outfuncs_defs.c +210 -23
  17. data/ext/pg_query/include/pg_query_readfuncs_conds.c +17 -1
  18. data/ext/pg_query/include/pg_query_readfuncs_defs.c +271 -52
  19. data/ext/pg_query/include/postgres/access/amapi.h +14 -3
  20. data/ext/pg_query/include/postgres/access/attmap.h +1 -1
  21. data/ext/pg_query/include/postgres/access/attnum.h +1 -1
  22. data/ext/pg_query/include/postgres/access/brin_internal.h +116 -0
  23. data/ext/pg_query/include/postgres/access/brin_tuple.h +112 -0
  24. data/ext/pg_query/include/postgres/access/clog.h +2 -3
  25. data/ext/pg_query/include/postgres/access/commit_ts.h +2 -3
  26. data/ext/pg_query/include/postgres/access/detoast.h +1 -1
  27. data/ext/pg_query/include/postgres/access/genam.h +17 -4
  28. data/ext/pg_query/include/postgres/access/gin.h +1 -1
  29. data/ext/pg_query/include/postgres/access/htup.h +1 -1
  30. data/ext/pg_query/include/postgres/access/htup_details.h +11 -11
  31. data/ext/pg_query/include/postgres/access/itup.h +3 -3
  32. data/ext/pg_query/include/postgres/access/parallel.h +1 -2
  33. data/ext/pg_query/include/postgres/access/printtup.h +1 -1
  34. data/ext/pg_query/include/postgres/access/relation.h +1 -1
  35. data/ext/pg_query/include/postgres/access/relscan.h +1 -1
  36. data/ext/pg_query/include/postgres/access/rmgrlist.h +1 -1
  37. data/ext/pg_query/include/postgres/access/sdir.h +1 -1
  38. data/ext/pg_query/include/postgres/access/skey.h +1 -1
  39. data/ext/pg_query/include/postgres/access/slru.h +218 -0
  40. data/ext/pg_query/include/postgres/access/stratnum.h +1 -1
  41. data/ext/pg_query/include/postgres/access/sysattr.h +1 -1
  42. data/ext/pg_query/include/postgres/access/table.h +1 -1
  43. data/ext/pg_query/include/postgres/access/tableam.h +35 -25
  44. data/ext/pg_query/include/postgres/access/tidstore.h +50 -0
  45. data/ext/pg_query/include/postgres/access/toast_compression.h +2 -2
  46. data/ext/pg_query/include/postgres/access/transam.h +50 -7
  47. data/ext/pg_query/include/postgres/access/tsmapi.h +1 -1
  48. data/ext/pg_query/include/postgres/access/tupconvert.h +1 -1
  49. data/ext/pg_query/include/postgres/access/tupdesc.h +5 -5
  50. data/ext/pg_query/include/postgres/access/tupmacs.h +1 -1
  51. data/ext/pg_query/include/postgres/access/twophase.h +2 -2
  52. data/ext/pg_query/include/postgres/access/xact.h +5 -5
  53. data/ext/pg_query/include/postgres/access/xlog.h +20 -12
  54. data/ext/pg_query/include/postgres/access/xlog_internal.h +4 -3
  55. data/ext/pg_query/include/postgres/access/xlogbackup.h +3 -1
  56. data/ext/pg_query/include/postgres/access/xlogdefs.h +5 -5
  57. data/ext/pg_query/include/postgres/access/xlogprefetcher.h +2 -2
  58. data/ext/pg_query/include/postgres/access/xlogreader.h +2 -2
  59. data/ext/pg_query/include/postgres/access/xlogrecord.h +3 -3
  60. data/ext/pg_query/include/postgres/access/xlogrecovery.h +4 -4
  61. data/ext/pg_query/include/postgres/archive/archive_module.h +9 -1
  62. data/ext/pg_query/include/postgres/c.h +32 -37
  63. data/ext/pg_query/include/postgres/catalog/catalog.h +3 -1
  64. data/ext/pg_query/include/postgres/catalog/catversion.h +2 -2
  65. data/ext/pg_query/include/postgres/catalog/dependency.h +17 -59
  66. data/ext/pg_query/include/postgres/catalog/genbki.h +12 -6
  67. data/ext/pg_query/include/postgres/catalog/index.h +22 -18
  68. data/ext/pg_query/include/postgres/catalog/indexing.h +1 -1
  69. data/ext/pg_query/include/postgres/catalog/namespace.h +18 -19
  70. data/ext/pg_query/include/postgres/catalog/objectaccess.h +2 -2
  71. data/ext/pg_query/include/postgres/catalog/objectaddress.h +5 -1
  72. data/ext/pg_query/include/postgres/catalog/pg_aggregate.h +4 -2
  73. data/ext/pg_query/include/postgres/catalog/pg_aggregate_d.h +1 -1
  74. data/ext/pg_query/include/postgres/catalog/pg_am.h +6 -3
  75. data/ext/pg_query/include/postgres/catalog/pg_am_d.h +1 -1
  76. data/ext/pg_query/include/postgres/catalog/pg_attribute.h +31 -14
  77. data/ext/pg_query/include/postgres/catalog/pg_attribute_d.h +3 -3
  78. data/ext/pg_query/include/postgres/catalog/pg_authid.h +6 -3
  79. data/ext/pg_query/include/postgres/catalog/pg_authid_d.h +2 -1
  80. data/ext/pg_query/include/postgres/catalog/pg_class.h +10 -5
  81. data/ext/pg_query/include/postgres/catalog/pg_class_d.h +4 -2
  82. data/ext/pg_query/include/postgres/catalog/pg_collation.h +11 -5
  83. data/ext/pg_query/include/postgres/catalog/pg_collation_d.h +5 -2
  84. data/ext/pg_query/include/postgres/catalog/pg_constraint.h +15 -10
  85. data/ext/pg_query/include/postgres/catalog/pg_constraint_d.h +2 -1
  86. data/ext/pg_query/include/postgres/catalog/pg_control.h +5 -3
  87. data/ext/pg_query/include/postgres/catalog/pg_conversion.h +8 -4
  88. data/ext/pg_query/include/postgres/catalog/pg_conversion_d.h +1 -1
  89. data/ext/pg_query/include/postgres/catalog/pg_database.h +9 -4
  90. data/ext/pg_query/include/postgres/catalog/pg_database_d.h +13 -12
  91. data/ext/pg_query/include/postgres/catalog/pg_depend.h +3 -3
  92. data/ext/pg_query/include/postgres/catalog/pg_depend_d.h +1 -1
  93. data/ext/pg_query/include/postgres/catalog/pg_event_trigger.h +6 -3
  94. data/ext/pg_query/include/postgres/catalog/pg_event_trigger_d.h +1 -1
  95. data/ext/pg_query/include/postgres/catalog/pg_index.h +5 -3
  96. data/ext/pg_query/include/postgres/catalog/pg_index_d.h +1 -1
  97. data/ext/pg_query/include/postgres/catalog/pg_language.h +6 -3
  98. data/ext/pg_query/include/postgres/catalog/pg_language_d.h +1 -1
  99. data/ext/pg_query/include/postgres/catalog/pg_namespace.h +6 -3
  100. data/ext/pg_query/include/postgres/catalog/pg_namespace_d.h +1 -1
  101. data/ext/pg_query/include/postgres/catalog/pg_opclass.h +6 -3
  102. data/ext/pg_query/include/postgres/catalog/pg_opclass_d.h +1 -1
  103. data/ext/pg_query/include/postgres/catalog/pg_operator.h +20 -3
  104. data/ext/pg_query/include/postgres/catalog/pg_operator_d.h +1 -1
  105. data/ext/pg_query/include/postgres/catalog/pg_opfamily.h +6 -3
  106. data/ext/pg_query/include/postgres/catalog/pg_opfamily_d.h +1 -1
  107. data/ext/pg_query/include/postgres/catalog/pg_partitioned_table.h +4 -2
  108. data/ext/pg_query/include/postgres/catalog/pg_partitioned_table_d.h +1 -1
  109. data/ext/pg_query/include/postgres/catalog/pg_proc.h +6 -3
  110. data/ext/pg_query/include/postgres/catalog/pg_proc_d.h +1 -1
  111. data/ext/pg_query/include/postgres/catalog/pg_publication.h +6 -3
  112. data/ext/pg_query/include/postgres/catalog/pg_publication_d.h +1 -1
  113. data/ext/pg_query/include/postgres/catalog/pg_replication_origin.h +6 -3
  114. data/ext/pg_query/include/postgres/catalog/pg_replication_origin_d.h +1 -1
  115. data/ext/pg_query/include/postgres/catalog/pg_statistic.h +10 -4
  116. data/ext/pg_query/include/postgres/catalog/pg_statistic_d.h +7 -3
  117. data/ext/pg_query/include/postgres/catalog/pg_statistic_ext.h +10 -7
  118. data/ext/pg_query/include/postgres/catalog/pg_statistic_ext_d.h +3 -3
  119. data/ext/pg_query/include/postgres/catalog/pg_transform.h +6 -3
  120. data/ext/pg_query/include/postgres/catalog/pg_transform_d.h +1 -1
  121. data/ext/pg_query/include/postgres/catalog/pg_trigger.h +4 -4
  122. data/ext/pg_query/include/postgres/catalog/pg_trigger_d.h +1 -1
  123. data/ext/pg_query/include/postgres/catalog/pg_ts_config.h +6 -3
  124. data/ext/pg_query/include/postgres/catalog/pg_ts_config_d.h +1 -1
  125. data/ext/pg_query/include/postgres/catalog/pg_ts_dict.h +6 -3
  126. data/ext/pg_query/include/postgres/catalog/pg_ts_dict_d.h +1 -1
  127. data/ext/pg_query/include/postgres/catalog/pg_ts_parser.h +6 -3
  128. data/ext/pg_query/include/postgres/catalog/pg_ts_parser_d.h +1 -1
  129. data/ext/pg_query/include/postgres/catalog/pg_ts_template.h +6 -3
  130. data/ext/pg_query/include/postgres/catalog/pg_ts_template_d.h +1 -1
  131. data/ext/pg_query/include/postgres/catalog/pg_type.h +6 -3
  132. data/ext/pg_query/include/postgres/catalog/pg_type_d.h +1 -1
  133. data/ext/pg_query/include/postgres/catalog/storage.h +1 -1
  134. data/ext/pg_query/include/postgres/catalog/syscache_ids.h +104 -0
  135. data/ext/pg_query/include/postgres/commands/async.h +2 -6
  136. data/ext/pg_query/include/postgres/commands/dbcommands.h +1 -1
  137. data/ext/pg_query/include/postgres/commands/defrem.h +6 -6
  138. data/ext/pg_query/include/postgres/commands/event_trigger.h +11 -2
  139. data/ext/pg_query/include/postgres/commands/explain.h +19 -3
  140. data/ext/pg_query/include/postgres/commands/prepare.h +1 -1
  141. data/ext/pg_query/include/postgres/commands/tablespace.h +1 -1
  142. data/ext/pg_query/include/postgres/commands/trigger.h +1 -1
  143. data/ext/pg_query/include/postgres/commands/vacuum.h +28 -26
  144. data/ext/pg_query/include/postgres/common/cryptohash.h +2 -2
  145. data/ext/pg_query/include/postgres/common/file_perm.h +1 -1
  146. data/ext/pg_query/include/postgres/common/file_utils.h +65 -0
  147. data/ext/pg_query/include/postgres/common/hashfn.h +16 -1
  148. data/ext/pg_query/include/postgres/common/hashfn_unstable.h +407 -0
  149. data/ext/pg_query/include/postgres/common/int.h +79 -4
  150. data/ext/pg_query/include/postgres/common/keywords.h +1 -1
  151. data/ext/pg_query/include/postgres/common/kwlookup.h +1 -1
  152. data/ext/pg_query/include/postgres/common/pg_prng.h +2 -1
  153. data/ext/pg_query/include/postgres/common/relpath.h +4 -4
  154. data/ext/pg_query/include/postgres/common/scram-common.h +1 -1
  155. data/ext/pg_query/include/postgres/common/sha2.h +1 -1
  156. data/ext/pg_query/include/postgres/common/string.h +1 -1
  157. data/ext/pg_query/include/postgres/common/unicode_east_asian_fw_table.h +2 -3
  158. data/ext/pg_query/include/postgres/copyfuncs.funcs.c +278 -30
  159. data/ext/pg_query/include/postgres/copyfuncs.switch.c +55 -4
  160. data/ext/pg_query/include/postgres/datatype/timestamp.h +29 -3
  161. data/ext/pg_query/include/postgres/equalfuncs.funcs.c +239 -26
  162. data/ext/pg_query/include/postgres/equalfuncs.switch.c +55 -4
  163. data/ext/pg_query/include/postgres/executor/execdesc.h +2 -2
  164. data/ext/pg_query/include/postgres/executor/executor.h +6 -5
  165. data/ext/pg_query/include/postgres/executor/functions.h +2 -1
  166. data/ext/pg_query/include/postgres/executor/instrument.h +5 -3
  167. data/ext/pg_query/include/postgres/executor/spi.h +2 -8
  168. data/ext/pg_query/include/postgres/executor/tablefunc.h +1 -1
  169. data/ext/pg_query/include/postgres/executor/tuptable.h +31 -2
  170. data/ext/pg_query/include/postgres/fmgr.h +2 -2
  171. data/ext/pg_query/include/postgres/foreign/fdwapi.h +1 -1
  172. data/ext/pg_query/include/postgres/funcapi.h +2 -2
  173. data/ext/pg_query/include/postgres/gram.h +871 -830
  174. data/ext/pg_query/include/postgres/gramparse.h +1 -1
  175. data/ext/pg_query/include/postgres/jit/jit.h +4 -3
  176. data/ext/pg_query/include/postgres/kwlist_d.h +511 -466
  177. data/ext/pg_query/include/postgres/lib/dshash.h +25 -10
  178. data/ext/pg_query/include/postgres/lib/ilist.h +1 -1
  179. data/ext/pg_query/include/postgres/lib/pairingheap.h +1 -1
  180. data/ext/pg_query/include/postgres/lib/simplehash.h +40 -18
  181. data/ext/pg_query/include/postgres/lib/sort_template.h +14 -1
  182. data/ext/pg_query/include/postgres/lib/stringinfo.h +93 -11
  183. data/ext/pg_query/include/postgres/libpq/auth.h +1 -1
  184. data/ext/pg_query/include/postgres/libpq/crypt.h +2 -2
  185. data/ext/pg_query/include/postgres/libpq/hba.h +4 -4
  186. data/ext/pg_query/include/postgres/libpq/libpq-be.h +35 -28
  187. data/ext/pg_query/include/postgres/libpq/libpq.h +6 -7
  188. data/ext/pg_query/include/postgres/libpq/pqcomm.h +26 -20
  189. data/ext/pg_query/include/postgres/libpq/pqformat.h +2 -3
  190. data/ext/pg_query/include/postgres/libpq/pqsignal.h +1 -1
  191. data/ext/pg_query/include/postgres/libpq/protocol.h +89 -0
  192. data/ext/pg_query/include/postgres/libpq/sasl.h +1 -1
  193. data/ext/pg_query/include/postgres/libpq/scram.h +1 -1
  194. data/ext/pg_query/include/postgres/mb/pg_wchar.h +103 -82
  195. data/ext/pg_query/include/postgres/mb/stringinfo_mb.h +1 -1
  196. data/ext/pg_query/include/postgres/miscadmin.h +72 -52
  197. data/ext/pg_query/include/postgres/nodes/bitmapset.h +17 -3
  198. data/ext/pg_query/include/postgres/nodes/execnodes.h +112 -25
  199. data/ext/pg_query/include/postgres/nodes/extensible.h +1 -1
  200. data/ext/pg_query/include/postgres/nodes/lockoptions.h +4 -4
  201. data/ext/pg_query/include/postgres/nodes/makefuncs.h +8 -2
  202. data/ext/pg_query/include/postgres/nodes/memnodes.h +43 -4
  203. data/ext/pg_query/include/postgres/nodes/miscnodes.h +1 -1
  204. data/ext/pg_query/include/postgres/nodes/nodeFuncs.h +1 -1
  205. data/ext/pg_query/include/postgres/nodes/nodes.h +30 -41
  206. data/ext/pg_query/include/postgres/nodes/nodetags.h +464 -444
  207. data/ext/pg_query/include/postgres/nodes/params.h +1 -1
  208. data/ext/pg_query/include/postgres/nodes/parsenodes.h +358 -175
  209. data/ext/pg_query/include/postgres/nodes/pathnodes.h +64 -10
  210. data/ext/pg_query/include/postgres/nodes/pg_list.h +62 -11
  211. data/ext/pg_query/include/postgres/nodes/plannodes.h +11 -10
  212. data/ext/pg_query/include/postgres/nodes/primnodes.h +352 -54
  213. data/ext/pg_query/include/postgres/nodes/print.h +1 -1
  214. data/ext/pg_query/include/postgres/nodes/queryjumble.h +2 -2
  215. data/ext/pg_query/include/postgres/nodes/replnodes.h +23 -2
  216. data/ext/pg_query/include/postgres/nodes/supportnodes.h +1 -1
  217. data/ext/pg_query/include/postgres/nodes/tidbitmap.h +1 -1
  218. data/ext/pg_query/include/postgres/nodes/value.h +1 -1
  219. data/ext/pg_query/include/postgres/optimizer/cost.h +5 -4
  220. data/ext/pg_query/include/postgres/optimizer/geqo.h +1 -1
  221. data/ext/pg_query/include/postgres/optimizer/geqo_gene.h +1 -1
  222. data/ext/pg_query/include/postgres/optimizer/optimizer.h +5 -2
  223. data/ext/pg_query/include/postgres/optimizer/paths.h +13 -8
  224. data/ext/pg_query/include/postgres/optimizer/planmain.h +7 -1
  225. data/ext/pg_query/include/postgres/parser/analyze.h +3 -1
  226. data/ext/pg_query/include/postgres/parser/kwlist.h +22 -2
  227. data/ext/pg_query/include/postgres/parser/parse_agg.h +1 -1
  228. data/ext/pg_query/include/postgres/parser/parse_coerce.h +5 -2
  229. data/ext/pg_query/include/postgres/parser/parse_expr.h +1 -1
  230. data/ext/pg_query/include/postgres/parser/parse_func.h +2 -2
  231. data/ext/pg_query/include/postgres/parser/parse_node.h +3 -2
  232. data/ext/pg_query/include/postgres/parser/parse_oper.h +4 -1
  233. data/ext/pg_query/include/postgres/parser/parse_relation.h +1 -1
  234. data/ext/pg_query/include/postgres/parser/parse_type.h +2 -2
  235. data/ext/pg_query/include/postgres/parser/parser.h +3 -3
  236. data/ext/pg_query/include/postgres/parser/parsetree.h +1 -1
  237. data/ext/pg_query/include/postgres/parser/scanner.h +1 -1
  238. data/ext/pg_query/include/postgres/parser/scansup.h +1 -1
  239. data/ext/pg_query/include/postgres/partitioning/partdefs.h +1 -1
  240. data/ext/pg_query/include/postgres/pg_config.h +53 -45
  241. data/ext/pg_query/include/postgres/pg_config_manual.h +21 -8
  242. data/ext/pg_query/include/postgres/pg_getopt.h +1 -1
  243. data/ext/pg_query/include/postgres/pg_trace.h +1 -1
  244. data/ext/pg_query/include/postgres/pgstat.h +13 -11
  245. data/ext/pg_query/include/postgres/pgtime.h +1 -1
  246. data/ext/pg_query/include/postgres/pl_reserved_kwlist.h +1 -1
  247. data/ext/pg_query/include/postgres/pl_reserved_kwlist_d.h +1 -1
  248. data/ext/pg_query/include/postgres/pl_unreserved_kwlist.h +1 -1
  249. data/ext/pg_query/include/postgres/pl_unreserved_kwlist_d.h +1 -1
  250. data/ext/pg_query/include/postgres/plerrcodes.h +4 -4
  251. data/ext/pg_query/include/postgres/plpgsql.h +15 -13
  252. data/ext/pg_query/include/postgres/port/atomics/arch-arm.h +1 -1
  253. data/ext/pg_query/include/postgres/port/atomics/arch-hppa.h +1 -1
  254. data/ext/pg_query/include/postgres/port/atomics/arch-ppc.h +3 -1
  255. data/ext/pg_query/include/postgres/port/atomics/arch-x86.h +3 -1
  256. data/ext/pg_query/include/postgres/port/atomics/fallback.h +1 -1
  257. data/ext/pg_query/include/postgres/port/atomics/generic-gcc.h +38 -1
  258. data/ext/pg_query/include/postgres/port/atomics/generic-msvc.h +19 -1
  259. data/ext/pg_query/include/postgres/port/atomics/generic-sunpro.h +16 -1
  260. data/ext/pg_query/include/postgres/port/atomics/generic.h +38 -2
  261. data/ext/pg_query/include/postgres/port/atomics.h +93 -6
  262. data/ext/pg_query/include/postgres/port/pg_bitutils.h +91 -9
  263. data/ext/pg_query/include/postgres/port/pg_bswap.h +1 -1
  264. data/ext/pg_query/include/postgres/port/pg_crc32c.h +10 -1
  265. data/ext/pg_query/include/postgres/port/pg_iovec.h +117 -0
  266. data/ext/pg_query/include/postgres/port/simd.h +48 -1
  267. data/ext/pg_query/include/postgres/port/win32/sys/socket.h +8 -0
  268. data/ext/pg_query/include/postgres/port/win32_port.h +1 -13
  269. data/ext/pg_query/include/postgres/port.h +39 -4
  270. data/ext/pg_query/include/postgres/portability/instr_time.h +1 -1
  271. data/ext/pg_query/include/postgres/postgres.h +1 -1
  272. data/ext/pg_query/include/postgres/postmaster/autovacuum.h +5 -16
  273. data/ext/pg_query/include/postgres/postmaster/bgworker.h +8 -6
  274. data/ext/pg_query/include/postgres/postmaster/bgworker_internals.h +3 -7
  275. data/ext/pg_query/include/postgres/postmaster/bgwriter.h +3 -3
  276. data/ext/pg_query/include/postgres/postmaster/interrupt.h +1 -1
  277. data/ext/pg_query/include/postgres/postmaster/pgarch.h +2 -2
  278. data/ext/pg_query/include/postgres/postmaster/postmaster.h +25 -5
  279. data/ext/pg_query/include/postgres/postmaster/startup.h +2 -2
  280. data/ext/pg_query/include/postgres/postmaster/syslogger.h +2 -4
  281. data/ext/pg_query/include/postgres/postmaster/walsummarizer.h +35 -0
  282. data/ext/pg_query/include/postgres/postmaster/walwriter.h +2 -2
  283. data/ext/pg_query/include/postgres/regex/regex.h +92 -9
  284. data/ext/pg_query/include/postgres/replication/logicallauncher.h +1 -1
  285. data/ext/pg_query/include/postgres/replication/logicalproto.h +2 -2
  286. data/ext/pg_query/include/postgres/replication/logicalworker.h +2 -1
  287. data/ext/pg_query/include/postgres/replication/origin.h +1 -1
  288. data/ext/pg_query/include/postgres/replication/reorderbuffer.h +27 -46
  289. data/ext/pg_query/include/postgres/replication/slot.h +45 -5
  290. data/ext/pg_query/include/postgres/replication/slotsync.h +38 -0
  291. data/ext/pg_query/include/postgres/replication/syncrep.h +1 -1
  292. data/ext/pg_query/include/postgres/replication/walreceiver.h +37 -11
  293. data/ext/pg_query/include/postgres/replication/walsender.h +5 -3
  294. data/ext/pg_query/include/postgres/rewrite/prs2lock.h +1 -1
  295. data/ext/pg_query/include/postgres/rewrite/rewriteHandler.h +7 -1
  296. data/ext/pg_query/include/postgres/rewrite/rewriteManip.h +2 -2
  297. data/ext/pg_query/include/postgres/rewrite/rewriteSupport.h +1 -1
  298. data/ext/pg_query/include/postgres/storage/block.h +1 -1
  299. data/ext/pg_query/include/postgres/storage/buf.h +1 -1
  300. data/ext/pg_query/include/postgres/storage/bufmgr.h +59 -41
  301. data/ext/pg_query/include/postgres/storage/bufpage.h +1 -1
  302. data/ext/pg_query/include/postgres/storage/condition_variable.h +1 -1
  303. data/ext/pg_query/include/postgres/storage/dsm.h +1 -1
  304. data/ext/pg_query/include/postgres/storage/dsm_impl.h +2 -2
  305. data/ext/pg_query/include/postgres/storage/fd.h +30 -13
  306. data/ext/pg_query/include/postgres/storage/fileset.h +1 -1
  307. data/ext/pg_query/include/postgres/storage/ipc.h +4 -1
  308. data/ext/pg_query/include/postgres/storage/item.h +1 -1
  309. data/ext/pg_query/include/postgres/storage/itemid.h +1 -1
  310. data/ext/pg_query/include/postgres/storage/itemptr.h +1 -1
  311. data/ext/pg_query/include/postgres/storage/large_object.h +1 -1
  312. data/ext/pg_query/include/postgres/storage/latch.h +4 -2
  313. data/ext/pg_query/include/postgres/storage/lmgr.h +8 -2
  314. data/ext/pg_query/include/postgres/storage/lock.h +19 -19
  315. data/ext/pg_query/include/postgres/storage/lockdefs.h +3 -1
  316. data/ext/pg_query/include/postgres/storage/lwlock.h +17 -9
  317. data/ext/pg_query/include/postgres/storage/lwlocknames.h +7 -10
  318. data/ext/pg_query/include/postgres/storage/off.h +1 -1
  319. data/ext/pg_query/include/postgres/storage/pg_sema.h +1 -1
  320. data/ext/pg_query/include/postgres/storage/pg_shmem.h +5 -4
  321. data/ext/pg_query/include/postgres/storage/pmsignal.h +2 -2
  322. data/ext/pg_query/include/postgres/storage/predicate.h +1 -5
  323. data/ext/pg_query/include/postgres/storage/proc.h +48 -26
  324. data/ext/pg_query/include/postgres/storage/procarray.h +5 -1
  325. data/ext/pg_query/include/postgres/storage/proclist_types.h +11 -9
  326. data/ext/pg_query/include/postgres/storage/procnumber.h +43 -0
  327. data/ext/pg_query/include/postgres/storage/procsignal.h +8 -6
  328. data/ext/pg_query/include/postgres/storage/read_stream.h +65 -0
  329. data/ext/pg_query/include/postgres/storage/relfilelocator.h +16 -15
  330. data/ext/pg_query/include/postgres/storage/s_lock.h +7 -27
  331. data/ext/pg_query/include/postgres/storage/sharedfileset.h +1 -1
  332. data/ext/pg_query/include/postgres/storage/shm_mq.h +2 -2
  333. data/ext/pg_query/include/postgres/storage/shm_toc.h +1 -1
  334. data/ext/pg_query/include/postgres/storage/shmem.h +1 -1
  335. data/ext/pg_query/include/postgres/storage/sinval.h +3 -3
  336. data/ext/pg_query/include/postgres/storage/smgr.h +46 -29
  337. data/ext/pg_query/include/postgres/storage/spin.h +1 -1
  338. data/ext/pg_query/include/postgres/storage/standby.h +13 -3
  339. data/ext/pg_query/include/postgres/storage/standbydefs.h +2 -2
  340. data/ext/pg_query/include/postgres/storage/sync.h +4 -4
  341. data/ext/pg_query/include/postgres/tcop/cmdtag.h +1 -2
  342. data/ext/pg_query/include/postgres/tcop/cmdtaglist.h +3 -2
  343. data/ext/pg_query/include/postgres/tcop/deparse_utility.h +2 -2
  344. data/ext/pg_query/include/postgres/tcop/dest.h +3 -2
  345. data/ext/pg_query/include/postgres/tcop/fastpath.h +1 -1
  346. data/ext/pg_query/include/postgres/tcop/pquery.h +1 -1
  347. data/ext/pg_query/include/postgres/tcop/tcopprot.h +9 -5
  348. data/ext/pg_query/include/postgres/tcop/utility.h +2 -2
  349. data/ext/pg_query/include/postgres/tsearch/ts_cache.h +1 -1
  350. data/ext/pg_query/include/postgres/utils/acl.h +19 -7
  351. data/ext/pg_query/include/postgres/utils/aclchk_internal.h +1 -1
  352. data/ext/pg_query/include/postgres/utils/array.h +1 -2
  353. data/ext/pg_query/include/postgres/utils/ascii.h +84 -0
  354. data/ext/pg_query/include/postgres/utils/backend_progress.h +3 -2
  355. data/ext/pg_query/include/postgres/utils/backend_status.h +8 -10
  356. data/ext/pg_query/include/postgres/utils/builtins.h +4 -1
  357. data/ext/pg_query/include/postgres/utils/bytea.h +2 -2
  358. data/ext/pg_query/include/postgres/utils/catcache.h +6 -6
  359. data/ext/pg_query/include/postgres/utils/date.h +1 -1
  360. data/ext/pg_query/include/postgres/utils/datetime.h +4 -1
  361. data/ext/pg_query/include/postgres/utils/datum.h +1 -1
  362. data/ext/pg_query/include/postgres/utils/dsa.h +44 -5
  363. data/ext/pg_query/include/postgres/utils/elog.h +3 -8
  364. data/ext/pg_query/include/postgres/utils/errcodes.h +1 -3
  365. data/ext/pg_query/include/postgres/utils/expandeddatum.h +1 -1
  366. data/ext/pg_query/include/postgres/utils/expandedrecord.h +1 -1
  367. data/ext/pg_query/include/postgres/utils/float.h +1 -1
  368. data/ext/pg_query/include/postgres/utils/fmgroids.h +49 -16
  369. data/ext/pg_query/include/postgres/utils/fmgrprotos.h +47 -14
  370. data/ext/pg_query/include/postgres/utils/fmgrtab.h +1 -1
  371. data/ext/pg_query/include/postgres/utils/guc.h +20 -6
  372. data/ext/pg_query/include/postgres/utils/guc_hooks.h +23 -2
  373. data/ext/pg_query/include/postgres/utils/guc_tables.h +6 -5
  374. data/ext/pg_query/include/postgres/utils/hsearch.h +2 -2
  375. data/ext/pg_query/include/postgres/utils/injection_point.h +44 -0
  376. data/ext/pg_query/include/postgres/utils/inval.h +1 -1
  377. data/ext/pg_query/include/postgres/utils/logtape.h +5 -5
  378. data/ext/pg_query/include/postgres/utils/lsyscache.h +6 -3
  379. data/ext/pg_query/include/postgres/utils/memdebug.h +1 -1
  380. data/ext/pg_query/include/postgres/utils/memutils.h +12 -5
  381. data/ext/pg_query/include/postgres/utils/memutils_internal.h +53 -13
  382. data/ext/pg_query/include/postgres/utils/memutils_memorychunk.h +25 -9
  383. data/ext/pg_query/include/postgres/utils/numeric.h +6 -1
  384. data/ext/pg_query/include/postgres/utils/palloc.h +1 -15
  385. data/ext/pg_query/include/postgres/utils/partcache.h +1 -1
  386. data/ext/pg_query/include/postgres/utils/pg_locale.h +8 -7
  387. data/ext/pg_query/include/postgres/utils/pgstat_internal.h +30 -17
  388. data/ext/pg_query/include/postgres/utils/plancache.h +5 -3
  389. data/ext/pg_query/include/postgres/utils/portal.h +10 -10
  390. data/ext/pg_query/include/postgres/utils/queryenvironment.h +2 -2
  391. data/ext/pg_query/include/postgres/utils/regproc.h +1 -1
  392. data/ext/pg_query/include/postgres/utils/rel.h +14 -15
  393. data/ext/pg_query/include/postgres/utils/relcache.h +2 -5
  394. data/ext/pg_query/include/postgres/utils/reltrigger.h +1 -1
  395. data/ext/pg_query/include/postgres/utils/resowner.h +90 -9
  396. data/ext/pg_query/include/postgres/utils/ruleutils.h +1 -1
  397. data/ext/pg_query/include/postgres/utils/sharedtuplestore.h +1 -1
  398. data/ext/pg_query/include/postgres/utils/snapmgr.h +1 -52
  399. data/ext/pg_query/include/postgres/utils/snapshot.h +2 -2
  400. data/ext/pg_query/include/postgres/utils/sortsupport.h +1 -1
  401. data/ext/pg_query/include/postgres/utils/syscache.h +7 -98
  402. data/ext/pg_query/include/postgres/utils/timeout.h +3 -2
  403. data/ext/pg_query/include/postgres/utils/timestamp.h +1 -1
  404. data/ext/pg_query/include/postgres/utils/tuplesort.h +36 -9
  405. data/ext/pg_query/include/postgres/utils/tuplestore.h +2 -5
  406. data/ext/pg_query/include/postgres/utils/typcache.h +2 -1
  407. data/ext/pg_query/include/postgres/utils/varlena.h +1 -1
  408. data/ext/pg_query/include/postgres/utils/wait_event.h +28 -214
  409. data/ext/pg_query/include/postgres/utils/wait_event_types.h +218 -0
  410. data/ext/pg_query/include/postgres/utils/xml.h +4 -4
  411. data/ext/pg_query/include/postgres/varatt.h +1 -1
  412. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +1546 -792
  413. data/ext/pg_query/include/protobuf/pg_query.pb.h +58365 -46595
  414. data/ext/pg_query/pg_query.pb-c.c +6598 -3739
  415. data/ext/pg_query/pg_query_normalize.c +42 -1
  416. data/ext/pg_query/pg_query_outfuncs_json.c +3 -1
  417. data/ext/pg_query/pg_query_parse_plpgsql.c +12 -13
  418. data/ext/pg_query/pg_query_readfuncs_protobuf.c +2 -2
  419. data/ext/pg_query/pg_query_scan.c +1 -1
  420. data/ext/pg_query/postgres_deparse.c +601 -172
  421. data/ext/pg_query/src_backend_catalog_namespace.c +241 -66
  422. data/ext/pg_query/src_backend_catalog_pg_proc.c +1 -3
  423. data/ext/pg_query/src_backend_commands_define.c +2 -3
  424. data/ext/pg_query/src_backend_nodes_bitmapset.c +137 -94
  425. data/ext/pg_query/src_backend_nodes_copyfuncs.c +1 -1
  426. data/ext/pg_query/src_backend_nodes_equalfuncs.c +1 -1
  427. data/ext/pg_query/src_backend_nodes_extensible.c +1 -1
  428. data/ext/pg_query/src_backend_nodes_list.c +3 -7
  429. data/ext/pg_query/src_backend_nodes_makefuncs.c +59 -20
  430. data/ext/pg_query/src_backend_nodes_nodeFuncs.c +109 -2
  431. data/ext/pg_query/src_backend_nodes_value.c +1 -1
  432. data/ext/pg_query/src_backend_parser_gram.c +34491 -32136
  433. data/ext/pg_query/src_backend_parser_parser.c +8 -8
  434. data/ext/pg_query/src_backend_parser_scan.c +5637 -3028
  435. data/ext/pg_query/src_backend_parser_scansup.c +2 -1
  436. data/ext/pg_query/src_backend_storage_ipc_ipc.c +1 -1
  437. data/ext/pg_query/src_backend_tcop_postgres.c +34 -10
  438. data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +2 -2
  439. data/ext/pg_query/src_backend_utils_adt_datum.c +8 -6
  440. data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
  441. data/ext/pg_query/src_backend_utils_adt_format_type.c +1 -1
  442. data/ext/pg_query/src_backend_utils_adt_numutils.c +4 -5
  443. data/ext/pg_query/src_backend_utils_adt_ruleutils.c +101 -28
  444. data/ext/pg_query/src_backend_utils_error_assert.c +1 -1
  445. data/ext/pg_query/src_backend_utils_error_elog.c +47 -42
  446. data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +4 -2
  447. data/ext/pg_query/src_backend_utils_init_globals.c +15 -3
  448. data/ext/pg_query/src_backend_utils_mb_mbutils.c +11 -18
  449. data/ext/pg_query/src_backend_utils_misc_guc_tables.c +16 -6
  450. data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +8 -5
  451. data/ext/pg_query/src_backend_utils_mmgr_aset.c +308 -238
  452. data/ext/pg_query/src_backend_utils_mmgr_bump.c +728 -0
  453. data/ext/pg_query/src_backend_utils_mmgr_generation.c +273 -197
  454. data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +270 -215
  455. data/ext/pg_query/src_backend_utils_mmgr_slab.c +154 -96
  456. data/ext/pg_query/src_common_encnames.c +43 -44
  457. data/ext/pg_query/src_common_hashfn.c +1 -1
  458. data/ext/pg_query/src_common_keywords.c +1 -1
  459. data/ext/pg_query/src_common_kwlist_d.h +511 -466
  460. data/ext/pg_query/src_common_kwlookup.c +1 -1
  461. data/ext/pg_query/src_common_psprintf.c +3 -3
  462. data/ext/pg_query/src_common_stringinfo.c +18 -1
  463. data/ext/pg_query/src_common_wchar.c +92 -109
  464. data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +99 -5
  465. data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +1 -1
  466. data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +242 -143
  467. data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
  468. data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +1 -1
  469. data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +19 -1
  470. data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +1 -1
  471. data/ext/pg_query/src_port_pg_bitutils.c +173 -28
  472. data/ext/pg_query/src_port_pgstrcasecmp.c +29 -1
  473. data/ext/pg_query/src_port_snprintf.c +15 -18
  474. data/ext/pg_query/src_port_strerror.c +1 -3
  475. data/ext/pg_query/src_port_strlcpy.c +1 -1
  476. data/lib/pg_query/fingerprint.rb +3 -5
  477. data/lib/pg_query/param_refs.rb +2 -2
  478. data/lib/pg_query/parse.rb +5 -7
  479. data/lib/pg_query/parse_error.rb +1 -0
  480. data/lib/pg_query/pg_query_pb.rb +27 -25
  481. data/lib/pg_query/scan.rb +1 -0
  482. data/lib/pg_query/treewalker.rb +38 -15
  483. data/lib/pg_query/truncate.rb +18 -20
  484. data/lib/pg_query/version.rb +1 -1
  485. metadata +31 -82
  486. data/ext/pg_query/include/postgres/storage/backendid.h +0 -37
  487. data/ext/pg_query/include/postgres/storage/sinvaladt.h +0 -45
  488. data/ext/pg_query/pg_query_ruby_freebsd.sym +0 -2
  489. data/ext/pg_query/src_backend_nodes_nodes.c +0 -38
  490. /data/ext/pg_query/{pg_query_ruby.sym → ext_symbols.sym} +0 -0
@@ -12,7 +12,7 @@
12
12
  * identifying statement boundaries in multi-statement source strings.
13
13
  *
14
14
  *
15
- * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
15
+ * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
16
16
  * Portions Copyright (c) 1994, Regents of the University of California
17
17
  *
18
18
  * src/include/nodes/parsenodes.h
@@ -30,13 +30,6 @@
30
30
  #include "partitioning/partdefs.h"
31
31
 
32
32
 
33
- typedef enum OverridingKind
34
- {
35
- OVERRIDING_NOT_SET = 0,
36
- OVERRIDING_USER_VALUE,
37
- OVERRIDING_SYSTEM_VALUE
38
- } OverridingKind;
39
-
40
33
  /* Possible sources of a Query */
41
34
  typedef enum QuerySource
42
35
  {
@@ -44,7 +37,7 @@ typedef enum QuerySource
44
37
  QSRC_PARSER, /* added by parse analysis (now unused) */
45
38
  QSRC_INSTEAD_RULE, /* added by unconditional INSTEAD rule */
46
39
  QSRC_QUAL_INSTEAD_RULE, /* added by conditional INSTEAD rule */
47
- QSRC_NON_INSTEAD_RULE /* added by non-INSTEAD rule */
40
+ QSRC_NON_INSTEAD_RULE, /* added by non-INSTEAD rule */
48
41
  } QuerySource;
49
42
 
50
43
  /* Sort ordering options for ORDER BY and CREATE INDEX */
@@ -53,14 +46,14 @@ typedef enum SortByDir
53
46
  SORTBY_DEFAULT,
54
47
  SORTBY_ASC,
55
48
  SORTBY_DESC,
56
- SORTBY_USING /* not allowed in CREATE INDEX ... */
49
+ SORTBY_USING, /* not allowed in CREATE INDEX ... */
57
50
  } SortByDir;
58
51
 
59
52
  typedef enum SortByNulls
60
53
  {
61
54
  SORTBY_NULLS_DEFAULT,
62
55
  SORTBY_NULLS_FIRST,
63
- SORTBY_NULLS_LAST
56
+ SORTBY_NULLS_LAST,
64
57
  } SortByNulls;
65
58
 
66
59
  /* Options for [ ALL | DISTINCT ] */
@@ -68,7 +61,7 @@ typedef enum SetQuantifier
68
61
  {
69
62
  SET_QUANTIFIER_DEFAULT,
70
63
  SET_QUANTIFIER_ALL,
71
- SET_QUANTIFIER_DISTINCT
64
+ SET_QUANTIFIER_DISTINCT,
72
65
  } SetQuantifier;
73
66
 
74
67
  /*
@@ -94,7 +87,8 @@ typedef uint64 AclMode; /* a bitmask of privilege bits */
94
87
  #define ACL_CONNECT (1<<11) /* for databases */
95
88
  #define ACL_SET (1<<12) /* for configuration parameters */
96
89
  #define ACL_ALTER_SYSTEM (1<<13) /* for configuration parameters */
97
- #define N_ACL_RIGHTS 14 /* 1 plus the last 1<<x */
90
+ #define ACL_MAINTAIN (1<<14) /* for relations */
91
+ #define N_ACL_RIGHTS 15 /* 1 plus the last 1<<x */
98
92
  #define ACL_NO_RIGHTS 0
99
93
  /* Currently, SELECT ... FOR [KEY] UPDATE/SHARE requires UPDATE privileges */
100
94
  #define ACL_SELECT_FOR_UPDATE ACL_UPDATE
@@ -160,7 +154,7 @@ typedef struct Query
160
154
  bool hasDistinctOn pg_node_attr(query_jumble_ignore);
161
155
  /* WITH RECURSIVE was specified */
162
156
  bool hasRecursive pg_node_attr(query_jumble_ignore);
163
- /* has INSERT/UPDATE/DELETE in WITH */
157
+ /* has INSERT/UPDATE/DELETE/MERGE in WITH */
164
158
  bool hasModifyingCTE pg_node_attr(query_jumble_ignore);
165
159
  /* FOR [KEY] UPDATE/SHARE was specified */
166
160
  bool hasForUpdate pg_node_attr(query_jumble_ignore);
@@ -182,8 +176,17 @@ typedef struct Query
182
176
  * also USING clause for MERGE */
183
177
 
184
178
  List *mergeActionList; /* list of actions for MERGE (only) */
185
- /* whether to use outer join */
186
- bool mergeUseOuterJoin pg_node_attr(query_jumble_ignore);
179
+
180
+ /*
181
+ * rtable index of target relation for MERGE to pull data. Initially, this
182
+ * is the same as resultRelation, but after query rewriting, if the target
183
+ * relation is a trigger-updatable view, this is the index of the expanded
184
+ * view subquery, whereas resultRelation is the index of the target view.
185
+ */
186
+ int mergeTargetRelation pg_node_attr(query_jumble_ignore);
187
+
188
+ /* join condition between source and target for MERGE */
189
+ Node *mergeJoinCondition;
187
190
 
188
191
  List *targetList; /* target list (of TargetEntry) */
189
192
 
@@ -232,9 +235,9 @@ typedef struct Query
232
235
  * both be -1 meaning "unknown".
233
236
  */
234
237
  /* start location, or -1 if unknown */
235
- int stmt_location;
238
+ ParseLoc stmt_location;
236
239
  /* length in bytes; 0 means "rest of string" */
237
- int stmt_len pg_node_attr(query_jumble_ignore);
240
+ ParseLoc stmt_len pg_node_attr(query_jumble_ignore);
238
241
  } Query;
239
242
 
240
243
 
@@ -269,7 +272,7 @@ typedef struct TypeName
269
272
  List *typmods; /* type modifier expression(s) */
270
273
  int32 typemod; /* prespecified type modifier */
271
274
  List *arrayBounds; /* array bounds */
272
- int location; /* token location, or -1 if unknown */
275
+ ParseLoc location; /* token location, or -1 if unknown */
273
276
  } TypeName;
274
277
 
275
278
  /*
@@ -289,7 +292,7 @@ typedef struct ColumnRef
289
292
  {
290
293
  NodeTag type;
291
294
  List *fields; /* field names (String nodes) or A_Star */
292
- int location; /* token location, or -1 if unknown */
295
+ ParseLoc location; /* token location, or -1 if unknown */
293
296
  } ColumnRef;
294
297
 
295
298
  /*
@@ -299,7 +302,7 @@ typedef struct ParamRef
299
302
  {
300
303
  NodeTag type;
301
304
  int number; /* the number of the parameter */
302
- int location; /* token location, or -1 if unknown */
305
+ ParseLoc location; /* token location, or -1 if unknown */
303
306
  } ParamRef;
304
307
 
305
308
  /*
@@ -320,7 +323,7 @@ typedef enum A_Expr_Kind
320
323
  AEXPR_BETWEEN, /* name must be "BETWEEN" */
321
324
  AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */
322
325
  AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */
323
- AEXPR_NOT_BETWEEN_SYM /* name must be "NOT BETWEEN SYMMETRIC" */
326
+ AEXPR_NOT_BETWEEN_SYM, /* name must be "NOT BETWEEN SYMMETRIC" */
324
327
  } A_Expr_Kind;
325
328
 
326
329
  typedef struct A_Expr
@@ -332,7 +335,7 @@ typedef struct A_Expr
332
335
  List *name; /* possibly-qualified name of operator */
333
336
  Node *lexpr; /* left argument, or NULL if none */
334
337
  Node *rexpr; /* right argument, or NULL if none */
335
- int location; /* token location, or -1 if unknown */
338
+ ParseLoc location; /* token location, or -1 if unknown */
336
339
  } A_Expr;
337
340
 
338
341
  /*
@@ -358,7 +361,7 @@ typedef struct A_Const
358
361
  NodeTag type;
359
362
  union ValUnion val;
360
363
  bool isnull; /* SQL NULL constant */
361
- int location; /* token location, or -1 if unknown */
364
+ ParseLoc location; /* token location, or -1 if unknown */
362
365
  } A_Const;
363
366
 
364
367
  /*
@@ -369,7 +372,7 @@ typedef struct TypeCast
369
372
  NodeTag type;
370
373
  Node *arg; /* the expression being casted */
371
374
  TypeName *typeName; /* the target type */
372
- int location; /* token location, or -1 if unknown */
375
+ ParseLoc location; /* token location, or -1 if unknown */
373
376
  } TypeCast;
374
377
 
375
378
  /*
@@ -380,7 +383,7 @@ typedef struct CollateClause
380
383
  NodeTag type;
381
384
  Node *arg; /* input expression */
382
385
  List *collname; /* possibly-qualified collation name */
383
- int location; /* token location, or -1 if unknown */
386
+ ParseLoc location; /* token location, or -1 if unknown */
384
387
  } CollateClause;
385
388
 
386
389
  /*
@@ -392,7 +395,7 @@ typedef enum RoleSpecType
392
395
  ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */
393
396
  ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
394
397
  ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
395
- ROLESPEC_PUBLIC /* role name is "public" */
398
+ ROLESPEC_PUBLIC, /* role name is "public" */
396
399
  } RoleSpecType;
397
400
 
398
401
  typedef struct RoleSpec
@@ -400,7 +403,7 @@ typedef struct RoleSpec
400
403
  NodeTag type;
401
404
  RoleSpecType roletype; /* Type of this rolespec */
402
405
  char *rolename; /* filled only for ROLESPEC_CSTRING */
403
- int location; /* token location, or -1 if unknown */
406
+ ParseLoc location; /* token location, or -1 if unknown */
404
407
  } RoleSpec;
405
408
 
406
409
  /*
@@ -430,7 +433,7 @@ typedef struct FuncCall
430
433
  bool agg_distinct; /* arguments were labeled DISTINCT */
431
434
  bool func_variadic; /* last argument was labeled VARIADIC */
432
435
  CoercionForm funcformat; /* how to display this node */
433
- int location; /* token location, or -1 if unknown */
436
+ ParseLoc location; /* token location, or -1 if unknown */
434
437
  } FuncCall;
435
438
 
436
439
  /*
@@ -487,7 +490,7 @@ typedef struct A_ArrayExpr
487
490
  {
488
491
  NodeTag type;
489
492
  List *elements; /* array element expressions */
490
- int location; /* token location, or -1 if unknown */
493
+ ParseLoc location; /* token location, or -1 if unknown */
491
494
  } A_ArrayExpr;
492
495
 
493
496
  /*
@@ -514,7 +517,7 @@ typedef struct ResTarget
514
517
  char *name; /* column name or NULL */
515
518
  List *indirection; /* subscripts, field names, and '*', or NIL */
516
519
  Node *val; /* the value expression to compute or assign */
517
- int location; /* token location, or -1 if unknown */
520
+ ParseLoc location; /* token location, or -1 if unknown */
518
521
  } ResTarget;
519
522
 
520
523
  /*
@@ -544,7 +547,7 @@ typedef struct SortBy
544
547
  SortByDir sortby_dir; /* ASC/DESC/USING/default */
545
548
  SortByNulls sortby_nulls; /* NULLS FIRST/LAST */
546
549
  List *useOp; /* name of op to use, if SORTBY_USING */
547
- int location; /* operator location, or -1 if none/unknown */
550
+ ParseLoc location; /* operator location, or -1 if none/unknown */
548
551
  } SortBy;
549
552
 
550
553
  /*
@@ -565,7 +568,7 @@ typedef struct WindowDef
565
568
  int frameOptions; /* frame_clause options, see below */
566
569
  Node *startOffset; /* expression for starting bound, if any */
567
570
  Node *endOffset; /* expression for ending bound, if any */
568
- int location; /* parse location, or -1 if none/unknown */
571
+ ParseLoc location; /* parse location, or -1 if none/unknown */
569
572
  } WindowDef;
570
573
 
571
574
  /*
@@ -645,6 +648,9 @@ typedef struct RangeFunction
645
648
 
646
649
  /*
647
650
  * RangeTableFunc - raw form of "table functions" such as XMLTABLE
651
+ *
652
+ * Note: JSON_TABLE is also a "table function", but it uses JsonTable node,
653
+ * not RangeTableFunc.
648
654
  */
649
655
  typedef struct RangeTableFunc
650
656
  {
@@ -655,7 +661,7 @@ typedef struct RangeTableFunc
655
661
  List *namespaces; /* list of namespaces as ResTarget */
656
662
  List *columns; /* list of RangeTableFuncCol */
657
663
  Alias *alias; /* table alias & optional column aliases */
658
- int location; /* token location, or -1 if unknown */
664
+ ParseLoc location; /* token location, or -1 if unknown */
659
665
  } RangeTableFunc;
660
666
 
661
667
  /*
@@ -673,7 +679,7 @@ typedef struct RangeTableFuncCol
673
679
  bool is_not_null; /* does it have NOT NULL? */
674
680
  Node *colexpr; /* column filter expression */
675
681
  Node *coldefexpr; /* column default value expression */
676
- int location; /* token location, or -1 if unknown */
682
+ ParseLoc location; /* token location, or -1 if unknown */
677
683
  } RangeTableFuncCol;
678
684
 
679
685
  /*
@@ -693,7 +699,7 @@ typedef struct RangeTableSample
693
699
  List *method; /* sampling method name (possibly qualified) */
694
700
  List *args; /* argument(s) for sampling method */
695
701
  Node *repeatable; /* REPEATABLE expression, or NULL if none */
696
- int location; /* method name location, or -1 if unknown */
702
+ ParseLoc location; /* method name location, or -1 if unknown */
697
703
  } RangeTableSample;
698
704
 
699
705
  /*
@@ -736,7 +742,7 @@ typedef struct ColumnDef
736
742
  Oid collOid; /* collation OID (InvalidOid if not set) */
737
743
  List *constraints; /* other constraints on column */
738
744
  List *fdwoptions; /* per-column FDW options */
739
- int location; /* parse location, or -1 if none/unknown */
745
+ ParseLoc location; /* parse location, or -1 if none/unknown */
740
746
  } ColumnDef;
741
747
 
742
748
  /*
@@ -799,7 +805,7 @@ typedef enum DefElemAction
799
805
  DEFELEM_UNSPEC, /* no action given */
800
806
  DEFELEM_SET,
801
807
  DEFELEM_ADD,
802
- DEFELEM_DROP
808
+ DEFELEM_DROP,
803
809
  } DefElemAction;
804
810
 
805
811
  typedef struct DefElem
@@ -810,7 +816,7 @@ typedef struct DefElem
810
816
  Node *arg; /* typically Integer, Float, String, or
811
817
  * TypeName */
812
818
  DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */
813
- int location; /* token location, or -1 if unknown */
819
+ ParseLoc location; /* token location, or -1 if unknown */
814
820
  } DefElem;
815
821
 
816
822
  /*
@@ -840,7 +846,7 @@ typedef struct XmlSerialize
840
846
  Node *expr;
841
847
  TypeName *typeName;
842
848
  bool indent; /* [NO] INDENT */
843
- int location; /* token location, or -1 if unknown */
849
+ ParseLoc location; /* token location, or -1 if unknown */
844
850
  } XmlSerialize;
845
851
 
846
852
  /* Partitioning related definitions */
@@ -858,14 +864,14 @@ typedef struct PartitionElem
858
864
  Node *expr; /* expression to partition on, or NULL */
859
865
  List *collation; /* name of collation; NIL = default */
860
866
  List *opclass; /* name of desired opclass; NIL = default */
861
- int location; /* token location, or -1 if unknown */
867
+ ParseLoc location; /* token location, or -1 if unknown */
862
868
  } PartitionElem;
863
869
 
864
870
  typedef enum PartitionStrategy
865
871
  {
866
872
  PARTITION_STRATEGY_LIST = 'l',
867
873
  PARTITION_STRATEGY_RANGE = 'r',
868
- PARTITION_STRATEGY_HASH = 'h'
874
+ PARTITION_STRATEGY_HASH = 'h',
869
875
  } PartitionStrategy;
870
876
 
871
877
  /*
@@ -878,7 +884,7 @@ typedef struct PartitionSpec
878
884
  NodeTag type;
879
885
  PartitionStrategy strategy;
880
886
  List *partParams; /* List of PartitionElems */
881
- int location; /* token location, or -1 if unknown */
887
+ ParseLoc location; /* token location, or -1 if unknown */
882
888
  } PartitionSpec;
883
889
 
884
890
  /*
@@ -905,7 +911,7 @@ struct PartitionBoundSpec
905
911
  List *lowerdatums; /* List of PartitionRangeDatums */
906
912
  List *upperdatums; /* List of PartitionRangeDatums */
907
913
 
908
- int location; /* token location, or -1 if unknown */
914
+ ParseLoc location; /* token location, or -1 if unknown */
909
915
  };
910
916
 
911
917
  /*
@@ -917,7 +923,7 @@ typedef enum PartitionRangeDatumKind
917
923
  {
918
924
  PARTITION_RANGE_DATUM_MINVALUE = -1, /* less than any other value */
919
925
  PARTITION_RANGE_DATUM_VALUE = 0, /* a specific (bounded) value */
920
- PARTITION_RANGE_DATUM_MAXVALUE = 1 /* greater than any other value */
926
+ PARTITION_RANGE_DATUM_MAXVALUE = 1, /* greater than any other value */
921
927
  } PartitionRangeDatumKind;
922
928
 
923
929
  typedef struct PartitionRangeDatum
@@ -928,9 +934,19 @@ typedef struct PartitionRangeDatum
928
934
  Node *value; /* Const (or A_Const in raw tree), if kind is
929
935
  * PARTITION_RANGE_DATUM_VALUE, else NULL */
930
936
 
931
- int location; /* token location, or -1 if unknown */
937
+ ParseLoc location; /* token location, or -1 if unknown */
932
938
  } PartitionRangeDatum;
933
939
 
940
+ /*
941
+ * PartitionDesc - used in reverted ALTER TABLE SPLIT PARTITION command
942
+ *
943
+ * Kept as a stub for nodetag ABI compatibility.
944
+ */
945
+ typedef struct SinglePartitionSpec
946
+ {
947
+ NodeTag type;
948
+ } SinglePartitionSpec;
949
+
934
950
  /*
935
951
  * PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION commands
936
952
  */
@@ -988,10 +1004,6 @@ typedef struct PartitionCmd
988
1004
  * them from the joinaliasvars list, because that would affect the attnums
989
1005
  * of Vars referencing the rest of the list.)
990
1006
  *
991
- * inh is true for relation references that should be expanded to include
992
- * inheritance children, if the rel has any. This *must* be false for
993
- * RTEs other than RTE_RELATION entries.
994
- *
995
1007
  * inFromCl marks those range variables that are listed in the FROM clause.
996
1008
  * It's false for RTEs that are added to a query behind the scenes, such
997
1009
  * as the NEW and OLD variables for a rule, or the subqueries of a UNION.
@@ -1018,28 +1030,39 @@ typedef enum RTEKind
1018
1030
  RTE_VALUES, /* VALUES (<exprlist>), (<exprlist>), ... */
1019
1031
  RTE_CTE, /* common table expr (WITH list element) */
1020
1032
  RTE_NAMEDTUPLESTORE, /* tuplestore, e.g. for AFTER triggers */
1021
- RTE_RESULT /* RTE represents an empty FROM clause; such
1033
+ RTE_RESULT, /* RTE represents an empty FROM clause; such
1022
1034
  * RTEs are added by the planner, they're not
1023
1035
  * present during parsing or rewriting */
1024
1036
  } RTEKind;
1025
1037
 
1026
1038
  typedef struct RangeTblEntry
1027
1039
  {
1028
- pg_node_attr(custom_read_write, custom_query_jumble)
1040
+ pg_node_attr(custom_read_write)
1029
1041
 
1030
1042
  NodeTag type;
1031
1043
 
1032
- RTEKind rtekind; /* see above */
1033
-
1034
1044
  /*
1035
- * XXX the fields applicable to only some rte kinds should be merged into
1036
- * a union. I didn't do this yet because the diffs would impact a lot of
1037
- * code that is being actively worked on. FIXME someday.
1045
+ * Fields valid in all RTEs:
1046
+ *
1047
+ * put alias + eref first to make dump more legible
1038
1048
  */
1049
+ /* user-written alias clause, if any */
1050
+ Alias *alias pg_node_attr(query_jumble_ignore);
1051
+ /* expanded reference names */
1052
+ Alias *eref pg_node_attr(query_jumble_ignore);
1053
+
1054
+ RTEKind rtekind; /* see above */
1039
1055
 
1040
1056
  /*
1041
1057
  * Fields valid for a plain relation RTE (else zero):
1042
1058
  *
1059
+ * inh is true for relation references that should be expanded to include
1060
+ * inheritance children, if the rel has any. In the parser, this will
1061
+ * only be true for RTE_RELATION entries. The planner also uses this
1062
+ * field to mark RTE_SUBQUERY entries that contain UNION ALL queries that
1063
+ * it has flattened into pulled-up subqueries (creating a structure much
1064
+ * like the effects of inheritance).
1065
+ *
1043
1066
  * rellockmode is really LOCKMODE, but it's declared int to avoid having
1044
1067
  * to include lock-related headers here. It must be RowExclusiveLock if
1045
1068
  * the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if
@@ -1068,17 +1091,26 @@ typedef struct RangeTblEntry
1068
1091
  * relation. This allows plans referencing AFTER trigger transition
1069
1092
  * tables to be invalidated if the underlying table is altered.
1070
1093
  */
1071
- Oid relid; /* OID of the relation */
1072
- char relkind; /* relation kind (see pg_class.relkind) */
1073
- int rellockmode; /* lock level that query requires on the rel */
1074
- struct TableSampleClause *tablesample; /* sampling info, or NULL */
1075
- Index perminfoindex;
1094
+ /* OID of the relation */
1095
+ Oid relid;
1096
+ /* inheritance requested? */
1097
+ bool inh;
1098
+ /* relation kind (see pg_class.relkind) */
1099
+ char relkind pg_node_attr(query_jumble_ignore);
1100
+ /* lock level that query requires on the rel */
1101
+ int rellockmode pg_node_attr(query_jumble_ignore);
1102
+ /* index of RTEPermissionInfo entry, or 0 */
1103
+ Index perminfoindex pg_node_attr(query_jumble_ignore);
1104
+ /* sampling info, or NULL */
1105
+ struct TableSampleClause *tablesample;
1076
1106
 
1077
1107
  /*
1078
1108
  * Fields valid for a subquery RTE (else NULL):
1079
1109
  */
1080
- Query *subquery; /* the sub-query */
1081
- bool security_barrier; /* is from security_barrier view? */
1110
+ /* the sub-query */
1111
+ Query *subquery;
1112
+ /* is from security_barrier view? */
1113
+ bool security_barrier pg_node_attr(query_jumble_ignore);
1082
1114
 
1083
1115
  /*
1084
1116
  * Fields valid for a join RTE (else NULL/zero):
@@ -1123,18 +1155,22 @@ typedef struct RangeTblEntry
1123
1155
  * merged columns could not be dropped); this is not accounted for in
1124
1156
  * joinleftcols/joinrighttcols.
1125
1157
  */
1126
- JoinType jointype; /* type of join */
1127
- int joinmergedcols; /* number of merged (JOIN USING) columns */
1128
- List *joinaliasvars; /* list of alias-var expansions */
1129
- List *joinleftcols; /* left-side input column numbers */
1130
- List *joinrightcols; /* right-side input column numbers */
1158
+ JoinType jointype;
1159
+ /* number of merged (JOIN USING) columns */
1160
+ int joinmergedcols pg_node_attr(query_jumble_ignore);
1161
+ /* list of alias-var expansions */
1162
+ List *joinaliasvars pg_node_attr(query_jumble_ignore);
1163
+ /* left-side input column numbers */
1164
+ List *joinleftcols pg_node_attr(query_jumble_ignore);
1165
+ /* right-side input column numbers */
1166
+ List *joinrightcols pg_node_attr(query_jumble_ignore);
1131
1167
 
1132
1168
  /*
1133
1169
  * join_using_alias is an alias clause attached directly to JOIN/USING. It
1134
1170
  * is different from the alias field (below) in that it does not hide the
1135
1171
  * range variables of the tables being joined.
1136
1172
  */
1137
- Alias *join_using_alias;
1173
+ Alias *join_using_alias pg_node_attr(query_jumble_ignore);
1138
1174
 
1139
1175
  /*
1140
1176
  * Fields valid for a function RTE (else NIL/zero):
@@ -1144,8 +1180,10 @@ typedef struct RangeTblEntry
1144
1180
  * implicit, and must be accounted for "by hand" in places such as
1145
1181
  * expandRTE().
1146
1182
  */
1147
- List *functions; /* list of RangeTblFunction nodes */
1148
- bool funcordinality; /* is this called WITH ORDINALITY? */
1183
+ /* list of RangeTblFunction nodes */
1184
+ List *functions;
1185
+ /* is this called WITH ORDINALITY? */
1186
+ bool funcordinality;
1149
1187
 
1150
1188
  /*
1151
1189
  * Fields valid for a TableFunc RTE (else NULL):
@@ -1155,14 +1193,18 @@ typedef struct RangeTblEntry
1155
1193
  /*
1156
1194
  * Fields valid for a values RTE (else NIL):
1157
1195
  */
1158
- List *values_lists; /* list of expression lists */
1196
+ /* list of expression lists */
1197
+ List *values_lists;
1159
1198
 
1160
1199
  /*
1161
1200
  * Fields valid for a CTE RTE (else NULL/zero):
1162
1201
  */
1163
- char *ctename; /* name of the WITH list item */
1164
- Index ctelevelsup; /* number of query levels up */
1165
- bool self_reference; /* is this a recursive self-reference? */
1202
+ /* name of the WITH list item */
1203
+ char *ctename;
1204
+ /* number of query levels up */
1205
+ Index ctelevelsup;
1206
+ /* is this a recursive self-reference? */
1207
+ bool self_reference pg_node_attr(query_jumble_ignore);
1166
1208
 
1167
1209
  /*
1168
1210
  * Fields valid for CTE, VALUES, ENR, and TableFunc RTEs (else NIL):
@@ -1182,25 +1224,30 @@ typedef struct RangeTblEntry
1182
1224
  * all three lists (as well as an empty-string entry in eref). Testing
1183
1225
  * for zero coltype is the standard way to detect a dropped column.
1184
1226
  */
1185
- List *coltypes; /* OID list of column type OIDs */
1186
- List *coltypmods; /* integer list of column typmods */
1187
- List *colcollations; /* OID list of column collation OIDs */
1227
+ /* OID list of column type OIDs */
1228
+ List *coltypes pg_node_attr(query_jumble_ignore);
1229
+ /* integer list of column typmods */
1230
+ List *coltypmods pg_node_attr(query_jumble_ignore);
1231
+ /* OID list of column collation OIDs */
1232
+ List *colcollations pg_node_attr(query_jumble_ignore);
1188
1233
 
1189
1234
  /*
1190
1235
  * Fields valid for ENR RTEs (else NULL/zero):
1191
1236
  */
1192
- char *enrname; /* name of ephemeral named relation */
1193
- Cardinality enrtuples; /* estimated or actual from caller */
1237
+ /* name of ephemeral named relation */
1238
+ char *enrname;
1239
+ /* estimated or actual from caller */
1240
+ Cardinality enrtuples pg_node_attr(query_jumble_ignore);
1194
1241
 
1195
1242
  /*
1196
1243
  * Fields valid in all RTEs:
1197
1244
  */
1198
- Alias *alias; /* user-written alias clause, if any */
1199
- Alias *eref; /* expanded reference names */
1200
- bool lateral; /* subquery, function, or values is LATERAL? */
1201
- bool inh; /* inheritance requested? */
1202
- bool inFromCl; /* present in FROM clause? */
1203
- List *securityQuals; /* security barrier quals to apply, if any */
1245
+ /* was LATERAL specified? */
1246
+ bool lateral pg_node_attr(query_jumble_ignore);
1247
+ /* present in FROM clause? */
1248
+ bool inFromCl pg_node_attr(query_jumble_ignore);
1249
+ /* security barrier quals to apply, if any */
1250
+ List *securityQuals pg_node_attr(query_jumble_ignore);
1204
1251
  } RangeTblEntry;
1205
1252
 
1206
1253
  /*
@@ -1315,7 +1362,7 @@ typedef enum WCOKind
1315
1362
  WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */
1316
1363
  WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO UPDATE USING policy */
1317
1364
  WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */
1318
- WCO_RLS_MERGE_DELETE_CHECK /* RLS MERGE DELETE USING policy */
1365
+ WCO_RLS_MERGE_DELETE_CHECK, /* RLS MERGE DELETE USING policy */
1319
1366
  } WCOKind;
1320
1367
 
1321
1368
  typedef struct WithCheckOption
@@ -1453,7 +1500,7 @@ typedef enum GroupingSetKind
1453
1500
  GROUPING_SET_SIMPLE,
1454
1501
  GROUPING_SET_ROLLUP,
1455
1502
  GROUPING_SET_CUBE,
1456
- GROUPING_SET_SETS
1503
+ GROUPING_SET_SETS,
1457
1504
  } GroupingSetKind;
1458
1505
 
1459
1506
  typedef struct GroupingSet
@@ -1461,7 +1508,7 @@ typedef struct GroupingSet
1461
1508
  NodeTag type;
1462
1509
  GroupingSetKind kind pg_node_attr(query_jumble_ignore);
1463
1510
  List *content;
1464
- int location;
1511
+ ParseLoc location;
1465
1512
  } GroupingSet;
1466
1513
 
1467
1514
  /*
@@ -1472,6 +1519,8 @@ typedef struct GroupingSet
1472
1519
  * if the clause originally came from WINDOW, and is NULL if it originally
1473
1520
  * was an OVER clause (but note that we collapse out duplicate OVERs).
1474
1521
  * partitionClause and orderClause are lists of SortGroupClause structs.
1522
+ * partitionClause is sanitized by the query planner to remove any columns or
1523
+ * expressions belonging to redundant PathKeys.
1475
1524
  * If we have RANGE with offset PRECEDING/FOLLOWING, the semantics of that are
1476
1525
  * specified by startInRangeFunc/inRangeColl/inRangeAsc/inRangeNullsFirst
1477
1526
  * for the start offset, or endInRangeFunc/inRange* for the end offset.
@@ -1497,8 +1546,6 @@ typedef struct WindowClause
1497
1546
  int frameOptions; /* frame_clause options, see WindowDef */
1498
1547
  Node *startOffset; /* expression for starting bound, if any */
1499
1548
  Node *endOffset; /* expression for ending bound, if any */
1500
- /* qual to help short-circuit execution */
1501
- List *runCondition pg_node_attr(query_jumble_ignore);
1502
1549
  /* in_range function for startOffset */
1503
1550
  Oid startInRangeFunc pg_node_attr(query_jumble_ignore);
1504
1551
  /* in_range function for endOffset */
@@ -1547,7 +1594,7 @@ typedef struct WithClause
1547
1594
  NodeTag type;
1548
1595
  List *ctes; /* list of CommonTableExprs */
1549
1596
  bool recursive; /* true = WITH RECURSIVE */
1550
- int location; /* token location, or -1 if unknown */
1597
+ ParseLoc location; /* token location, or -1 if unknown */
1551
1598
  } WithClause;
1552
1599
 
1553
1600
  /*
@@ -1562,7 +1609,7 @@ typedef struct InferClause
1562
1609
  List *indexElems; /* IndexElems to infer unique index */
1563
1610
  Node *whereClause; /* qualification (partial-index predicate) */
1564
1611
  char *conname; /* Constraint name, or NULL if unnamed */
1565
- int location; /* token location, or -1 if unknown */
1612
+ ParseLoc location; /* token location, or -1 if unknown */
1566
1613
  } InferClause;
1567
1614
 
1568
1615
  /*
@@ -1578,7 +1625,7 @@ typedef struct OnConflictClause
1578
1625
  InferClause *infer; /* Optional index inference clause */
1579
1626
  List *targetList; /* the target list (of ResTarget) */
1580
1627
  Node *whereClause; /* qualifications */
1581
- int location; /* token location, or -1 if unknown */
1628
+ ParseLoc location; /* token location, or -1 if unknown */
1582
1629
  } OnConflictClause;
1583
1630
 
1584
1631
  /*
@@ -1590,7 +1637,7 @@ typedef enum CTEMaterialize
1590
1637
  {
1591
1638
  CTEMaterializeDefault, /* no option specified */
1592
1639
  CTEMaterializeAlways, /* MATERIALIZED */
1593
- CTEMaterializeNever /* NOT MATERIALIZED */
1640
+ CTEMaterializeNever, /* NOT MATERIALIZED */
1594
1641
  } CTEMaterialize;
1595
1642
 
1596
1643
  typedef struct CTESearchClause
@@ -1599,7 +1646,7 @@ typedef struct CTESearchClause
1599
1646
  List *search_col_list;
1600
1647
  bool search_breadth_first;
1601
1648
  char *search_seq_column;
1602
- int location;
1649
+ ParseLoc location;
1603
1650
  } CTESearchClause;
1604
1651
 
1605
1652
  typedef struct CTECycleClause
@@ -1610,7 +1657,7 @@ typedef struct CTECycleClause
1610
1657
  Node *cycle_mark_value;
1611
1658
  Node *cycle_mark_default;
1612
1659
  char *cycle_path_column;
1613
- int location;
1660
+ ParseLoc location;
1614
1661
  /* These fields are set during parse analysis: */
1615
1662
  Oid cycle_mark_type; /* common type of _value and _default */
1616
1663
  int cycle_mark_typmod;
@@ -1634,7 +1681,7 @@ typedef struct CommonTableExpr
1634
1681
  Node *ctequery; /* the CTE's subquery */
1635
1682
  CTESearchClause *search_clause pg_node_attr(query_jumble_ignore);
1636
1683
  CTECycleClause *cycle_clause pg_node_attr(query_jumble_ignore);
1637
- int location; /* token location, or -1 if unknown */
1684
+ ParseLoc location; /* token location, or -1 if unknown */
1638
1685
  /* These fields are set during parse analysis: */
1639
1686
  /* is this CTE actually recursive? */
1640
1687
  bool cterecursive pg_node_attr(query_jumble_ignore);
@@ -1670,7 +1717,7 @@ typedef struct CommonTableExpr
1670
1717
  typedef struct MergeWhenClause
1671
1718
  {
1672
1719
  NodeTag type;
1673
- bool matched; /* true=MATCHED, false=NOT MATCHED */
1720
+ MergeMatchKind matchKind; /* MATCHED/NOT MATCHED BY SOURCE/TARGET */
1674
1721
  CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1675
1722
  OverridingKind override; /* OVERRIDING clause */
1676
1723
  Node *condition; /* WHEN conditions (raw parser) */
@@ -1679,23 +1726,6 @@ typedef struct MergeWhenClause
1679
1726
  List *values; /* VALUES to INSERT, or NULL */
1680
1727
  } MergeWhenClause;
1681
1728
 
1682
- /*
1683
- * MergeAction -
1684
- * Transformed representation of a WHEN clause in a MERGE statement
1685
- */
1686
- typedef struct MergeAction
1687
- {
1688
- NodeTag type;
1689
- bool matched; /* true=MATCHED, false=NOT MATCHED */
1690
- CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1691
- /* OVERRIDING clause */
1692
- OverridingKind override pg_node_attr(query_jumble_ignore);
1693
- Node *qual; /* transformed WHEN conditions */
1694
- List *targetList; /* the target list (of TargetEntry) */
1695
- /* target attribute numbers of an UPDATE */
1696
- List *updateColnos pg_node_attr(query_jumble_ignore);
1697
- } MergeAction;
1698
-
1699
1729
  /*
1700
1730
  * TriggerTransition -
1701
1731
  * representation of transition row or table naming clause
@@ -1725,6 +1755,115 @@ typedef struct JsonOutput
1725
1755
  JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */
1726
1756
  } JsonOutput;
1727
1757
 
1758
+ /*
1759
+ * JsonArgument -
1760
+ * representation of argument from JSON PASSING clause
1761
+ */
1762
+ typedef struct JsonArgument
1763
+ {
1764
+ NodeTag type;
1765
+ JsonValueExpr *val; /* argument value expression */
1766
+ char *name; /* argument name */
1767
+ } JsonArgument;
1768
+
1769
+ /*
1770
+ * JsonQuotes -
1771
+ * representation of [KEEP|OMIT] QUOTES clause for JSON_QUERY()
1772
+ */
1773
+ typedef enum JsonQuotes
1774
+ {
1775
+ JS_QUOTES_UNSPEC, /* unspecified */
1776
+ JS_QUOTES_KEEP, /* KEEP QUOTES */
1777
+ JS_QUOTES_OMIT, /* OMIT QUOTES */
1778
+ } JsonQuotes;
1779
+
1780
+ /*
1781
+ * JsonFuncExpr -
1782
+ * untransformed representation of function expressions for
1783
+ * SQL/JSON query functions
1784
+ */
1785
+ typedef struct JsonFuncExpr
1786
+ {
1787
+ NodeTag type;
1788
+ JsonExprOp op; /* expression type */
1789
+ char *column_name; /* JSON_TABLE() column name or NULL if this is
1790
+ * not for a JSON_TABLE() */
1791
+ JsonValueExpr *context_item; /* context item expression */
1792
+ Node *pathspec; /* JSON path specification expression */
1793
+ List *passing; /* list of PASSING clause arguments, if any */
1794
+ JsonOutput *output; /* output clause, if specified */
1795
+ JsonBehavior *on_empty; /* ON EMPTY behavior */
1796
+ JsonBehavior *on_error; /* ON ERROR behavior */
1797
+ JsonWrapper wrapper; /* array wrapper behavior (JSON_QUERY only) */
1798
+ JsonQuotes quotes; /* omit or keep quotes? (JSON_QUERY only) */
1799
+ ParseLoc location; /* token location, or -1 if unknown */
1800
+ } JsonFuncExpr;
1801
+
1802
+ /*
1803
+ * JsonTablePathSpec
1804
+ * untransformed specification of JSON path expression with an optional
1805
+ * name
1806
+ */
1807
+ typedef struct JsonTablePathSpec
1808
+ {
1809
+ NodeTag type;
1810
+
1811
+ Node *string;
1812
+ char *name;
1813
+ ParseLoc name_location;
1814
+ ParseLoc location; /* location of 'string' */
1815
+ } JsonTablePathSpec;
1816
+
1817
+ /*
1818
+ * JsonTable -
1819
+ * untransformed representation of JSON_TABLE
1820
+ */
1821
+ typedef struct JsonTable
1822
+ {
1823
+ NodeTag type;
1824
+ JsonValueExpr *context_item; /* context item expression */
1825
+ JsonTablePathSpec *pathspec; /* JSON path specification */
1826
+ List *passing; /* list of PASSING clause arguments, if any */
1827
+ List *columns; /* list of JsonTableColumn */
1828
+ JsonBehavior *on_error; /* ON ERROR behavior */
1829
+ Alias *alias; /* table alias in FROM clause */
1830
+ bool lateral; /* does it have LATERAL prefix? */
1831
+ ParseLoc location; /* token location, or -1 if unknown */
1832
+ } JsonTable;
1833
+
1834
+ /*
1835
+ * JsonTableColumnType -
1836
+ * enumeration of JSON_TABLE column types
1837
+ */
1838
+ typedef enum JsonTableColumnType
1839
+ {
1840
+ JTC_FOR_ORDINALITY,
1841
+ JTC_REGULAR,
1842
+ JTC_EXISTS,
1843
+ JTC_FORMATTED,
1844
+ JTC_NESTED,
1845
+ } JsonTableColumnType;
1846
+
1847
+ /*
1848
+ * JsonTableColumn -
1849
+ * untransformed representation of JSON_TABLE column
1850
+ */
1851
+ typedef struct JsonTableColumn
1852
+ {
1853
+ NodeTag type;
1854
+ JsonTableColumnType coltype; /* column type */
1855
+ char *name; /* column name */
1856
+ TypeName *typeName; /* column type name */
1857
+ JsonTablePathSpec *pathspec; /* JSON path specification */
1858
+ JsonFormat *format; /* JSON format clause, if specified */
1859
+ JsonWrapper wrapper; /* WRAPPER behavior for formatted columns */
1860
+ JsonQuotes quotes; /* omit or keep quotes on scalar strings? */
1861
+ List *columns; /* nested columns */
1862
+ JsonBehavior *on_empty; /* ON EMPTY behavior */
1863
+ JsonBehavior *on_error; /* ON ERROR behavior */
1864
+ ParseLoc location; /* token location, or -1 if unknown */
1865
+ } JsonTableColumn;
1866
+
1728
1867
  /*
1729
1868
  * JsonKeyValue -
1730
1869
  * untransformed representation of JSON object key-value pair for
@@ -1737,6 +1876,43 @@ typedef struct JsonKeyValue
1737
1876
  JsonValueExpr *value; /* JSON value expression */
1738
1877
  } JsonKeyValue;
1739
1878
 
1879
+ /*
1880
+ * JsonParseExpr -
1881
+ * untransformed representation of JSON()
1882
+ */
1883
+ typedef struct JsonParseExpr
1884
+ {
1885
+ NodeTag type;
1886
+ JsonValueExpr *expr; /* string expression */
1887
+ JsonOutput *output; /* RETURNING clause, if specified */
1888
+ bool unique_keys; /* WITH UNIQUE KEYS? */
1889
+ ParseLoc location; /* token location, or -1 if unknown */
1890
+ } JsonParseExpr;
1891
+
1892
+ /*
1893
+ * JsonScalarExpr -
1894
+ * untransformed representation of JSON_SCALAR()
1895
+ */
1896
+ typedef struct JsonScalarExpr
1897
+ {
1898
+ NodeTag type;
1899
+ Expr *expr; /* scalar expression */
1900
+ JsonOutput *output; /* RETURNING clause, if specified */
1901
+ ParseLoc location; /* token location, or -1 if unknown */
1902
+ } JsonScalarExpr;
1903
+
1904
+ /*
1905
+ * JsonSerializeExpr -
1906
+ * untransformed representation of JSON_SERIALIZE() function
1907
+ */
1908
+ typedef struct JsonSerializeExpr
1909
+ {
1910
+ NodeTag type;
1911
+ JsonValueExpr *expr; /* json value expression */
1912
+ JsonOutput *output; /* RETURNING clause, if specified */
1913
+ ParseLoc location; /* token location, or -1 if unknown */
1914
+ } JsonSerializeExpr;
1915
+
1740
1916
  /*
1741
1917
  * JsonObjectConstructor -
1742
1918
  * untransformed representation of JSON_OBJECT() constructor
@@ -1748,7 +1924,7 @@ typedef struct JsonObjectConstructor
1748
1924
  JsonOutput *output; /* RETURNING clause, if specified */
1749
1925
  bool absent_on_null; /* skip NULL values? */
1750
1926
  bool unique; /* check key uniqueness? */
1751
- int location; /* token location, or -1 if unknown */
1927
+ ParseLoc location; /* token location, or -1 if unknown */
1752
1928
  } JsonObjectConstructor;
1753
1929
 
1754
1930
  /*
@@ -1761,7 +1937,7 @@ typedef struct JsonArrayConstructor
1761
1937
  List *exprs; /* list of JsonValueExpr elements */
1762
1938
  JsonOutput *output; /* RETURNING clause, if specified */
1763
1939
  bool absent_on_null; /* skip NULL elements? */
1764
- int location; /* token location, or -1 if unknown */
1940
+ ParseLoc location; /* token location, or -1 if unknown */
1765
1941
  } JsonArrayConstructor;
1766
1942
 
1767
1943
  /*
@@ -1775,7 +1951,7 @@ typedef struct JsonArrayQueryConstructor
1775
1951
  JsonOutput *output; /* RETURNING clause, if specified */
1776
1952
  JsonFormat *format; /* FORMAT clause for subquery, if specified */
1777
1953
  bool absent_on_null; /* skip NULL elements? */
1778
- int location; /* token location, or -1 if unknown */
1954
+ ParseLoc location; /* token location, or -1 if unknown */
1779
1955
  } JsonArrayQueryConstructor;
1780
1956
 
1781
1957
  /*
@@ -1790,7 +1966,7 @@ typedef struct JsonAggConstructor
1790
1966
  Node *agg_filter; /* FILTER clause, if any */
1791
1967
  List *agg_order; /* ORDER BY clause, if any */
1792
1968
  struct WindowDef *over; /* OVER clause, if any */
1793
- int location; /* token location, or -1 if unknown */
1969
+ ParseLoc location; /* token location, or -1 if unknown */
1794
1970
  } JsonAggConstructor;
1795
1971
 
1796
1972
  /*
@@ -1844,8 +2020,8 @@ typedef struct RawStmt
1844
2020
 
1845
2021
  NodeTag type;
1846
2022
  Node *stmt; /* raw parse tree */
1847
- int stmt_location; /* start location, or -1 if unknown */
1848
- int stmt_len; /* length in bytes; 0 means "rest of string" */
2023
+ ParseLoc stmt_location; /* start location, or -1 if unknown */
2024
+ ParseLoc stmt_len; /* length in bytes; 0 means "rest of string" */
1849
2025
  } RawStmt;
1850
2026
 
1851
2027
  /*****************************************************************************
@@ -1912,6 +2088,7 @@ typedef struct MergeStmt
1912
2088
  Node *sourceRelation; /* source relation */
1913
2089
  Node *joinCondition; /* join condition between source and target */
1914
2090
  List *mergeWhenClauses; /* list of MergeWhenClause(es) */
2091
+ List *returningList; /* list of expressions to return */
1915
2092
  WithClause *withClause; /* WITH clause */
1916
2093
  } MergeStmt;
1917
2094
 
@@ -1933,7 +2110,7 @@ typedef enum SetOperation
1933
2110
  SETOP_NONE = 0,
1934
2111
  SETOP_UNION,
1935
2112
  SETOP_INTERSECT,
1936
- SETOP_EXCEPT
2113
+ SETOP_EXCEPT,
1937
2114
  } SetOperation;
1938
2115
 
1939
2116
  typedef struct SelectStmt
@@ -2052,7 +2229,7 @@ typedef struct PLAssignStmt
2052
2229
  List *indirection; /* subscripts and field names, if any */
2053
2230
  int nnames; /* number of names to use in ColumnRef */
2054
2231
  SelectStmt *val; /* the PL/pgSQL expression to assign */
2055
- int location; /* name's token location, or -1 if unknown */
2232
+ ParseLoc location; /* name's token location, or -1 if unknown */
2056
2233
  } PLAssignStmt;
2057
2234
 
2058
2235
 
@@ -2129,7 +2306,7 @@ typedef enum ObjectType
2129
2306
  OBJECT_TSTEMPLATE,
2130
2307
  OBJECT_TYPE,
2131
2308
  OBJECT_USER_MAPPING,
2132
- OBJECT_VIEW
2309
+ OBJECT_VIEW,
2133
2310
  } ObjectType;
2134
2311
 
2135
2312
  /* ----------------------
@@ -2152,7 +2329,7 @@ typedef struct CreateSchemaStmt
2152
2329
  typedef enum DropBehavior
2153
2330
  {
2154
2331
  DROP_RESTRICT, /* drop fails if any dependent objects */
2155
- DROP_CASCADE /* remove dependent objects too */
2332
+ DROP_CASCADE, /* remove dependent objects too */
2156
2333
  } DropBehavior;
2157
2334
 
2158
2335
  /* ----------------------
@@ -2176,6 +2353,7 @@ typedef enum AlterTableType
2176
2353
  AT_CookedColumnDefault, /* add a pre-cooked column default */
2177
2354
  AT_DropNotNull, /* alter column drop not null */
2178
2355
  AT_SetNotNull, /* alter column set not null */
2356
+ AT_SetExpression, /* alter column set expression */
2179
2357
  AT_DropExpression, /* alter column drop expression */
2180
2358
  AT_CheckNotNull, /* check column is already marked not null */
2181
2359
  AT_SetStatistics, /* alter column set statistics */
@@ -2235,7 +2413,7 @@ typedef enum AlterTableType
2235
2413
  AT_AddIdentity, /* ADD IDENTITY */
2236
2414
  AT_SetIdentity, /* SET identity column options */
2237
2415
  AT_DropIdentity, /* DROP IDENTITY */
2238
- AT_ReAddStatistics /* internal to commands/tablecmds.c */
2416
+ AT_ReAddStatistics, /* internal to commands/tablecmds.c */
2239
2417
  } AlterTableType;
2240
2418
 
2241
2419
  typedef struct ReplicaIdentityStmt
@@ -2250,7 +2428,7 @@ typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
2250
2428
  NodeTag type;
2251
2429
  AlterTableType subtype; /* Type of table alteration to apply */
2252
2430
  char *name; /* column, constraint, or trigger to act on,
2253
- * or tablespace */
2431
+ * or tablespace, access method */
2254
2432
  int16 num; /* attribute number for columns referenced by
2255
2433
  * number */
2256
2434
  RoleSpec *newowner;
@@ -2307,7 +2485,7 @@ typedef enum GrantTargetType
2307
2485
  {
2308
2486
  ACL_TARGET_OBJECT, /* grant on specific named object(s) */
2309
2487
  ACL_TARGET_ALL_IN_SCHEMA, /* grant on all objects in given schema(s) */
2310
- ACL_TARGET_DEFAULTS /* ALTER DEFAULT PRIVILEGES */
2488
+ ACL_TARGET_DEFAULTS, /* ALTER DEFAULT PRIVILEGES */
2311
2489
  } GrantTargetType;
2312
2490
 
2313
2491
  typedef struct GrantStmt
@@ -2434,7 +2612,7 @@ typedef enum VariableSetKind
2434
2612
  VAR_SET_CURRENT, /* SET var FROM CURRENT */
2435
2613
  VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
2436
2614
  VAR_RESET, /* RESET var */
2437
- VAR_RESET_ALL /* RESET ALL */
2615
+ VAR_RESET_ALL, /* RESET ALL */
2438
2616
  } VariableSetKind;
2439
2617
 
2440
2618
  typedef struct VariableSetStmt
@@ -2532,7 +2710,7 @@ typedef enum ConstrType /* types of constraints */
2532
2710
  CONSTR_ATTR_DEFERRABLE, /* attributes for previous constraint node */
2533
2711
  CONSTR_ATTR_NOT_DEFERRABLE,
2534
2712
  CONSTR_ATTR_DEFERRED,
2535
- CONSTR_ATTR_IMMEDIATE
2713
+ CONSTR_ATTR_IMMEDIATE,
2536
2714
  } ConstrType;
2537
2715
 
2538
2716
  /* Foreign key action codes */
@@ -2549,40 +2727,33 @@ typedef enum ConstrType /* types of constraints */
2549
2727
 
2550
2728
  typedef struct Constraint
2551
2729
  {
2552
- pg_node_attr(custom_read_write)
2553
-
2554
2730
  NodeTag type;
2555
2731
  ConstrType contype; /* see above */
2556
-
2557
- /* Fields used for most/all constraint types: */
2558
2732
  char *conname; /* Constraint name, or NULL if unnamed */
2559
2733
  bool deferrable; /* DEFERRABLE? */
2560
2734
  bool initdeferred; /* INITIALLY DEFERRED? */
2561
- int location; /* token location, or -1 if unknown */
2562
-
2563
- /* Fields used for constraints with expressions (CHECK and DEFAULT): */
2735
+ bool skip_validation; /* skip validation of existing rows? */
2736
+ bool initially_valid; /* mark the new constraint as valid? */
2564
2737
  bool is_no_inherit; /* is constraint non-inheritable? */
2565
- Node *raw_expr; /* expr, as untransformed parse tree */
2566
- char *cooked_expr; /* expr, as nodeToString representation */
2738
+ Node *raw_expr; /* CHECK or DEFAULT expression, as
2739
+ * untransformed parse tree */
2740
+ char *cooked_expr; /* CHECK or DEFAULT expression, as
2741
+ * nodeToString representation */
2567
2742
  char generated_when; /* ALWAYS or BY DEFAULT */
2568
-
2569
- /* Fields used for unique constraints (UNIQUE and PRIMARY KEY): */
2743
+ int inhcount; /* initial inheritance count to apply, for
2744
+ * "raw" NOT NULL constraints */
2570
2745
  bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
2571
2746
  List *keys; /* String nodes naming referenced key
2572
- * column(s) */
2747
+ * column(s); for UNIQUE/PK/NOT NULL */
2573
2748
  List *including; /* String nodes naming referenced nonkey
2574
- * column(s) */
2575
-
2576
- /* Fields used for EXCLUSION constraints: */
2577
- List *exclusions; /* list of (IndexElem, operator name) pairs */
2578
-
2579
- /* Fields used for index constraints (UNIQUE, PRIMARY KEY, EXCLUSION): */
2749
+ * column(s); for UNIQUE/PK */
2750
+ List *exclusions; /* list of (IndexElem, operator name) pairs;
2751
+ * for exclusion constraints */
2580
2752
  List *options; /* options from WITH clause */
2581
2753
  char *indexname; /* existing index to use; otherwise NULL */
2582
2754
  char *indexspace; /* index tablespace; NULL for default */
2583
2755
  bool reset_default_tblspc; /* reset default_tablespace prior to
2584
2756
  * creating the index */
2585
- /* These could be, but currently are not, used for UNIQUE/PKEY: */
2586
2757
  char *access_method; /* index access method; NULL for default */
2587
2758
  Node *where_clause; /* partial index predicate */
2588
2759
 
@@ -2598,9 +2769,7 @@ typedef struct Constraint
2598
2769
  Oid old_pktable_oid; /* pg_constraint.confrelid of my former
2599
2770
  * self */
2600
2771
 
2601
- /* Fields used for constraints that allow a NOT VALID specification */
2602
- bool skip_validation; /* skip validation of existing rows? */
2603
- bool initially_valid; /* mark the new constraint as valid? */
2772
+ ParseLoc location; /* token location, or -1 if unknown */
2604
2773
  } Constraint;
2605
2774
 
2606
2775
  /* ----------------------
@@ -2769,7 +2938,7 @@ typedef enum ImportForeignSchemaType
2769
2938
  {
2770
2939
  FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */
2771
2940
  FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */
2772
- FDW_IMPORT_SCHEMA_EXCEPT /* exclude listed tables from import */
2941
+ FDW_IMPORT_SCHEMA_EXCEPT, /* exclude listed tables from import */
2773
2942
  } ImportForeignSchemaType;
2774
2943
 
2775
2944
  typedef struct ImportForeignSchemaStmt
@@ -2906,7 +3075,7 @@ typedef enum RoleStmtType
2906
3075
  {
2907
3076
  ROLESTMT_ROLE,
2908
3077
  ROLESTMT_USER,
2909
- ROLESTMT_GROUP
3078
+ ROLESTMT_GROUP,
2910
3079
  } RoleStmtType;
2911
3080
 
2912
3081
  typedef struct CreateRoleStmt
@@ -3151,7 +3320,7 @@ typedef enum FetchDirection
3151
3320
  FETCH_BACKWARD,
3152
3321
  /* for these, howMany indicates a position; only one row is fetched */
3153
3322
  FETCH_ABSOLUTE,
3154
- FETCH_RELATIVE
3323
+ FETCH_RELATIVE,
3155
3324
  } FetchDirection;
3156
3325
 
3157
3326
  #define FETCH_ALL LONG_MAX
@@ -3247,7 +3416,7 @@ typedef struct AlterStatsStmt
3247
3416
  {
3248
3417
  NodeTag type;
3249
3418
  List *defnames; /* qualified name (list of String) */
3250
- int stxstattarget; /* statistics target */
3419
+ Node *stxstattarget; /* statistics target */
3251
3420
  bool missing_ok; /* skip error if statistics object is missing */
3252
3421
  } AlterStatsStmt;
3253
3422
 
@@ -3276,7 +3445,7 @@ typedef enum FunctionParameterMode
3276
3445
  FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */
3277
3446
  FUNC_PARAM_TABLE = 't', /* table function output column */
3278
3447
  /* this is not used in pg_proc: */
3279
- FUNC_PARAM_DEFAULT = 'd' /* default; effectively same as IN */
3448
+ FUNC_PARAM_DEFAULT = 'd', /* default; effectively same as IN */
3280
3449
  } FunctionParameterMode;
3281
3450
 
3282
3451
  typedef struct FunctionParameter
@@ -3333,11 +3502,12 @@ typedef struct InlineCodeBlock
3333
3502
  typedef struct CallStmt
3334
3503
  {
3335
3504
  NodeTag type;
3336
- FuncCall *funccall; /* from the parser */
3505
+ /* from the parser */
3506
+ FuncCall *funccall pg_node_attr(query_jumble_ignore);
3337
3507
  /* transformed call, with only input args */
3338
- FuncExpr *funcexpr pg_node_attr(query_jumble_ignore);
3508
+ FuncExpr *funcexpr;
3339
3509
  /* transformed output-argument expressions */
3340
- List *outargs pg_node_attr(query_jumble_ignore);
3510
+ List *outargs;
3341
3511
  } CallStmt;
3342
3512
 
3343
3513
  typedef struct CallContext
@@ -3491,7 +3661,7 @@ typedef enum TransactionStmtKind
3491
3661
  TRANS_STMT_ROLLBACK_TO,
3492
3662
  TRANS_STMT_PREPARE,
3493
3663
  TRANS_STMT_COMMIT_PREPARED,
3494
- TRANS_STMT_ROLLBACK_PREPARED
3664
+ TRANS_STMT_ROLLBACK_PREPARED,
3495
3665
  } TransactionStmtKind;
3496
3666
 
3497
3667
  typedef struct TransactionStmt
@@ -3499,9 +3669,13 @@ typedef struct TransactionStmt
3499
3669
  NodeTag type;
3500
3670
  TransactionStmtKind kind; /* see above */
3501
3671
  List *options; /* for BEGIN/START commands */
3502
- char *savepoint_name; /* for savepoint commands */
3503
- char *gid; /* for two-phase-commit related commands */
3672
+ /* for savepoint commands */
3673
+ char *savepoint_name pg_node_attr(query_jumble_ignore);
3674
+ /* for two-phase-commit related commands */
3675
+ char *gid pg_node_attr(query_jumble_ignore);
3504
3676
  bool chain; /* AND CHAIN option */
3677
+ /* token location, or -1 if unknown */
3678
+ ParseLoc location pg_node_attr(query_jumble_location);
3505
3679
  } TransactionStmt;
3506
3680
 
3507
3681
  /* ----------------------
@@ -3560,7 +3734,7 @@ typedef enum ViewCheckOption
3560
3734
  {
3561
3735
  NO_CHECK_OPTION,
3562
3736
  LOCAL_CHECK_OPTION,
3563
- CASCADED_CHECK_OPTION
3737
+ CASCADED_CHECK_OPTION,
3564
3738
  } ViewCheckOption;
3565
3739
 
3566
3740
  typedef struct ViewStmt
@@ -3752,7 +3926,7 @@ typedef enum DiscardMode
3752
3926
  DISCARD_ALL,
3753
3927
  DISCARD_PLANS,
3754
3928
  DISCARD_SEQUENCES,
3755
- DISCARD_TEMP
3929
+ DISCARD_TEMP,
3756
3930
  } DiscardMode;
3757
3931
 
3758
3932
  typedef struct DiscardStmt
@@ -3794,7 +3968,7 @@ typedef enum ReindexObjectType
3794
3968
  REINDEX_OBJECT_TABLE, /* table or materialized view */
3795
3969
  REINDEX_OBJECT_SCHEMA, /* schema */
3796
3970
  REINDEX_OBJECT_SYSTEM, /* system catalogs */
3797
- REINDEX_OBJECT_DATABASE /* database */
3971
+ REINDEX_OBJECT_DATABASE, /* database */
3798
3972
  } ReindexObjectType;
3799
3973
 
3800
3974
  typedef struct ReindexStmt
@@ -3882,8 +4056,17 @@ typedef struct ExecuteStmt
3882
4056
  typedef struct DeallocateStmt
3883
4057
  {
3884
4058
  NodeTag type;
3885
- char *name; /* The name of the plan to remove */
3886
- /* NULL means DEALLOCATE ALL */
4059
+ /* The name of the plan to remove, NULL if DEALLOCATE ALL */
4060
+ char *name pg_node_attr(query_jumble_ignore);
4061
+
4062
+ /*
4063
+ * True if DEALLOCATE ALL. This is redundant with "name == NULL", but we
4064
+ * make it a separate field so that exactly this condition (and not the
4065
+ * precise name) will be accounted for in query jumbling.
4066
+ */
4067
+ bool isall;
4068
+ /* token location, or -1 if unknown */
4069
+ ParseLoc location pg_node_attr(query_jumble_location);
3887
4070
  } DeallocateStmt;
3888
4071
 
3889
4072
  /*
@@ -3925,7 +4108,7 @@ typedef enum AlterTSConfigType
3925
4108
  ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN,
3926
4109
  ALTER_TSCONFIG_REPLACE_DICT,
3927
4110
  ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN,
3928
- ALTER_TSCONFIG_DROP_MAPPING
4111
+ ALTER_TSCONFIG_DROP_MAPPING,
3929
4112
  } AlterTSConfigType;
3930
4113
 
3931
4114
  typedef struct AlterTSConfigurationStmt
@@ -3962,7 +4145,7 @@ typedef enum PublicationObjSpecType
3962
4145
  PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */
3963
4146
  PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of
3964
4147
  * search_path */
3965
- PUBLICATIONOBJ_CONTINUATION /* Continuation of previous type */
4148
+ PUBLICATIONOBJ_CONTINUATION, /* Continuation of previous type */
3966
4149
  } PublicationObjSpecType;
3967
4150
 
3968
4151
  typedef struct PublicationObjSpec
@@ -3971,7 +4154,7 @@ typedef struct PublicationObjSpec
3971
4154
  PublicationObjSpecType pubobjtype; /* type of this publication object */
3972
4155
  char *name;
3973
4156
  PublicationTable *pubtable;
3974
- int location; /* token location, or -1 if unknown */
4157
+ ParseLoc location; /* token location, or -1 if unknown */
3975
4158
  } PublicationObjSpec;
3976
4159
 
3977
4160
  typedef struct CreatePublicationStmt
@@ -3987,7 +4170,7 @@ typedef enum AlterPublicationAction
3987
4170
  {
3988
4171
  AP_AddObjects, /* add objects to publication */
3989
4172
  AP_DropObjects, /* remove objects from publication */
3990
- AP_SetObjects /* set list of objects */
4173
+ AP_SetObjects, /* set list of objects */
3991
4174
  } AlterPublicationAction;
3992
4175
 
3993
4176
  typedef struct AlterPublicationStmt
@@ -4026,7 +4209,7 @@ typedef enum AlterSubscriptionType
4026
4209
  ALTER_SUBSCRIPTION_DROP_PUBLICATION,
4027
4210
  ALTER_SUBSCRIPTION_REFRESH,
4028
4211
  ALTER_SUBSCRIPTION_ENABLED,
4029
- ALTER_SUBSCRIPTION_SKIP
4212
+ ALTER_SUBSCRIPTION_SKIP,
4030
4213
  } AlterSubscriptionType;
4031
4214
 
4032
4215
  typedef struct AlterSubscriptionStmt