pg_query 2.1.0 → 4.2.1

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 (472) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +104 -0
  3. data/README.md +59 -31
  4. data/Rakefile +2 -2
  5. data/ext/pg_query/extconf.rb +8 -2
  6. data/ext/pg_query/include/access/amapi.h +45 -1
  7. data/ext/pg_query/include/access/attmap.h +1 -1
  8. data/ext/pg_query/include/access/attnum.h +2 -2
  9. data/ext/pg_query/include/access/clog.h +4 -2
  10. data/ext/pg_query/include/access/commit_ts.h +6 -9
  11. data/ext/pg_query/include/access/detoast.h +1 -11
  12. data/ext/pg_query/include/access/genam.h +15 -12
  13. data/ext/pg_query/include/access/gin.h +2 -2
  14. data/ext/pg_query/include/access/htup.h +1 -1
  15. data/ext/pg_query/include/access/htup_details.h +75 -87
  16. data/ext/pg_query/include/access/itup.h +7 -1
  17. data/ext/pg_query/include/access/parallel.h +2 -2
  18. data/ext/pg_query/include/access/printtup.h +1 -1
  19. data/ext/pg_query/include/access/relation.h +1 -1
  20. data/ext/pg_query/include/access/relscan.h +17 -2
  21. data/ext/pg_query/include/access/rmgr.h +30 -3
  22. data/ext/pg_query/include/access/rmgrlist.h +23 -23
  23. data/ext/pg_query/include/access/sdir.h +1 -1
  24. data/ext/pg_query/include/access/skey.h +1 -1
  25. data/ext/pg_query/include/access/stratnum.h +4 -2
  26. data/ext/pg_query/include/access/sysattr.h +1 -1
  27. data/ext/pg_query/include/access/table.h +2 -1
  28. data/ext/pg_query/include/access/tableam.h +272 -20
  29. data/ext/pg_query/include/access/toast_compression.h +73 -0
  30. data/ext/pg_query/include/access/transam.h +123 -13
  31. data/ext/pg_query/include/access/tupconvert.h +1 -1
  32. data/ext/pg_query/include/access/tupdesc.h +1 -1
  33. data/ext/pg_query/include/access/tupmacs.h +3 -3
  34. data/ext/pg_query/include/access/twophase.h +5 -1
  35. data/ext/pg_query/include/access/xact.h +79 -19
  36. data/ext/pg_query/include/access/xlog.h +60 -155
  37. data/ext/pg_query/include/access/xlog_internal.h +50 -14
  38. data/ext/pg_query/include/access/xlogdefs.h +8 -16
  39. data/ext/pg_query/include/access/xlogprefetcher.h +55 -0
  40. data/ext/pg_query/include/access/xlogreader.h +148 -32
  41. data/ext/pg_query/include/access/xlogrecord.h +18 -9
  42. data/ext/pg_query/include/access/xlogrecovery.h +157 -0
  43. data/ext/pg_query/include/c.h +101 -44
  44. data/ext/pg_query/include/catalog/catalog.h +3 -1
  45. data/ext/pg_query/include/catalog/catversion.h +2 -2
  46. data/ext/pg_query/include/catalog/dependency.h +10 -16
  47. data/ext/pg_query/include/catalog/genbki.h +83 -5
  48. data/ext/pg_query/include/catalog/index.h +18 -3
  49. data/ext/pg_query/include/catalog/indexing.h +12 -324
  50. data/ext/pg_query/include/catalog/namespace.h +4 -2
  51. data/ext/pg_query/include/catalog/objectaccess.h +70 -2
  52. data/ext/pg_query/include/catalog/objectaddress.h +11 -6
  53. data/ext/pg_query/include/catalog/pg_aggregate.h +14 -10
  54. data/ext/pg_query/include/catalog/pg_aggregate_d.h +2 -1
  55. data/ext/pg_query/include/catalog/pg_am.h +4 -1
  56. data/ext/pg_query/include/catalog/pg_am_d.h +3 -1
  57. data/ext/pg_query/include/catalog/pg_attribute.h +27 -10
  58. data/ext/pg_query/include/catalog/pg_attribute_d.h +21 -18
  59. data/ext/pg_query/include/catalog/pg_authid.h +7 -2
  60. data/ext/pg_query/include/catalog/pg_authid_d.h +17 -9
  61. data/ext/pg_query/include/catalog/pg_class.h +45 -15
  62. data/ext/pg_query/include/catalog/pg_class_d.h +31 -2
  63. data/ext/pg_query/include/catalog/pg_collation.h +33 -8
  64. data/ext/pg_query/include/catalog/pg_collation_d.h +20 -3
  65. data/ext/pg_query/include/catalog/pg_constraint.h +38 -12
  66. data/ext/pg_query/include/catalog/pg_constraint_d.h +10 -4
  67. data/ext/pg_query/include/catalog/pg_control.h +5 -5
  68. data/ext/pg_query/include/catalog/pg_conversion.h +7 -4
  69. data/ext/pg_query/include/catalog/pg_conversion_d.h +4 -1
  70. data/ext/pg_query/include/catalog/pg_depend.h +11 -7
  71. data/ext/pg_query/include/catalog/pg_depend_d.h +3 -1
  72. data/ext/pg_query/include/catalog/pg_event_trigger.h +9 -3
  73. data/ext/pg_query/include/catalog/pg_event_trigger_d.h +3 -1
  74. data/ext/pg_query/include/catalog/pg_index.h +17 -7
  75. data/ext/pg_query/include/catalog/pg_index_d.h +20 -17
  76. data/ext/pg_query/include/catalog/pg_language.h +10 -5
  77. data/ext/pg_query/include/catalog/pg_language_d.h +3 -1
  78. data/ext/pg_query/include/catalog/pg_namespace.h +7 -2
  79. data/ext/pg_query/include/catalog/pg_namespace_d.h +3 -1
  80. data/ext/pg_query/include/catalog/pg_opclass.h +8 -5
  81. data/ext/pg_query/include/catalog/pg_opclass_d.h +3 -1
  82. data/ext/pg_query/include/catalog/pg_operator.h +21 -16
  83. data/ext/pg_query/include/catalog/pg_operator_d.h +37 -1
  84. data/ext/pg_query/include/catalog/pg_opfamily.h +6 -3
  85. data/ext/pg_query/include/catalog/pg_opfamily_d.h +3 -1
  86. data/ext/pg_query/include/catalog/pg_parameter_acl.h +60 -0
  87. data/ext/pg_query/include/catalog/pg_parameter_acl_d.h +34 -0
  88. data/ext/pg_query/include/catalog/pg_partitioned_table.h +20 -9
  89. data/ext/pg_query/include/catalog/pg_partitioned_table_d.h +2 -1
  90. data/ext/pg_query/include/catalog/pg_proc.h +20 -11
  91. data/ext/pg_query/include/catalog/pg_proc_d.h +10 -8
  92. data/ext/pg_query/include/catalog/pg_publication.h +50 -4
  93. data/ext/pg_query/include/catalog/pg_publication_d.h +3 -1
  94. data/ext/pg_query/include/catalog/pg_replication_origin.h +6 -1
  95. data/ext/pg_query/include/catalog/pg_replication_origin_d.h +5 -1
  96. data/ext/pg_query/include/catalog/pg_statistic.h +19 -12
  97. data/ext/pg_query/include/catalog/pg_statistic_d.h +2 -1
  98. data/ext/pg_query/include/catalog/pg_statistic_ext.h +19 -5
  99. data/ext/pg_query/include/catalog/pg_statistic_ext_d.h +7 -2
  100. data/ext/pg_query/include/catalog/pg_transform.h +8 -5
  101. data/ext/pg_query/include/catalog/pg_transform_d.h +3 -1
  102. data/ext/pg_query/include/catalog/pg_trigger.h +24 -8
  103. data/ext/pg_query/include/catalog/pg_trigger_d.h +4 -1
  104. data/ext/pg_query/include/catalog/pg_ts_config.h +6 -3
  105. data/ext/pg_query/include/catalog/pg_ts_config_d.h +3 -1
  106. data/ext/pg_query/include/catalog/pg_ts_dict.h +8 -3
  107. data/ext/pg_query/include/catalog/pg_ts_dict_d.h +3 -1
  108. data/ext/pg_query/include/catalog/pg_ts_parser.h +6 -3
  109. data/ext/pg_query/include/catalog/pg_ts_parser_d.h +3 -1
  110. data/ext/pg_query/include/catalog/pg_ts_template.h +6 -3
  111. data/ext/pg_query/include/catalog/pg_ts_template_d.h +3 -1
  112. data/ext/pg_query/include/catalog/pg_type.h +56 -24
  113. data/ext/pg_query/include/catalog/pg_type_d.h +70 -31
  114. data/ext/pg_query/include/catalog/storage.h +5 -3
  115. data/ext/pg_query/include/commands/async.h +4 -5
  116. data/ext/pg_query/include/commands/dbcommands.h +2 -1
  117. data/ext/pg_query/include/commands/defrem.h +11 -24
  118. data/ext/pg_query/include/commands/event_trigger.h +2 -2
  119. data/ext/pg_query/include/commands/explain.h +1 -1
  120. data/ext/pg_query/include/commands/prepare.h +1 -1
  121. data/ext/pg_query/include/commands/tablespace.h +3 -1
  122. data/ext/pg_query/include/commands/trigger.h +27 -17
  123. data/ext/pg_query/include/commands/user.h +2 -2
  124. data/ext/pg_query/include/commands/vacuum.h +88 -41
  125. data/ext/pg_query/include/commands/variable.h +1 -1
  126. data/ext/pg_query/include/common/file_perm.h +4 -4
  127. data/ext/pg_query/include/common/hashfn.h +1 -1
  128. data/ext/pg_query/include/common/ip.h +1 -7
  129. data/ext/pg_query/include/common/keywords.h +2 -6
  130. data/ext/pg_query/include/common/kwlookup.h +1 -1
  131. data/ext/pg_query/include/common/pg_prng.h +60 -0
  132. data/ext/pg_query/include/common/relpath.h +2 -2
  133. data/ext/pg_query/include/common/string.h +24 -1
  134. data/ext/pg_query/include/common/unicode_combining_table.h +114 -2
  135. data/ext/pg_query/include/common/unicode_east_asian_fw_table.h +125 -0
  136. data/ext/pg_query/include/datatype/timestamp.h +40 -1
  137. data/ext/pg_query/include/executor/execdesc.h +1 -1
  138. data/ext/pg_query/include/executor/executor.h +65 -22
  139. data/ext/pg_query/include/executor/functions.h +17 -3
  140. data/ext/pg_query/include/executor/instrument.h +33 -16
  141. data/ext/pg_query/include/executor/spi.h +41 -3
  142. data/ext/pg_query/include/executor/tablefunc.h +1 -1
  143. data/ext/pg_query/include/executor/tuptable.h +1 -1
  144. data/ext/pg_query/include/fmgr.h +13 -7
  145. data/ext/pg_query/include/funcapi.h +16 -4
  146. data/ext/pg_query/include/getaddrinfo.h +1 -1
  147. data/ext/pg_query/include/jit/jit.h +11 -11
  148. data/ext/pg_query/include/kwlist_d.h +517 -494
  149. data/ext/pg_query/include/lib/dshash.h +112 -0
  150. data/ext/pg_query/include/lib/ilist.h +20 -1
  151. data/ext/pg_query/include/lib/pairingheap.h +1 -1
  152. data/ext/pg_query/include/lib/simplehash.h +150 -25
  153. data/ext/pg_query/include/lib/sort_template.h +432 -0
  154. data/ext/pg_query/include/lib/stringinfo.h +1 -1
  155. data/ext/pg_query/include/libpq/auth.h +6 -4
  156. data/ext/pg_query/include/libpq/crypt.h +5 -4
  157. data/ext/pg_query/include/libpq/hba.h +43 -4
  158. data/ext/pg_query/include/libpq/libpq-be.h +23 -6
  159. data/ext/pg_query/include/libpq/libpq.h +31 -20
  160. data/ext/pg_query/include/libpq/pqcomm.h +17 -31
  161. data/ext/pg_query/include/libpq/pqformat.h +1 -1
  162. data/ext/pg_query/include/libpq/pqsignal.h +4 -4
  163. data/ext/pg_query/include/mb/pg_wchar.h +106 -23
  164. data/ext/pg_query/include/mb/stringinfo_mb.h +1 -1
  165. data/ext/pg_query/include/miscadmin.h +71 -52
  166. data/ext/pg_query/include/nodes/bitmapset.h +1 -1
  167. data/ext/pg_query/include/nodes/execnodes.h +272 -80
  168. data/ext/pg_query/include/nodes/extensible.h +4 -2
  169. data/ext/pg_query/include/nodes/lockoptions.h +1 -1
  170. data/ext/pg_query/include/nodes/makefuncs.h +7 -6
  171. data/ext/pg_query/include/nodes/memnodes.h +5 -3
  172. data/ext/pg_query/include/nodes/nodeFuncs.h +1 -1
  173. data/ext/pg_query/include/nodes/nodes.h +30 -11
  174. data/ext/pg_query/include/nodes/params.h +1 -1
  175. data/ext/pg_query/include/nodes/parsenodes.h +327 -94
  176. data/ext/pg_query/include/nodes/pathnodes.h +245 -67
  177. data/ext/pg_query/include/nodes/pg_list.h +75 -68
  178. data/ext/pg_query/include/nodes/plannodes.h +128 -30
  179. data/ext/pg_query/include/nodes/primnodes.h +99 -47
  180. data/ext/pg_query/include/nodes/print.h +1 -1
  181. data/ext/pg_query/include/nodes/tidbitmap.h +1 -1
  182. data/ext/pg_query/include/nodes/value.h +58 -39
  183. data/ext/pg_query/include/optimizer/cost.h +9 -2
  184. data/ext/pg_query/include/optimizer/geqo.h +9 -7
  185. data/ext/pg_query/include/optimizer/geqo_gene.h +1 -1
  186. data/ext/pg_query/include/optimizer/optimizer.h +25 -22
  187. data/ext/pg_query/include/optimizer/paths.h +6 -6
  188. data/ext/pg_query/include/optimizer/planmain.h +15 -14
  189. data/ext/pg_query/include/parser/analyze.h +19 -5
  190. data/ext/pg_query/include/parser/gram.h +947 -913
  191. data/ext/pg_query/include/parser/gramparse.h +1 -1
  192. data/ext/pg_query/include/parser/kwlist.h +463 -453
  193. data/ext/pg_query/include/parser/parse_agg.h +2 -7
  194. data/ext/pg_query/include/parser/parse_coerce.h +4 -1
  195. data/ext/pg_query/include/parser/parse_expr.h +2 -3
  196. data/ext/pg_query/include/parser/parse_func.h +2 -1
  197. data/ext/pg_query/include/parser/parse_node.h +21 -9
  198. data/ext/pg_query/include/parser/parse_oper.h +1 -3
  199. data/ext/pg_query/include/parser/parse_relation.h +5 -4
  200. data/ext/pg_query/include/parser/parse_type.h +1 -1
  201. data/ext/pg_query/include/parser/parser.h +31 -4
  202. data/ext/pg_query/include/parser/parsetree.h +1 -1
  203. data/ext/pg_query/include/parser/scanner.h +1 -1
  204. data/ext/pg_query/include/parser/scansup.h +2 -5
  205. data/ext/pg_query/include/partitioning/partdefs.h +1 -1
  206. data/ext/pg_query/include/pg_config.h +94 -46
  207. data/ext/pg_query/include/pg_config_manual.h +74 -21
  208. data/ext/pg_query/include/pg_getopt.h +6 -6
  209. data/ext/pg_query/include/pg_query.h +5 -4
  210. data/ext/pg_query/include/pg_query_enum_defs.c +358 -241
  211. data/ext/pg_query/include/pg_query_fingerprint_conds.c +44 -7
  212. data/ext/pg_query/include/pg_query_fingerprint_defs.c +1220 -422
  213. data/ext/pg_query/include/pg_query_outfuncs_conds.c +43 -13
  214. data/ext/pg_query/include/pg_query_outfuncs_defs.c +152 -26
  215. data/ext/pg_query/include/pg_query_readfuncs_conds.c +11 -2
  216. data/ext/pg_query/include/pg_query_readfuncs_defs.c +174 -30
  217. data/ext/pg_query/include/pg_trace.h +1 -1
  218. data/ext/pg_query/include/pgstat.h +449 -1237
  219. data/ext/pg_query/include/pgtime.h +14 -4
  220. data/ext/pg_query/include/pl_gram.h +126 -128
  221. data/ext/pg_query/include/pl_reserved_kwlist.h +1 -1
  222. data/ext/pg_query/include/pl_reserved_kwlist_d.h +10 -10
  223. data/ext/pg_query/include/pl_unreserved_kwlist.h +2 -3
  224. data/ext/pg_query/include/pl_unreserved_kwlist_d.h +54 -56
  225. data/ext/pg_query/include/plerrcodes.h +9 -1
  226. data/ext/pg_query/include/plpgsql.h +52 -54
  227. data/ext/pg_query/include/port/atomics/arch-arm.h +7 -1
  228. data/ext/pg_query/include/port/atomics/arch-ppc.h +1 -1
  229. data/ext/pg_query/include/port/atomics/arch-x86.h +1 -1
  230. data/ext/pg_query/include/port/atomics/fallback.h +1 -1
  231. data/ext/pg_query/include/port/atomics/generic-gcc.h +3 -3
  232. data/ext/pg_query/include/port/atomics/generic.h +1 -1
  233. data/ext/pg_query/include/port/atomics.h +1 -1
  234. data/ext/pg_query/include/port/pg_bitutils.h +88 -12
  235. data/ext/pg_query/include/port/pg_bswap.h +1 -1
  236. data/ext/pg_query/include/port/pg_crc32c.h +1 -1
  237. data/ext/pg_query/include/port.h +72 -43
  238. data/ext/pg_query/include/portability/instr_time.h +1 -1
  239. data/ext/pg_query/include/postgres.h +60 -16
  240. data/ext/pg_query/include/postmaster/autovacuum.h +17 -17
  241. data/ext/pg_query/include/postmaster/auxprocess.h +20 -0
  242. data/ext/pg_query/include/postmaster/bgworker.h +2 -1
  243. data/ext/pg_query/include/postmaster/bgworker_internals.h +2 -2
  244. data/ext/pg_query/include/postmaster/bgwriter.h +5 -5
  245. data/ext/pg_query/include/postmaster/fork_process.h +1 -1
  246. data/ext/pg_query/include/postmaster/interrupt.h +1 -1
  247. data/ext/pg_query/include/postmaster/pgarch.h +42 -8
  248. data/ext/pg_query/include/postmaster/postmaster.h +18 -17
  249. data/ext/pg_query/include/postmaster/startup.h +39 -0
  250. data/ext/pg_query/include/postmaster/syslogger.h +15 -10
  251. data/ext/pg_query/include/postmaster/walwriter.h +3 -3
  252. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +1422 -916
  253. data/ext/pg_query/include/protobuf/pg_query.pb.h +43678 -32769
  254. data/ext/pg_query/include/regex/regex.h +18 -16
  255. data/ext/pg_query/include/replication/logicallauncher.h +3 -5
  256. data/ext/pg_query/include/replication/logicalproto.h +161 -17
  257. data/ext/pg_query/include/replication/logicalworker.h +1 -1
  258. data/ext/pg_query/include/replication/origin.h +7 -7
  259. data/ext/pg_query/include/replication/reorderbuffer.h +262 -44
  260. data/ext/pg_query/include/replication/slot.h +23 -12
  261. data/ext/pg_query/include/replication/syncrep.h +5 -5
  262. data/ext/pg_query/include/replication/walreceiver.h +145 -13
  263. data/ext/pg_query/include/replication/walsender.h +8 -8
  264. data/ext/pg_query/include/rewrite/prs2lock.h +1 -1
  265. data/ext/pg_query/include/rewrite/rewriteHandler.h +1 -3
  266. data/ext/pg_query/include/rewrite/rewriteManip.h +1 -1
  267. data/ext/pg_query/include/rewrite/rewriteSupport.h +1 -1
  268. data/ext/pg_query/include/storage/backendid.h +3 -3
  269. data/ext/pg_query/include/storage/block.h +4 -10
  270. data/ext/pg_query/include/storage/buf.h +1 -1
  271. data/ext/pg_query/include/storage/bufmgr.h +19 -14
  272. data/ext/pg_query/include/storage/bufpage.h +6 -8
  273. data/ext/pg_query/include/storage/condition_variable.h +13 -2
  274. data/ext/pg_query/include/storage/dsm.h +4 -1
  275. data/ext/pg_query/include/storage/dsm_impl.h +3 -2
  276. data/ext/pg_query/include/storage/fd.h +33 -3
  277. data/ext/pg_query/include/storage/fileset.h +40 -0
  278. data/ext/pg_query/include/storage/ipc.h +4 -1
  279. data/ext/pg_query/include/storage/item.h +1 -1
  280. data/ext/pg_query/include/storage/itemid.h +1 -1
  281. data/ext/pg_query/include/storage/itemptr.h +3 -1
  282. data/ext/pg_query/include/storage/large_object.h +2 -2
  283. data/ext/pg_query/include/storage/latch.h +9 -13
  284. data/ext/pg_query/include/storage/lmgr.h +2 -1
  285. data/ext/pg_query/include/storage/lock.h +17 -13
  286. data/ext/pg_query/include/storage/lockdefs.h +2 -2
  287. data/ext/pg_query/include/storage/lwlock.h +6 -32
  288. data/ext/pg_query/include/storage/lwlocknames.h +0 -1
  289. data/ext/pg_query/include/storage/off.h +1 -1
  290. data/ext/pg_query/include/storage/pg_sema.h +1 -1
  291. data/ext/pg_query/include/storage/pg_shmem.h +9 -7
  292. data/ext/pg_query/include/storage/pmsignal.h +15 -4
  293. data/ext/pg_query/include/storage/predicate.h +4 -4
  294. data/ext/pg_query/include/storage/proc.h +183 -55
  295. data/ext/pg_query/include/storage/procarray.h +98 -0
  296. data/ext/pg_query/include/storage/proclist_types.h +1 -1
  297. data/ext/pg_query/include/storage/procsignal.h +3 -7
  298. data/ext/pg_query/include/storage/relfilenode.h +1 -1
  299. data/ext/pg_query/include/storage/s_lock.h +67 -4
  300. data/ext/pg_query/include/storage/sharedfileset.h +3 -11
  301. data/ext/pg_query/include/storage/shm_mq.h +5 -4
  302. data/ext/pg_query/include/storage/shm_toc.h +1 -1
  303. data/ext/pg_query/include/storage/shmem.h +1 -1
  304. data/ext/pg_query/include/storage/sinval.h +3 -3
  305. data/ext/pg_query/include/storage/sinvaladt.h +1 -1
  306. data/ext/pg_query/include/storage/smgr.h +10 -8
  307. data/ext/pg_query/include/storage/spin.h +2 -2
  308. data/ext/pg_query/include/storage/standby.h +13 -6
  309. data/ext/pg_query/include/storage/standbydefs.h +2 -2
  310. data/ext/pg_query/include/storage/sync.h +7 -3
  311. data/ext/pg_query/include/tcop/cmdtag.h +1 -1
  312. data/ext/pg_query/include/tcop/cmdtaglist.h +3 -2
  313. data/ext/pg_query/include/tcop/deparse_utility.h +1 -1
  314. data/ext/pg_query/include/tcop/dest.h +1 -1
  315. data/ext/pg_query/include/tcop/fastpath.h +1 -2
  316. data/ext/pg_query/include/tcop/pquery.h +7 -1
  317. data/ext/pg_query/include/tcop/tcopprot.h +19 -11
  318. data/ext/pg_query/include/tcop/utility.h +7 -3
  319. data/ext/pg_query/include/tsearch/ts_cache.h +2 -2
  320. data/ext/pg_query/include/utils/acl.h +24 -3
  321. data/ext/pg_query/include/utils/aclchk_internal.h +1 -1
  322. data/ext/pg_query/include/utils/array.h +7 -2
  323. data/ext/pg_query/include/utils/backend_progress.h +44 -0
  324. data/ext/pg_query/include/utils/backend_status.h +321 -0
  325. data/ext/pg_query/include/utils/builtins.h +11 -11
  326. data/ext/pg_query/include/utils/bytea.h +3 -2
  327. data/ext/pg_query/include/utils/catcache.h +1 -1
  328. data/ext/pg_query/include/utils/date.h +1 -1
  329. data/ext/pg_query/include/utils/datetime.h +8 -7
  330. data/ext/pg_query/include/utils/datum.h +9 -1
  331. data/ext/pg_query/include/utils/dsa.h +1 -1
  332. data/ext/pg_query/include/utils/dynahash.h +4 -3
  333. data/ext/pg_query/include/utils/elog.h +52 -21
  334. data/ext/pg_query/include/utils/errcodes.h +2 -0
  335. data/ext/pg_query/include/utils/expandeddatum.h +1 -1
  336. data/ext/pg_query/include/utils/expandedrecord.h +1 -1
  337. data/ext/pg_query/include/utils/float.h +7 -7
  338. data/ext/pg_query/include/utils/fmgroids.h +1300 -696
  339. data/ext/pg_query/include/utils/fmgrprotos.h +199 -16
  340. data/ext/pg_query/include/utils/fmgrtab.h +6 -5
  341. data/ext/pg_query/include/utils/guc.h +69 -43
  342. data/ext/pg_query/include/utils/guc_tables.h +23 -19
  343. data/ext/pg_query/include/utils/hsearch.h +15 -11
  344. data/ext/pg_query/include/utils/inval.h +5 -1
  345. data/ext/pg_query/include/utils/lsyscache.h +11 -1
  346. data/ext/pg_query/include/utils/memdebug.h +1 -1
  347. data/ext/pg_query/include/utils/memutils.h +8 -3
  348. data/ext/pg_query/include/utils/numeric.h +19 -5
  349. data/ext/pg_query/include/utils/palloc.h +25 -3
  350. data/ext/pg_query/include/utils/partcache.h +1 -1
  351. data/ext/pg_query/include/utils/pg_locale.h +17 -9
  352. data/ext/pg_query/include/utils/pg_lsn.h +1 -1
  353. data/ext/pg_query/include/utils/pgstat_internal.h +784 -0
  354. data/ext/pg_query/include/utils/pidfile.h +1 -1
  355. data/ext/pg_query/include/utils/plancache.h +6 -5
  356. data/ext/pg_query/include/utils/portal.h +12 -1
  357. data/ext/pg_query/include/utils/ps_status.h +1 -1
  358. data/ext/pg_query/include/utils/queryenvironment.h +1 -1
  359. data/ext/pg_query/include/utils/queryjumble.h +88 -0
  360. data/ext/pg_query/include/utils/regproc.h +14 -3
  361. data/ext/pg_query/include/utils/rel.h +71 -20
  362. data/ext/pg_query/include/utils/relcache.h +9 -7
  363. data/ext/pg_query/include/utils/reltrigger.h +1 -1
  364. data/ext/pg_query/include/utils/resowner.h +1 -1
  365. data/ext/pg_query/include/utils/rls.h +2 -2
  366. data/ext/pg_query/include/utils/ruleutils.h +4 -1
  367. data/ext/pg_query/include/utils/sharedtuplestore.h +1 -1
  368. data/ext/pg_query/include/utils/snapmgr.h +35 -14
  369. data/ext/pg_query/include/utils/snapshot.h +14 -1
  370. data/ext/pg_query/include/utils/sortsupport.h +117 -2
  371. data/ext/pg_query/include/utils/syscache.h +6 -1
  372. data/ext/pg_query/include/utils/timeout.h +11 -4
  373. data/ext/pg_query/include/utils/timestamp.h +6 -5
  374. data/ext/pg_query/include/utils/tuplesort.h +25 -11
  375. data/ext/pg_query/include/utils/tuplestore.h +2 -2
  376. data/ext/pg_query/include/utils/typcache.h +24 -17
  377. data/ext/pg_query/include/utils/tzparser.h +1 -1
  378. data/ext/pg_query/include/utils/varlena.h +5 -3
  379. data/ext/pg_query/include/utils/wait_event.h +289 -0
  380. data/ext/pg_query/include/utils/xml.h +4 -4
  381. data/ext/pg_query/pg_query.pb-c.c +4318 -2307
  382. data/ext/pg_query/pg_query_deparse.c +1114 -381
  383. data/ext/pg_query/pg_query_fingerprint.c +46 -10
  384. data/ext/pg_query/pg_query_fingerprint.h +3 -1
  385. data/ext/pg_query/pg_query_json_plpgsql.c +55 -12
  386. data/ext/pg_query/pg_query_normalize.c +163 -20
  387. data/ext/pg_query/pg_query_outfuncs.h +1 -0
  388. data/ext/pg_query/pg_query_outfuncs_json.c +65 -16
  389. data/ext/pg_query/pg_query_outfuncs_protobuf.c +70 -10
  390. data/ext/pg_query/pg_query_parse.c +1 -1
  391. data/ext/pg_query/pg_query_parse_plpgsql.c +79 -16
  392. data/ext/pg_query/pg_query_readfuncs_protobuf.c +42 -8
  393. data/ext/pg_query/pg_query_ruby.c +1 -1
  394. data/ext/pg_query/pg_query_scan.c +2 -1
  395. data/ext/pg_query/pg_query_split.c +3 -2
  396. data/ext/pg_query/src_backend_catalog_namespace.c +21 -9
  397. data/ext/pg_query/src_backend_catalog_pg_proc.c +4 -1
  398. data/ext/pg_query/src_backend_commands_define.c +11 -1
  399. data/ext/pg_query/src_backend_nodes_bitmapset.c +3 -1
  400. data/ext/pg_query/src_backend_nodes_copyfuncs.c +424 -109
  401. data/ext/pg_query/src_backend_nodes_equalfuncs.c +291 -46
  402. data/ext/pg_query/src_backend_nodes_extensible.c +1 -1
  403. data/ext/pg_query/src_backend_nodes_list.c +86 -11
  404. data/ext/pg_query/src_backend_nodes_makefuncs.c +5 -4
  405. data/ext/pg_query/src_backend_nodes_nodeFuncs.c +55 -12
  406. data/ext/pg_query/src_backend_nodes_value.c +28 -19
  407. data/ext/pg_query/src_backend_parser_gram.c +33890 -31262
  408. data/ext/pg_query/src_backend_parser_parser.c +26 -7
  409. data/ext/pg_query/src_backend_parser_scan.c +644 -441
  410. data/ext/pg_query/src_backend_parser_scansup.c +4 -28
  411. data/ext/pg_query/src_backend_postmaster_postmaster.c +77 -106
  412. data/ext/pg_query/src_backend_storage_ipc_ipc.c +13 -4
  413. data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +5 -4
  414. data/ext/pg_query/src_backend_tcop_postgres.c +73 -24
  415. data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +140 -0
  416. data/ext/pg_query/src_backend_utils_adt_datum.c +13 -1
  417. data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
  418. data/ext/pg_query/src_backend_utils_adt_format_type.c +6 -2
  419. data/ext/pg_query/src_backend_utils_adt_ruleutils.c +109 -15
  420. data/ext/pg_query/src_backend_utils_error_assert.c +16 -14
  421. data/ext/pg_query/src_backend_utils_error_elog.c +172 -99
  422. data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +12 -17
  423. data/ext/pg_query/src_backend_utils_hash_dynahash.c +40 -10
  424. data/ext/pg_query/src_backend_utils_init_globals.c +5 -5
  425. data/ext/pg_query/src_backend_utils_mb_mbutils.c +55 -66
  426. data/ext/pg_query/src_backend_utils_misc_guc.c +207 -45
  427. data/ext/pg_query/src_backend_utils_mmgr_aset.c +7 -5
  428. data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +123 -35
  429. data/ext/pg_query/src_common_encnames.c +1 -1
  430. data/ext/pg_query/src_common_hashfn.c +3 -3
  431. data/ext/pg_query/src_common_keywords.c +15 -2
  432. data/ext/pg_query/src_common_kwlist_d.h +517 -494
  433. data/ext/pg_query/src_common_kwlookup.c +1 -1
  434. data/ext/pg_query/src_common_pg_prng.c +152 -0
  435. data/ext/pg_query/src_common_psprintf.c +1 -1
  436. data/ext/pg_query/src_common_string.c +7 -1
  437. data/ext/pg_query/src_common_stringinfo.c +1 -1
  438. data/ext/pg_query/src_common_wchar.c +712 -109
  439. data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +49 -22
  440. data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +1 -18
  441. data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1235 -1261
  442. data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
  443. data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +10 -10
  444. data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +2 -2
  445. data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +54 -56
  446. data/ext/pg_query/src_port_pg_bitutils.c +41 -52
  447. data/ext/pg_query/src_port_pgsleep.c +1 -1
  448. data/ext/pg_query/src_port_pgstrcasecmp.c +1 -1
  449. data/ext/pg_query/src_port_qsort.c +12 -224
  450. data/ext/pg_query/src_port_snprintf.c +46 -20
  451. data/ext/pg_query/src_port_strerror.c +9 -19
  452. data/ext/pg_query/src_port_strnlen.c +1 -1
  453. data/lib/pg_query/deparse.rb +7 -1
  454. data/lib/pg_query/filter_columns.rb +6 -4
  455. data/lib/pg_query/fingerprint.rb +18 -3
  456. data/lib/pg_query/node.rb +2 -2
  457. data/lib/pg_query/param_refs.rb +1 -1
  458. data/lib/pg_query/parse.rb +87 -51
  459. data/lib/pg_query/pg_query_pb.rb +1109 -942
  460. data/lib/pg_query/treewalker.rb +6 -0
  461. data/lib/pg_query/truncate.rb +54 -8
  462. data/lib/pg_query/version.rb +1 -1
  463. metadata +29 -18
  464. data/ext/pg_query/include/access/xloginsert.h +0 -64
  465. data/ext/pg_query/include/bootstrap/bootstrap.h +0 -62
  466. data/ext/pg_query/include/parser/parse_clause.h +0 -54
  467. data/ext/pg_query/include/parser/parse_collate.h +0 -27
  468. data/ext/pg_query/include/parser/parse_target.h +0 -46
  469. data/ext/pg_query/src_backend_libpq_pqcomm.c +0 -651
  470. data/ext/pg_query/src_backend_parser_parse_expr.c +0 -313
  471. data/ext/pg_query/src_port_erand48.c +0 -127
  472. data/ext/pg_query/src_port_random.c +0 -31
@@ -23,6 +23,7 @@
23
23
  * - _copyBitmapIndexScan
24
24
  * - _copyBitmapHeapScan
25
25
  * - _copyTidScan
26
+ * - _copyTidRangeScan
26
27
  * - _copySubqueryScan
27
28
  * - _copyFunctionScan
28
29
  * - _copyTableFuncScan
@@ -38,6 +39,7 @@
38
39
  * - _copyMergeJoin
39
40
  * - _copyHashJoin
40
41
  * - _copyMaterial
42
+ * - _copyMemoize
41
43
  * - _copySort
42
44
  * - CopySortFields
43
45
  * - _copyIncrementalSort
@@ -113,15 +115,22 @@
113
115
  * - _copySpecialJoinInfo
114
116
  * - _copyAppendRelInfo
115
117
  * - _copyPlaceHolderInfo
116
- * - _copyValue
118
+ * - _copyInteger
119
+ * - _copyFloat
120
+ * - _copyBoolean
121
+ * - _copyString
122
+ * - _copyBitString
117
123
  * - _copyExtensibleNode
118
124
  * - _copyQuery
119
125
  * - _copyRawStmt
120
126
  * - _copyInsertStmt
121
127
  * - _copyDeleteStmt
122
128
  * - _copyUpdateStmt
129
+ * - _copyMergeStmt
123
130
  * - _copySelectStmt
124
131
  * - _copySetOperationStmt
132
+ * - _copyReturnStmt
133
+ * - _copyPLAssignStmt
125
134
  * - _copyAlterTableStmt
126
135
  * - _copyAlterTableCmd
127
136
  * - _copyAlterCollationStmt
@@ -174,6 +183,7 @@
174
183
  * - _copyAlterOpFamilyStmt
175
184
  * - _copyCreatedbStmt
176
185
  * - _copyAlterDatabaseStmt
186
+ * - _copyAlterDatabaseRefreshCollStmt
177
187
  * - _copyAlterDatabaseSetStmt
178
188
  * - _copyDropdbStmt
179
189
  * - _copyVacuumStmt
@@ -234,13 +244,13 @@
234
244
  * - _copyCreateSubscriptionStmt
235
245
  * - _copyAlterSubscriptionStmt
236
246
  * - _copyDropSubscriptionStmt
237
- * - _copyAExpr
247
+ * - _copyA_Expr
238
248
  * - _copyColumnRef
239
249
  * - _copyParamRef
240
- * - _copyAConst
250
+ * - _copyA_Const
241
251
  * - _copyFuncCall
242
- * - _copyAStar
243
- * - _copyAIndices
252
+ * - _copyA_Star
253
+ * - _copyA_Indices
244
254
  * - _copyA_Indirection
245
255
  * - _copyA_ArrayExpr
246
256
  * - _copyResTarget
@@ -256,6 +266,7 @@
256
266
  * - _copyRangeTableFuncCol
257
267
  * - _copyTypeName
258
268
  * - _copyIndexElem
269
+ * - _copyStatsElem
259
270
  * - _copyColumnDef
260
271
  * - _copyConstraint
261
272
  * - _copyDefElem
@@ -271,7 +282,11 @@
271
282
  * - _copyWithClause
272
283
  * - _copyInferClause
273
284
  * - _copyOnConflictClause
285
+ * - _copyCTESearchClause
286
+ * - _copyCTECycleClause
274
287
  * - _copyCommonTableExpr
288
+ * - _copyMergeWhenClause
289
+ * - _copyMergeAction
275
290
  * - _copyObjectWithArgs
276
291
  * - _copyAccessPriv
277
292
  * - _copyXmlSerialize
@@ -282,6 +297,8 @@
282
297
  * - _copyPartitionBoundSpec
283
298
  * - _copyPartitionRangeDatum
284
299
  * - _copyPartitionCmd
300
+ * - _copyPublicationObject
301
+ * - _copyPublicationTable
285
302
  * - _copyForeignKeyCacheInfo
286
303
  *--------------------------------------------------------------------
287
304
  */
@@ -299,7 +316,7 @@
299
316
  * be handled easily in a simple depth-first traversal.
300
317
  *
301
318
  *
302
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
319
+ * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
303
320
  * Portions Copyright (c) 1994, Regents of the University of California
304
321
  *
305
322
  * IDENTIFICATION
@@ -341,12 +358,19 @@
341
358
  #define COPY_STRING_FIELD(fldname) \
342
359
  (newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) NULL)
343
360
 
361
+ /* Copy a field that is an inline array */
362
+ #define COPY_ARRAY_FIELD(fldname) \
363
+ memcpy(newnode->fldname, from->fldname, sizeof(newnode->fldname))
364
+
344
365
  /* Copy a field that is a pointer to a simple palloc'd object of size sz */
345
366
  #define COPY_POINTER_FIELD(fldname, sz) \
346
367
  do { \
347
368
  Size _size = (sz); \
348
- newnode->fldname = palloc(_size); \
349
- memcpy(newnode->fldname, from->fldname, _size); \
369
+ if (_size > 0) \
370
+ { \
371
+ newnode->fldname = palloc(_size); \
372
+ memcpy(newnode->fldname, from->fldname, _size); \
373
+ } \
350
374
  } while (0)
351
375
 
352
376
  /* Copy a parse location field (for Copy, this is same as scalar case) */
@@ -379,7 +403,6 @@ _copyPlannedStmt(const PlannedStmt *from)
379
403
  COPY_NODE_FIELD(planTree);
380
404
  COPY_NODE_FIELD(rtable);
381
405
  COPY_NODE_FIELD(resultRelations);
382
- COPY_NODE_FIELD(rootResultRelations);
383
406
  COPY_NODE_FIELD(appendRelations);
384
407
  COPY_NODE_FIELD(subplans);
385
408
  COPY_BITMAPSET_FIELD(rewindPlanIDs);
@@ -409,6 +432,7 @@ CopyPlanFields(const Plan *from, Plan *newnode)
409
432
  COPY_SCALAR_FIELD(plan_width);
410
433
  COPY_SCALAR_FIELD(parallel_aware);
411
434
  COPY_SCALAR_FIELD(parallel_safe);
435
+ COPY_SCALAR_FIELD(async_capable);
412
436
  COPY_SCALAR_FIELD(plan_node_id);
413
437
  COPY_NODE_FIELD(targetlist);
414
438
  COPY_NODE_FIELD(qual);
@@ -495,9 +519,7 @@ _copyModifyTable(const ModifyTable *from)
495
519
  COPY_SCALAR_FIELD(rootRelation);
496
520
  COPY_SCALAR_FIELD(partColsUpdated);
497
521
  COPY_NODE_FIELD(resultRelations);
498
- COPY_SCALAR_FIELD(resultRelIndex);
499
- COPY_SCALAR_FIELD(rootResultRelIndex);
500
- COPY_NODE_FIELD(plans);
522
+ COPY_NODE_FIELD(updateColnosLists);
501
523
  COPY_NODE_FIELD(withCheckOptionLists);
502
524
  COPY_NODE_FIELD(returningLists);
503
525
  COPY_NODE_FIELD(fdwPrivLists);
@@ -507,9 +529,11 @@ _copyModifyTable(const ModifyTable *from)
507
529
  COPY_SCALAR_FIELD(onConflictAction);
508
530
  COPY_NODE_FIELD(arbiterIndexes);
509
531
  COPY_NODE_FIELD(onConflictSet);
532
+ COPY_NODE_FIELD(onConflictCols);
510
533
  COPY_NODE_FIELD(onConflictWhere);
511
534
  COPY_SCALAR_FIELD(exclRelRTI);
512
535
  COPY_NODE_FIELD(exclRelTlist);
536
+ COPY_NODE_FIELD(mergeActionLists);
513
537
 
514
538
  return newnode;
515
539
  }
@@ -532,6 +556,7 @@ _copyAppend(const Append *from)
532
556
  */
533
557
  COPY_BITMAPSET_FIELD(apprelids);
534
558
  COPY_NODE_FIELD(appendplans);
559
+ COPY_SCALAR_FIELD(nasyncplans);
535
560
  COPY_SCALAR_FIELD(first_partial_plan);
536
561
  COPY_NODE_FIELD(part_prune_info);
537
562
 
@@ -584,12 +609,9 @@ _copyRecursiveUnion(const RecursiveUnion *from)
584
609
  */
585
610
  COPY_SCALAR_FIELD(wtParam);
586
611
  COPY_SCALAR_FIELD(numCols);
587
- if (from->numCols > 0)
588
- {
589
- COPY_POINTER_FIELD(dupColIdx, from->numCols * sizeof(AttrNumber));
590
- COPY_POINTER_FIELD(dupOperators, from->numCols * sizeof(Oid));
591
- COPY_POINTER_FIELD(dupCollations, from->numCols * sizeof(Oid));
592
- }
612
+ COPY_POINTER_FIELD(dupColIdx, from->numCols * sizeof(AttrNumber));
613
+ COPY_POINTER_FIELD(dupOperators, from->numCols * sizeof(Oid));
614
+ COPY_POINTER_FIELD(dupCollations, from->numCols * sizeof(Oid));
593
615
  COPY_SCALAR_FIELD(numGroups);
594
616
 
595
617
  return newnode;
@@ -803,6 +825,7 @@ _copyIndexOnlyScan(const IndexOnlyScan *from)
803
825
  */
804
826
  COPY_SCALAR_FIELD(indexid);
805
827
  COPY_NODE_FIELD(indexqual);
828
+ COPY_NODE_FIELD(recheckqual);
806
829
  COPY_NODE_FIELD(indexorderby);
807
830
  COPY_NODE_FIELD(indextlist);
808
831
  COPY_SCALAR_FIELD(indexorderdir);
@@ -876,6 +899,27 @@ _copyTidScan(const TidScan *from)
876
899
  return newnode;
877
900
  }
878
901
 
902
+ /*
903
+ * _copyTidRangeScan
904
+ */
905
+ static TidRangeScan *
906
+ _copyTidRangeScan(const TidRangeScan *from)
907
+ {
908
+ TidRangeScan *newnode = makeNode(TidRangeScan);
909
+
910
+ /*
911
+ * copy node superclass fields
912
+ */
913
+ CopyScanFields((const Scan *) from, (Scan *) newnode);
914
+
915
+ /*
916
+ * copy remainder of node
917
+ */
918
+ COPY_NODE_FIELD(tidrangequals);
919
+
920
+ return newnode;
921
+ }
922
+
879
923
  /*
880
924
  * _copySubqueryScan
881
925
  */
@@ -893,6 +937,7 @@ _copySubqueryScan(const SubqueryScan *from)
893
937
  * copy remainder of node
894
938
  */
895
939
  COPY_NODE_FIELD(subplan);
940
+ COPY_SCALAR_FIELD(scanstatus);
896
941
 
897
942
  return newnode;
898
943
  }
@@ -1042,6 +1087,7 @@ _copyForeignScan(const ForeignScan *from)
1042
1087
  * copy remainder of node
1043
1088
  */
1044
1089
  COPY_SCALAR_FIELD(operation);
1090
+ COPY_SCALAR_FIELD(resultRelation);
1045
1091
  COPY_SCALAR_FIELD(fs_server);
1046
1092
  COPY_NODE_FIELD(fdw_exprs);
1047
1093
  COPY_NODE_FIELD(fdw_private);
@@ -1162,13 +1208,10 @@ _copyMergeJoin(const MergeJoin *from)
1162
1208
  COPY_SCALAR_FIELD(skip_mark_restore);
1163
1209
  COPY_NODE_FIELD(mergeclauses);
1164
1210
  numCols = list_length(from->mergeclauses);
1165
- if (numCols > 0)
1166
- {
1167
- COPY_POINTER_FIELD(mergeFamilies, numCols * sizeof(Oid));
1168
- COPY_POINTER_FIELD(mergeCollations, numCols * sizeof(Oid));
1169
- COPY_POINTER_FIELD(mergeStrategies, numCols * sizeof(int));
1170
- COPY_POINTER_FIELD(mergeNullsFirst, numCols * sizeof(bool));
1171
- }
1211
+ COPY_POINTER_FIELD(mergeFamilies, numCols * sizeof(Oid));
1212
+ COPY_POINTER_FIELD(mergeCollations, numCols * sizeof(Oid));
1213
+ COPY_POINTER_FIELD(mergeStrategies, numCols * sizeof(int));
1214
+ COPY_POINTER_FIELD(mergeNullsFirst, numCols * sizeof(bool));
1172
1215
 
1173
1216
  return newnode;
1174
1217
  }
@@ -1215,6 +1258,35 @@ _copyMaterial(const Material *from)
1215
1258
  }
1216
1259
 
1217
1260
 
1261
+ /*
1262
+ * _copyMemoize
1263
+ */
1264
+ static Memoize *
1265
+ _copyMemoize(const Memoize *from)
1266
+ {
1267
+ Memoize *newnode = makeNode(Memoize);
1268
+
1269
+ /*
1270
+ * copy node superclass fields
1271
+ */
1272
+ CopyPlanFields((const Plan *) from, (Plan *) newnode);
1273
+
1274
+ /*
1275
+ * copy remainder of node
1276
+ */
1277
+ COPY_SCALAR_FIELD(numKeys);
1278
+ COPY_POINTER_FIELD(hashOperators, sizeof(Oid) * from->numKeys);
1279
+ COPY_POINTER_FIELD(collations, sizeof(Oid) * from->numKeys);
1280
+ COPY_NODE_FIELD(param_exprs);
1281
+ COPY_SCALAR_FIELD(singlerow);
1282
+ COPY_SCALAR_FIELD(binary_mode);
1283
+ COPY_SCALAR_FIELD(est_entries);
1284
+ COPY_BITMAPSET_FIELD(keyparamids);
1285
+
1286
+ return newnode;
1287
+ }
1288
+
1289
+
1218
1290
  /*
1219
1291
  * CopySortFields
1220
1292
  *
@@ -1303,12 +1375,9 @@ _copyAgg(const Agg *from)
1303
1375
  COPY_SCALAR_FIELD(aggstrategy);
1304
1376
  COPY_SCALAR_FIELD(aggsplit);
1305
1377
  COPY_SCALAR_FIELD(numCols);
1306
- if (from->numCols > 0)
1307
- {
1308
- COPY_POINTER_FIELD(grpColIdx, from->numCols * sizeof(AttrNumber));
1309
- COPY_POINTER_FIELD(grpOperators, from->numCols * sizeof(Oid));
1310
- COPY_POINTER_FIELD(grpCollations, from->numCols * sizeof(Oid));
1311
- }
1378
+ COPY_POINTER_FIELD(grpColIdx, from->numCols * sizeof(AttrNumber));
1379
+ COPY_POINTER_FIELD(grpOperators, from->numCols * sizeof(Oid));
1380
+ COPY_POINTER_FIELD(grpCollations, from->numCols * sizeof(Oid));
1312
1381
  COPY_SCALAR_FIELD(numGroups);
1313
1382
  COPY_SCALAR_FIELD(transitionSpace);
1314
1383
  COPY_BITMAPSET_FIELD(aggParams);
@@ -1330,27 +1399,24 @@ _copyWindowAgg(const WindowAgg *from)
1330
1399
 
1331
1400
  COPY_SCALAR_FIELD(winref);
1332
1401
  COPY_SCALAR_FIELD(partNumCols);
1333
- if (from->partNumCols > 0)
1334
- {
1335
- COPY_POINTER_FIELD(partColIdx, from->partNumCols * sizeof(AttrNumber));
1336
- COPY_POINTER_FIELD(partOperators, from->partNumCols * sizeof(Oid));
1337
- COPY_POINTER_FIELD(partCollations, from->partNumCols * sizeof(Oid));
1338
- }
1402
+ COPY_POINTER_FIELD(partColIdx, from->partNumCols * sizeof(AttrNumber));
1403
+ COPY_POINTER_FIELD(partOperators, from->partNumCols * sizeof(Oid));
1404
+ COPY_POINTER_FIELD(partCollations, from->partNumCols * sizeof(Oid));
1339
1405
  COPY_SCALAR_FIELD(ordNumCols);
1340
- if (from->ordNumCols > 0)
1341
- {
1342
- COPY_POINTER_FIELD(ordColIdx, from->ordNumCols * sizeof(AttrNumber));
1343
- COPY_POINTER_FIELD(ordOperators, from->ordNumCols * sizeof(Oid));
1344
- COPY_POINTER_FIELD(ordCollations, from->ordNumCols * sizeof(Oid));
1345
- }
1406
+ COPY_POINTER_FIELD(ordColIdx, from->ordNumCols * sizeof(AttrNumber));
1407
+ COPY_POINTER_FIELD(ordOperators, from->ordNumCols * sizeof(Oid));
1408
+ COPY_POINTER_FIELD(ordCollations, from->ordNumCols * sizeof(Oid));
1346
1409
  COPY_SCALAR_FIELD(frameOptions);
1347
1410
  COPY_NODE_FIELD(startOffset);
1348
1411
  COPY_NODE_FIELD(endOffset);
1412
+ COPY_NODE_FIELD(runCondition);
1413
+ COPY_NODE_FIELD(runConditionOrig);
1349
1414
  COPY_SCALAR_FIELD(startInRangeFunc);
1350
1415
  COPY_SCALAR_FIELD(endInRangeFunc);
1351
1416
  COPY_SCALAR_FIELD(inRangeColl);
1352
1417
  COPY_SCALAR_FIELD(inRangeAsc);
1353
1418
  COPY_SCALAR_FIELD(inRangeNullsFirst);
1419
+ COPY_SCALAR_FIELD(topWindow);
1354
1420
 
1355
1421
  return newnode;
1356
1422
  }
@@ -1782,6 +1848,8 @@ _copyAggref(const Aggref *from)
1782
1848
  COPY_SCALAR_FIELD(aggkind);
1783
1849
  COPY_SCALAR_FIELD(agglevelsup);
1784
1850
  COPY_SCALAR_FIELD(aggsplit);
1851
+ COPY_SCALAR_FIELD(aggno);
1852
+ COPY_SCALAR_FIELD(aggtransno);
1785
1853
  COPY_LOCATION_FIELD(location);
1786
1854
 
1787
1855
  return newnode;
@@ -1836,6 +1904,7 @@ _copySubscriptingRef(const SubscriptingRef *from)
1836
1904
 
1837
1905
  COPY_SCALAR_FIELD(refcontainertype);
1838
1906
  COPY_SCALAR_FIELD(refelemtype);
1907
+ COPY_SCALAR_FIELD(refrestype);
1839
1908
  COPY_SCALAR_FIELD(reftypmod);
1840
1909
  COPY_SCALAR_FIELD(refcollid);
1841
1910
  COPY_NODE_FIELD(refupperindexpr);
@@ -1953,6 +2022,8 @@ _copyScalarArrayOpExpr(const ScalarArrayOpExpr *from)
1953
2022
 
1954
2023
  COPY_SCALAR_FIELD(opno);
1955
2024
  COPY_SCALAR_FIELD(opfuncid);
2025
+ COPY_SCALAR_FIELD(hashfuncid);
2026
+ COPY_SCALAR_FIELD(negfuncid);
1956
2027
  COPY_SCALAR_FIELD(useOr);
1957
2028
  COPY_SCALAR_FIELD(inputcollid);
1958
2029
  COPY_NODE_FIELD(args);
@@ -2495,6 +2566,7 @@ _copyJoinExpr(const JoinExpr *from)
2495
2566
  COPY_NODE_FIELD(larg);
2496
2567
  COPY_NODE_FIELD(rarg);
2497
2568
  COPY_NODE_FIELD(usingClause);
2569
+ COPY_NODE_FIELD(join_using_alias);
2498
2570
  COPY_NODE_FIELD(quals);
2499
2571
  COPY_NODE_FIELD(alias);
2500
2572
  COPY_SCALAR_FIELD(rtindex);
@@ -2575,6 +2647,7 @@ _copyRestrictInfo(const RestrictInfo *from)
2575
2647
  COPY_SCALAR_FIELD(can_join);
2576
2648
  COPY_SCALAR_FIELD(pseudoconstant);
2577
2649
  COPY_SCALAR_FIELD(leakproof);
2650
+ COPY_SCALAR_FIELD(has_volatile);
2578
2651
  COPY_SCALAR_FIELD(security_level);
2579
2652
  COPY_BITMAPSET_FIELD(clause_relids);
2580
2653
  COPY_BITMAPSET_FIELD(required_relids);
@@ -2602,6 +2675,8 @@ _copyRestrictInfo(const RestrictInfo *from)
2602
2675
  COPY_SCALAR_FIELD(right_bucketsize);
2603
2676
  COPY_SCALAR_FIELD(left_mcvfreq);
2604
2677
  COPY_SCALAR_FIELD(right_mcvfreq);
2678
+ COPY_SCALAR_FIELD(left_hasheqoperator);
2679
+ COPY_SCALAR_FIELD(right_hasheqoperator);
2605
2680
 
2606
2681
  return newnode;
2607
2682
  }
@@ -2705,6 +2780,7 @@ _copyRangeTblEntry(const RangeTblEntry *from)
2705
2780
  COPY_NODE_FIELD(joinaliasvars);
2706
2781
  COPY_NODE_FIELD(joinleftcols);
2707
2782
  COPY_NODE_FIELD(joinrightcols);
2783
+ COPY_NODE_FIELD(join_using_alias);
2708
2784
  COPY_NODE_FIELD(functions);
2709
2785
  COPY_SCALAR_FIELD(funcordinality);
2710
2786
  COPY_NODE_FIELD(tablefunc);
@@ -2813,6 +2889,7 @@ _copyWindowClause(const WindowClause *from)
2813
2889
  COPY_SCALAR_FIELD(frameOptions);
2814
2890
  COPY_NODE_FIELD(startOffset);
2815
2891
  COPY_NODE_FIELD(endOffset);
2892
+ COPY_NODE_FIELD(runCondition);
2816
2893
  COPY_SCALAR_FIELD(startInRangeFunc);
2817
2894
  COPY_SCALAR_FIELD(endInRangeFunc);
2818
2895
  COPY_SCALAR_FIELD(inRangeColl);
@@ -2876,6 +2953,38 @@ _copyOnConflictClause(const OnConflictClause *from)
2876
2953
  return newnode;
2877
2954
  }
2878
2955
 
2956
+ static CTESearchClause *
2957
+ _copyCTESearchClause(const CTESearchClause *from)
2958
+ {
2959
+ CTESearchClause *newnode = makeNode(CTESearchClause);
2960
+
2961
+ COPY_NODE_FIELD(search_col_list);
2962
+ COPY_SCALAR_FIELD(search_breadth_first);
2963
+ COPY_STRING_FIELD(search_seq_column);
2964
+ COPY_LOCATION_FIELD(location);
2965
+
2966
+ return newnode;
2967
+ }
2968
+
2969
+ static CTECycleClause *
2970
+ _copyCTECycleClause(const CTECycleClause *from)
2971
+ {
2972
+ CTECycleClause *newnode = makeNode(CTECycleClause);
2973
+
2974
+ COPY_NODE_FIELD(cycle_col_list);
2975
+ COPY_STRING_FIELD(cycle_mark_column);
2976
+ COPY_NODE_FIELD(cycle_mark_value);
2977
+ COPY_NODE_FIELD(cycle_mark_default);
2978
+ COPY_STRING_FIELD(cycle_path_column);
2979
+ COPY_LOCATION_FIELD(location);
2980
+ COPY_SCALAR_FIELD(cycle_mark_type);
2981
+ COPY_SCALAR_FIELD(cycle_mark_typmod);
2982
+ COPY_SCALAR_FIELD(cycle_mark_collation);
2983
+ COPY_SCALAR_FIELD(cycle_mark_neop);
2984
+
2985
+ return newnode;
2986
+ }
2987
+
2879
2988
  static CommonTableExpr *
2880
2989
  _copyCommonTableExpr(const CommonTableExpr *from)
2881
2990
  {
@@ -2885,6 +2994,8 @@ _copyCommonTableExpr(const CommonTableExpr *from)
2885
2994
  COPY_NODE_FIELD(aliascolnames);
2886
2995
  COPY_SCALAR_FIELD(ctematerialized);
2887
2996
  COPY_NODE_FIELD(ctequery);
2997
+ COPY_NODE_FIELD(search_clause);
2998
+ COPY_NODE_FIELD(cycle_clause);
2888
2999
  COPY_LOCATION_FIELD(location);
2889
3000
  COPY_SCALAR_FIELD(cterecursive);
2890
3001
  COPY_SCALAR_FIELD(cterefcount);
@@ -2896,8 +3007,37 @@ _copyCommonTableExpr(const CommonTableExpr *from)
2896
3007
  return newnode;
2897
3008
  }
2898
3009
 
3010
+ static MergeWhenClause *
3011
+ _copyMergeWhenClause(const MergeWhenClause *from)
3012
+ {
3013
+ MergeWhenClause *newnode = makeNode(MergeWhenClause);
3014
+
3015
+ COPY_SCALAR_FIELD(matched);
3016
+ COPY_SCALAR_FIELD(commandType);
3017
+ COPY_SCALAR_FIELD(override);
3018
+ COPY_NODE_FIELD(condition);
3019
+ COPY_NODE_FIELD(targetList);
3020
+ COPY_NODE_FIELD(values);
3021
+ return newnode;
3022
+ }
3023
+
3024
+ static MergeAction *
3025
+ _copyMergeAction(const MergeAction *from)
3026
+ {
3027
+ MergeAction *newnode = makeNode(MergeAction);
3028
+
3029
+ COPY_SCALAR_FIELD(matched);
3030
+ COPY_SCALAR_FIELD(commandType);
3031
+ COPY_SCALAR_FIELD(override);
3032
+ COPY_NODE_FIELD(qual);
3033
+ COPY_NODE_FIELD(targetList);
3034
+ COPY_NODE_FIELD(updateColnos);
3035
+
3036
+ return newnode;
3037
+ }
3038
+
2899
3039
  static A_Expr *
2900
- _copyAExpr(const A_Expr *from)
3040
+ _copyA_Expr(const A_Expr *from)
2901
3041
  {
2902
3042
  A_Expr *newnode = makeNode(A_Expr);
2903
3043
 
@@ -2933,29 +3073,37 @@ _copyParamRef(const ParamRef *from)
2933
3073
  }
2934
3074
 
2935
3075
  static A_Const *
2936
- _copyAConst(const A_Const *from)
3076
+ _copyA_Const(const A_Const *from)
2937
3077
  {
2938
3078
  A_Const *newnode = makeNode(A_Const);
2939
3079
 
2940
- /* This part must duplicate _copyValue */
2941
- COPY_SCALAR_FIELD(val.type);
2942
- switch (from->val.type)
3080
+ COPY_SCALAR_FIELD(isnull);
3081
+ if (!from->isnull)
2943
3082
  {
2944
- case T_Integer:
2945
- COPY_SCALAR_FIELD(val.val.ival);
2946
- break;
2947
- case T_Float:
2948
- case T_String:
2949
- case T_BitString:
2950
- COPY_STRING_FIELD(val.val.str);
2951
- break;
2952
- case T_Null:
2953
- /* nothing to do */
2954
- break;
2955
- default:
2956
- elog(ERROR, "unrecognized node type: %d",
2957
- (int) from->val.type);
2958
- break;
3083
+ /* This part must duplicate other _copy*() functions. */
3084
+ COPY_SCALAR_FIELD(val.node.type);
3085
+ switch (nodeTag(&from->val))
3086
+ {
3087
+ case T_Integer:
3088
+ COPY_SCALAR_FIELD(val.ival.ival);
3089
+ break;
3090
+ case T_Float:
3091
+ COPY_STRING_FIELD(val.fval.fval);
3092
+ break;
3093
+ case T_Boolean:
3094
+ COPY_SCALAR_FIELD(val.boolval.boolval);
3095
+ break;
3096
+ case T_String:
3097
+ COPY_STRING_FIELD(val.sval.sval);
3098
+ break;
3099
+ case T_BitString:
3100
+ COPY_STRING_FIELD(val.bsval.bsval);
3101
+ break;
3102
+ default:
3103
+ elog(ERROR, "unrecognized node type: %d",
3104
+ (int) nodeTag(&from->val));
3105
+ break;
3106
+ }
2959
3107
  }
2960
3108
 
2961
3109
  COPY_LOCATION_FIELD(location);
@@ -2972,18 +3120,19 @@ _copyFuncCall(const FuncCall *from)
2972
3120
  COPY_NODE_FIELD(args);
2973
3121
  COPY_NODE_FIELD(agg_order);
2974
3122
  COPY_NODE_FIELD(agg_filter);
3123
+ COPY_NODE_FIELD(over);
2975
3124
  COPY_SCALAR_FIELD(agg_within_group);
2976
3125
  COPY_SCALAR_FIELD(agg_star);
2977
3126
  COPY_SCALAR_FIELD(agg_distinct);
2978
3127
  COPY_SCALAR_FIELD(func_variadic);
2979
- COPY_NODE_FIELD(over);
3128
+ COPY_SCALAR_FIELD(funcformat);
2980
3129
  COPY_LOCATION_FIELD(location);
2981
3130
 
2982
3131
  return newnode;
2983
3132
  }
2984
3133
 
2985
3134
  static A_Star *
2986
- _copyAStar(const A_Star *from)
3135
+ _copyA_Star(const A_Star *from)
2987
3136
  {
2988
3137
  A_Star *newnode = makeNode(A_Star);
2989
3138
 
@@ -2991,7 +3140,7 @@ _copyAStar(const A_Star *from)
2991
3140
  }
2992
3141
 
2993
3142
  static A_Indices *
2994
- _copyAIndices(const A_Indices *from)
3143
+ _copyA_Indices(const A_Indices *from)
2995
3144
  {
2996
3145
  A_Indices *newnode = makeNode(A_Indices);
2997
3146
 
@@ -3211,6 +3360,17 @@ _copyIndexElem(const IndexElem *from)
3211
3360
  return newnode;
3212
3361
  }
3213
3362
 
3363
+ static StatsElem *
3364
+ _copyStatsElem(const StatsElem *from)
3365
+ {
3366
+ StatsElem *newnode = makeNode(StatsElem);
3367
+
3368
+ COPY_STRING_FIELD(name);
3369
+ COPY_NODE_FIELD(expr);
3370
+
3371
+ return newnode;
3372
+ }
3373
+
3214
3374
  static ColumnDef *
3215
3375
  _copyColumnDef(const ColumnDef *from)
3216
3376
  {
@@ -3218,6 +3378,7 @@ _copyColumnDef(const ColumnDef *from)
3218
3378
 
3219
3379
  COPY_STRING_FIELD(colname);
3220
3380
  COPY_NODE_FIELD(typeName);
3381
+ COPY_STRING_FIELD(compression);
3221
3382
  COPY_SCALAR_FIELD(inhcount);
3222
3383
  COPY_SCALAR_FIELD(is_local);
3223
3384
  COPY_SCALAR_FIELD(is_not_null);
@@ -3251,6 +3412,7 @@ _copyConstraint(const Constraint *from)
3251
3412
  COPY_NODE_FIELD(raw_expr);
3252
3413
  COPY_STRING_FIELD(cooked_expr);
3253
3414
  COPY_SCALAR_FIELD(generated_when);
3415
+ COPY_SCALAR_FIELD(nulls_not_distinct);
3254
3416
  COPY_NODE_FIELD(keys);
3255
3417
  COPY_NODE_FIELD(including);
3256
3418
  COPY_NODE_FIELD(exclusions);
@@ -3266,6 +3428,7 @@ _copyConstraint(const Constraint *from)
3266
3428
  COPY_SCALAR_FIELD(fk_matchtype);
3267
3429
  COPY_SCALAR_FIELD(fk_upd_action);
3268
3430
  COPY_SCALAR_FIELD(fk_del_action);
3431
+ COPY_NODE_FIELD(fk_del_set_cols);
3269
3432
  COPY_NODE_FIELD(old_conpfeqop);
3270
3433
  COPY_SCALAR_FIELD(old_pktable_oid);
3271
3434
  COPY_SCALAR_FIELD(skip_validation);
@@ -3357,6 +3520,7 @@ _copyQuery(const Query *from)
3357
3520
  COPY_SCALAR_FIELD(hasModifyingCTE);
3358
3521
  COPY_SCALAR_FIELD(hasForUpdate);
3359
3522
  COPY_SCALAR_FIELD(hasRowSecurity);
3523
+ COPY_SCALAR_FIELD(isReturn);
3360
3524
  COPY_NODE_FIELD(cteList);
3361
3525
  COPY_NODE_FIELD(rtable);
3362
3526
  COPY_NODE_FIELD(jointree);
@@ -3365,6 +3529,7 @@ _copyQuery(const Query *from)
3365
3529
  COPY_NODE_FIELD(onConflict);
3366
3530
  COPY_NODE_FIELD(returningList);
3367
3531
  COPY_NODE_FIELD(groupClause);
3532
+ COPY_SCALAR_FIELD(groupDistinct);
3368
3533
  COPY_NODE_FIELD(groupingSets);
3369
3534
  COPY_NODE_FIELD(havingQual);
3370
3535
  COPY_NODE_FIELD(windowClause);
@@ -3377,6 +3542,8 @@ _copyQuery(const Query *from)
3377
3542
  COPY_NODE_FIELD(setOperations);
3378
3543
  COPY_NODE_FIELD(constraintDeps);
3379
3544
  COPY_NODE_FIELD(withCheckOptions);
3545
+ COPY_NODE_FIELD(mergeActionList);
3546
+ COPY_SCALAR_FIELD(mergeUseOuterJoin);
3380
3547
  COPY_LOCATION_FIELD(stmt_location);
3381
3548
  COPY_SCALAR_FIELD(stmt_len);
3382
3549
 
@@ -3440,6 +3607,20 @@ _copyUpdateStmt(const UpdateStmt *from)
3440
3607
  return newnode;
3441
3608
  }
3442
3609
 
3610
+ static MergeStmt *
3611
+ _copyMergeStmt(const MergeStmt *from)
3612
+ {
3613
+ MergeStmt *newnode = makeNode(MergeStmt);
3614
+
3615
+ COPY_NODE_FIELD(relation);
3616
+ COPY_NODE_FIELD(sourceRelation);
3617
+ COPY_NODE_FIELD(joinCondition);
3618
+ COPY_NODE_FIELD(mergeWhenClauses);
3619
+ COPY_NODE_FIELD(withClause);
3620
+
3621
+ return newnode;
3622
+ }
3623
+
3443
3624
  static SelectStmt *
3444
3625
  _copySelectStmt(const SelectStmt *from)
3445
3626
  {
@@ -3451,6 +3632,7 @@ _copySelectStmt(const SelectStmt *from)
3451
3632
  COPY_NODE_FIELD(fromClause);
3452
3633
  COPY_NODE_FIELD(whereClause);
3453
3634
  COPY_NODE_FIELD(groupClause);
3635
+ COPY_SCALAR_FIELD(groupDistinct);
3454
3636
  COPY_NODE_FIELD(havingClause);
3455
3637
  COPY_NODE_FIELD(windowClause);
3456
3638
  COPY_NODE_FIELD(valuesLists);
@@ -3485,6 +3667,30 @@ _copySetOperationStmt(const SetOperationStmt *from)
3485
3667
  return newnode;
3486
3668
  }
3487
3669
 
3670
+ static ReturnStmt *
3671
+ _copyReturnStmt(const ReturnStmt *from)
3672
+ {
3673
+ ReturnStmt *newnode = makeNode(ReturnStmt);
3674
+
3675
+ COPY_NODE_FIELD(returnval);
3676
+
3677
+ return newnode;
3678
+ }
3679
+
3680
+ static PLAssignStmt *
3681
+ _copyPLAssignStmt(const PLAssignStmt *from)
3682
+ {
3683
+ PLAssignStmt *newnode = makeNode(PLAssignStmt);
3684
+
3685
+ COPY_STRING_FIELD(name);
3686
+ COPY_NODE_FIELD(indirection);
3687
+ COPY_SCALAR_FIELD(nnames);
3688
+ COPY_NODE_FIELD(val);
3689
+ COPY_LOCATION_FIELD(location);
3690
+
3691
+ return newnode;
3692
+ }
3693
+
3488
3694
  static AlterTableStmt *
3489
3695
  _copyAlterTableStmt(const AlterTableStmt *from)
3490
3696
  {
@@ -3492,7 +3698,7 @@ _copyAlterTableStmt(const AlterTableStmt *from)
3492
3698
 
3493
3699
  COPY_NODE_FIELD(relation);
3494
3700
  COPY_NODE_FIELD(cmds);
3495
- COPY_SCALAR_FIELD(relkind);
3701
+ COPY_SCALAR_FIELD(objtype);
3496
3702
  COPY_SCALAR_FIELD(missing_ok);
3497
3703
 
3498
3704
  return newnode;
@@ -3510,6 +3716,7 @@ _copyAlterTableCmd(const AlterTableCmd *from)
3510
3716
  COPY_NODE_FIELD(def);
3511
3717
  COPY_SCALAR_FIELD(behavior);
3512
3718
  COPY_SCALAR_FIELD(missing_ok);
3719
+ COPY_SCALAR_FIELD(recurse);
3513
3720
 
3514
3721
  return newnode;
3515
3722
  }
@@ -3551,6 +3758,7 @@ _copyGrantStmt(const GrantStmt *from)
3551
3758
  COPY_NODE_FIELD(privileges);
3552
3759
  COPY_NODE_FIELD(grantees);
3553
3760
  COPY_SCALAR_FIELD(grant_option);
3761
+ COPY_NODE_FIELD(grantor);
3554
3762
  COPY_SCALAR_FIELD(behavior);
3555
3763
 
3556
3764
  return newnode;
@@ -3563,6 +3771,7 @@ _copyObjectWithArgs(const ObjectWithArgs *from)
3563
3771
 
3564
3772
  COPY_NODE_FIELD(objname);
3565
3773
  COPY_NODE_FIELD(objargs);
3774
+ COPY_NODE_FIELD(objfuncargs);
3566
3775
  COPY_SCALAR_FIELD(args_unspecified);
3567
3776
 
3568
3777
  return newnode;
@@ -3634,6 +3843,7 @@ _copyCallStmt(const CallStmt *from)
3634
3843
 
3635
3844
  COPY_NODE_FIELD(funccall);
3636
3845
  COPY_NODE_FIELD(funcexpr);
3846
+ COPY_NODE_FIELD(outargs);
3637
3847
 
3638
3848
  return newnode;
3639
3849
  }
@@ -3645,7 +3855,7 @@ _copyClusterStmt(const ClusterStmt *from)
3645
3855
 
3646
3856
  COPY_NODE_FIELD(relation);
3647
3857
  COPY_STRING_FIELD(indexname);
3648
- COPY_SCALAR_FIELD(options);
3858
+ COPY_NODE_FIELD(params);
3649
3859
 
3650
3860
  return newnode;
3651
3861
  }
@@ -3812,6 +4022,7 @@ _copyIndexStmt(const IndexStmt *from)
3812
4022
  COPY_SCALAR_FIELD(oldCreateSubid);
3813
4023
  COPY_SCALAR_FIELD(oldFirstRelfilenodeSubid);
3814
4024
  COPY_SCALAR_FIELD(unique);
4025
+ COPY_SCALAR_FIELD(nulls_not_distinct);
3815
4026
  COPY_SCALAR_FIELD(primary);
3816
4027
  COPY_SCALAR_FIELD(isconstraint);
3817
4028
  COPY_SCALAR_FIELD(deferrable);
@@ -3834,6 +4045,7 @@ _copyCreateStatsStmt(const CreateStatsStmt *from)
3834
4045
  COPY_NODE_FIELD(exprs);
3835
4046
  COPY_NODE_FIELD(relations);
3836
4047
  COPY_STRING_FIELD(stxcomment);
4048
+ COPY_SCALAR_FIELD(transformed);
3837
4049
  COPY_SCALAR_FIELD(if_not_exists);
3838
4050
 
3839
4051
  return newnode;
@@ -3862,6 +4074,7 @@ _copyCreateFunctionStmt(const CreateFunctionStmt *from)
3862
4074
  COPY_NODE_FIELD(parameters);
3863
4075
  COPY_NODE_FIELD(returnType);
3864
4076
  COPY_NODE_FIELD(options);
4077
+ COPY_NODE_FIELD(sql_body);
3865
4078
 
3866
4079
  return newnode;
3867
4080
  }
@@ -4204,6 +4417,16 @@ _copyAlterDatabaseStmt(const AlterDatabaseStmt *from)
4204
4417
  return newnode;
4205
4418
  }
4206
4419
 
4420
+ static AlterDatabaseRefreshCollStmt *
4421
+ _copyAlterDatabaseRefreshCollStmt(const AlterDatabaseRefreshCollStmt *from)
4422
+ {
4423
+ AlterDatabaseRefreshCollStmt *newnode = makeNode(AlterDatabaseRefreshCollStmt);
4424
+
4425
+ COPY_STRING_FIELD(dbname);
4426
+
4427
+ return newnode;
4428
+ }
4429
+
4207
4430
  static AlterDatabaseSetStmt *
4208
4431
  _copyAlterDatabaseSetStmt(const AlterDatabaseSetStmt *from)
4209
4432
  {
@@ -4269,7 +4492,7 @@ _copyCreateTableAsStmt(const CreateTableAsStmt *from)
4269
4492
 
4270
4493
  COPY_NODE_FIELD(query);
4271
4494
  COPY_NODE_FIELD(into);
4272
- COPY_SCALAR_FIELD(relkind);
4495
+ COPY_SCALAR_FIELD(objtype);
4273
4496
  COPY_SCALAR_FIELD(is_select_into);
4274
4497
  COPY_SCALAR_FIELD(if_not_exists);
4275
4498
 
@@ -4603,6 +4826,8 @@ _copyCreateTrigStmt(const CreateTrigStmt *from)
4603
4826
  {
4604
4827
  CreateTrigStmt *newnode = makeNode(CreateTrigStmt);
4605
4828
 
4829
+ COPY_SCALAR_FIELD(replace);
4830
+ COPY_SCALAR_FIELD(isconstraint);
4606
4831
  COPY_STRING_FIELD(trigname);
4607
4832
  COPY_NODE_FIELD(relation);
4608
4833
  COPY_NODE_FIELD(funcname);
@@ -4612,7 +4837,6 @@ _copyCreateTrigStmt(const CreateTrigStmt *from)
4612
4837
  COPY_SCALAR_FIELD(events);
4613
4838
  COPY_NODE_FIELD(columns);
4614
4839
  COPY_NODE_FIELD(whenClause);
4615
- COPY_SCALAR_FIELD(isconstraint);
4616
4840
  COPY_NODE_FIELD(transitionRels);
4617
4841
  COPY_SCALAR_FIELD(deferrable);
4618
4842
  COPY_SCALAR_FIELD(initdeferred);
@@ -4738,8 +4962,7 @@ _copyReindexStmt(const ReindexStmt *from)
4738
4962
  COPY_SCALAR_FIELD(kind);
4739
4963
  COPY_NODE_FIELD(relation);
4740
4964
  COPY_STRING_FIELD(name);
4741
- COPY_SCALAR_FIELD(options);
4742
- COPY_SCALAR_FIELD(concurrent);
4965
+ COPY_NODE_FIELD(params);
4743
4966
 
4744
4967
  return newnode;
4745
4968
  }
@@ -4959,6 +5182,32 @@ _copyPartitionCmd(const PartitionCmd *from)
4959
5182
 
4960
5183
  COPY_NODE_FIELD(name);
4961
5184
  COPY_NODE_FIELD(bound);
5185
+ COPY_SCALAR_FIELD(concurrent);
5186
+
5187
+ return newnode;
5188
+ }
5189
+
5190
+ static PublicationObjSpec *
5191
+ _copyPublicationObject(const PublicationObjSpec *from)
5192
+ {
5193
+ PublicationObjSpec *newnode = makeNode(PublicationObjSpec);
5194
+
5195
+ COPY_SCALAR_FIELD(pubobjtype);
5196
+ COPY_STRING_FIELD(name);
5197
+ COPY_NODE_FIELD(pubtable);
5198
+ COPY_LOCATION_FIELD(location);
5199
+
5200
+ return newnode;
5201
+ }
5202
+
5203
+ static PublicationTable *
5204
+ _copyPublicationTable(const PublicationTable *from)
5205
+ {
5206
+ PublicationTable *newnode = makeNode(PublicationTable);
5207
+
5208
+ COPY_NODE_FIELD(relation);
5209
+ COPY_NODE_FIELD(whereClause);
5210
+ COPY_NODE_FIELD(columns);
4962
5211
 
4963
5212
  return newnode;
4964
5213
  }
@@ -4970,7 +5219,7 @@ _copyCreatePublicationStmt(const CreatePublicationStmt *from)
4970
5219
 
4971
5220
  COPY_STRING_FIELD(pubname);
4972
5221
  COPY_NODE_FIELD(options);
4973
- COPY_NODE_FIELD(tables);
5222
+ COPY_NODE_FIELD(pubobjects);
4974
5223
  COPY_SCALAR_FIELD(for_all_tables);
4975
5224
 
4976
5225
  return newnode;
@@ -4983,9 +5232,9 @@ _copyAlterPublicationStmt(const AlterPublicationStmt *from)
4983
5232
 
4984
5233
  COPY_STRING_FIELD(pubname);
4985
5234
  COPY_NODE_FIELD(options);
4986
- COPY_NODE_FIELD(tables);
5235
+ COPY_NODE_FIELD(pubobjects);
4987
5236
  COPY_SCALAR_FIELD(for_all_tables);
4988
- COPY_SCALAR_FIELD(tableAction);
5237
+ COPY_SCALAR_FIELD(action);
4989
5238
 
4990
5239
  return newnode;
4991
5240
  }
@@ -5054,32 +5303,53 @@ _copyExtensibleNode(const ExtensibleNode *from)
5054
5303
  * value.h copy functions
5055
5304
  * ****************************************************************
5056
5305
  */
5057
- static Value *
5058
- _copyValue(const Value *from)
5306
+ static Integer *
5307
+ _copyInteger(const Integer *from)
5059
5308
  {
5060
- Value *newnode = makeNode(Value);
5309
+ Integer *newnode = makeNode(Integer);
5061
5310
 
5062
- /* See also _copyAConst when changing this code! */
5311
+ COPY_SCALAR_FIELD(ival);
5312
+
5313
+ return newnode;
5314
+ }
5315
+
5316
+ static Float *
5317
+ _copyFloat(const Float *from)
5318
+ {
5319
+ Float *newnode = makeNode(Float);
5320
+
5321
+ COPY_STRING_FIELD(fval);
5322
+
5323
+ return newnode;
5324
+ }
5325
+
5326
+ static Boolean *
5327
+ _copyBoolean(const Boolean *from)
5328
+ {
5329
+ Boolean *newnode = makeNode(Boolean);
5330
+
5331
+ COPY_SCALAR_FIELD(boolval);
5332
+
5333
+ return newnode;
5334
+ }
5335
+
5336
+ static String *
5337
+ _copyString(const String *from)
5338
+ {
5339
+ String *newnode = makeNode(String);
5340
+
5341
+ COPY_STRING_FIELD(sval);
5342
+
5343
+ return newnode;
5344
+ }
5345
+
5346
+ static BitString *
5347
+ _copyBitString(const BitString *from)
5348
+ {
5349
+ BitString *newnode = makeNode(BitString);
5350
+
5351
+ COPY_STRING_FIELD(bsval);
5063
5352
 
5064
- COPY_SCALAR_FIELD(type);
5065
- switch (from->type)
5066
- {
5067
- case T_Integer:
5068
- COPY_SCALAR_FIELD(val.ival);
5069
- break;
5070
- case T_Float:
5071
- case T_String:
5072
- case T_BitString:
5073
- COPY_STRING_FIELD(val.str);
5074
- break;
5075
- case T_Null:
5076
- /* nothing to do */
5077
- break;
5078
- default:
5079
- elog(ERROR, "unrecognized node type: %d",
5080
- (int) from->type);
5081
- break;
5082
- }
5083
5353
  return newnode;
5084
5354
  }
5085
5355
 
@@ -5093,15 +5363,13 @@ _copyForeignKeyCacheInfo(const ForeignKeyCacheInfo *from)
5093
5363
  COPY_SCALAR_FIELD(conrelid);
5094
5364
  COPY_SCALAR_FIELD(confrelid);
5095
5365
  COPY_SCALAR_FIELD(nkeys);
5096
- /* COPY_SCALAR_FIELD might work for these, but let's not assume that */
5097
- memcpy(newnode->conkey, from->conkey, sizeof(newnode->conkey));
5098
- memcpy(newnode->confkey, from->confkey, sizeof(newnode->confkey));
5099
- memcpy(newnode->conpfeqop, from->conpfeqop, sizeof(newnode->conpfeqop));
5366
+ COPY_ARRAY_FIELD(conkey);
5367
+ COPY_ARRAY_FIELD(confkey);
5368
+ COPY_ARRAY_FIELD(conpfeqop);
5100
5369
 
5101
5370
  return newnode;
5102
5371
  }
5103
5372
 
5104
-
5105
5373
  /*
5106
5374
  * copyObjectImpl -- implementation of copyObject(); see nodes/nodes.h
5107
5375
  *
@@ -5184,6 +5452,9 @@ copyObjectImpl(const void *from)
5184
5452
  case T_TidScan:
5185
5453
  retval = _copyTidScan(from);
5186
5454
  break;
5455
+ case T_TidRangeScan:
5456
+ retval = _copyTidRangeScan(from);
5457
+ break;
5187
5458
  case T_SubqueryScan:
5188
5459
  retval = _copySubqueryScan(from);
5189
5460
  break;
@@ -5226,6 +5497,9 @@ copyObjectImpl(const void *from)
5226
5497
  case T_Material:
5227
5498
  retval = _copyMaterial(from);
5228
5499
  break;
5500
+ case T_Memoize:
5501
+ retval = _copyMemoize(from);
5502
+ break;
5229
5503
  case T_Sort:
5230
5504
  retval = _copySort(from);
5231
5505
  break;
@@ -5461,11 +5735,19 @@ copyObjectImpl(const void *from)
5461
5735
  * VALUE NODES
5462
5736
  */
5463
5737
  case T_Integer:
5738
+ retval = _copyInteger(from);
5739
+ break;
5464
5740
  case T_Float:
5741
+ retval = _copyFloat(from);
5742
+ break;
5743
+ case T_Boolean:
5744
+ retval = _copyBoolean(from);
5745
+ break;
5465
5746
  case T_String:
5747
+ retval = _copyString(from);
5748
+ break;
5466
5749
  case T_BitString:
5467
- case T_Null:
5468
- retval = _copyValue(from);
5750
+ retval = _copyBitString(from);
5469
5751
  break;
5470
5752
 
5471
5753
  /*
@@ -5509,12 +5791,21 @@ copyObjectImpl(const void *from)
5509
5791
  case T_UpdateStmt:
5510
5792
  retval = _copyUpdateStmt(from);
5511
5793
  break;
5794
+ case T_MergeStmt:
5795
+ retval = _copyMergeStmt(from);
5796
+ break;
5512
5797
  case T_SelectStmt:
5513
5798
  retval = _copySelectStmt(from);
5514
5799
  break;
5515
5800
  case T_SetOperationStmt:
5516
5801
  retval = _copySetOperationStmt(from);
5517
5802
  break;
5803
+ case T_ReturnStmt:
5804
+ retval = _copyReturnStmt(from);
5805
+ break;
5806
+ case T_PLAssignStmt:
5807
+ retval = _copyPLAssignStmt(from);
5808
+ break;
5518
5809
  case T_AlterTableStmt:
5519
5810
  retval = _copyAlterTableStmt(from);
5520
5811
  break;
@@ -5668,6 +5959,9 @@ copyObjectImpl(const void *from)
5668
5959
  case T_AlterDatabaseStmt:
5669
5960
  retval = _copyAlterDatabaseStmt(from);
5670
5961
  break;
5962
+ case T_AlterDatabaseRefreshCollStmt:
5963
+ retval = _copyAlterDatabaseRefreshCollStmt(from);
5964
+ break;
5671
5965
  case T_AlterDatabaseSetStmt:
5672
5966
  retval = _copyAlterDatabaseSetStmt(from);
5673
5967
  break;
@@ -5852,7 +6146,7 @@ copyObjectImpl(const void *from)
5852
6146
  retval = _copyDropSubscriptionStmt(from);
5853
6147
  break;
5854
6148
  case T_A_Expr:
5855
- retval = _copyAExpr(from);
6149
+ retval = _copyA_Expr(from);
5856
6150
  break;
5857
6151
  case T_ColumnRef:
5858
6152
  retval = _copyColumnRef(from);
@@ -5861,16 +6155,16 @@ copyObjectImpl(const void *from)
5861
6155
  retval = _copyParamRef(from);
5862
6156
  break;
5863
6157
  case T_A_Const:
5864
- retval = _copyAConst(from);
6158
+ retval = _copyA_Const(from);
5865
6159
  break;
5866
6160
  case T_FuncCall:
5867
6161
  retval = _copyFuncCall(from);
5868
6162
  break;
5869
6163
  case T_A_Star:
5870
- retval = _copyAStar(from);
6164
+ retval = _copyA_Star(from);
5871
6165
  break;
5872
6166
  case T_A_Indices:
5873
- retval = _copyAIndices(from);
6167
+ retval = _copyA_Indices(from);
5874
6168
  break;
5875
6169
  case T_A_Indirection:
5876
6170
  retval = _copyA_Indirection(from);
@@ -5917,6 +6211,9 @@ copyObjectImpl(const void *from)
5917
6211
  case T_IndexElem:
5918
6212
  retval = _copyIndexElem(from);
5919
6213
  break;
6214
+ case T_StatsElem:
6215
+ retval = _copyStatsElem(from);
6216
+ break;
5920
6217
  case T_ColumnDef:
5921
6218
  retval = _copyColumnDef(from);
5922
6219
  break;
@@ -5962,9 +6259,21 @@ copyObjectImpl(const void *from)
5962
6259
  case T_OnConflictClause:
5963
6260
  retval = _copyOnConflictClause(from);
5964
6261
  break;
6262
+ case T_CTESearchClause:
6263
+ retval = _copyCTESearchClause(from);
6264
+ break;
6265
+ case T_CTECycleClause:
6266
+ retval = _copyCTECycleClause(from);
6267
+ break;
5965
6268
  case T_CommonTableExpr:
5966
6269
  retval = _copyCommonTableExpr(from);
5967
6270
  break;
6271
+ case T_MergeWhenClause:
6272
+ retval = _copyMergeWhenClause(from);
6273
+ break;
6274
+ case T_MergeAction:
6275
+ retval = _copyMergeAction(from);
6276
+ break;
5968
6277
  case T_ObjectWithArgs:
5969
6278
  retval = _copyObjectWithArgs(from);
5970
6279
  break;
@@ -5995,6 +6304,12 @@ copyObjectImpl(const void *from)
5995
6304
  case T_PartitionCmd:
5996
6305
  retval = _copyPartitionCmd(from);
5997
6306
  break;
6307
+ case T_PublicationObjSpec:
6308
+ retval = _copyPublicationObject(from);
6309
+ break;
6310
+ case T_PublicationTable:
6311
+ retval = _copyPublicationTable(from);
6312
+ break;
5998
6313
 
5999
6314
  /*
6000
6315
  * MISCELLANEOUS NODES