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
@@ -1,7 +1,6 @@
1
1
  static void _fingerprintAlias(FingerprintContext *ctx, const Alias *node, const void *parent, const char *field_name, unsigned int depth);
2
2
  static void _fingerprintRangeVar(FingerprintContext *ctx, const RangeVar *node, const void *parent, const char *field_name, unsigned int depth);
3
3
  static void _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void *parent, const char *field_name, unsigned int depth);
4
- static void _fingerprintExpr(FingerprintContext *ctx, const Expr *node, const void *parent, const char *field_name, unsigned int depth);
5
4
  static void _fingerprintVar(FingerprintContext *ctx, const Var *node, const void *parent, const char *field_name, unsigned int depth);
6
5
  static void _fingerprintConst(FingerprintContext *ctx, const Const *node, const void *parent, const char *field_name, unsigned int depth);
7
6
  static void _fingerprintParam(FingerprintContext *ctx, const Param *node, const void *parent, const char *field_name, unsigned int depth);
@@ -48,12 +47,16 @@ static void _fingerprintJoinExpr(FingerprintContext *ctx, const JoinExpr *node,
48
47
  static void _fingerprintFromExpr(FingerprintContext *ctx, const FromExpr *node, const void *parent, const char *field_name, unsigned int depth);
49
48
  static void _fingerprintOnConflictExpr(FingerprintContext *ctx, const OnConflictExpr *node, const void *parent, const char *field_name, unsigned int depth);
50
49
  static void _fingerprintIntoClause(FingerprintContext *ctx, const IntoClause *node, const void *parent, const char *field_name, unsigned int depth);
50
+ static void _fingerprintMergeAction(FingerprintContext *ctx, const MergeAction *node, const void *parent, const char *field_name, unsigned int depth);
51
51
  static void _fingerprintRawStmt(FingerprintContext *ctx, const RawStmt *node, const void *parent, const char *field_name, unsigned int depth);
52
52
  static void _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent, const char *field_name, unsigned int depth);
53
53
  static void _fingerprintInsertStmt(FingerprintContext *ctx, const InsertStmt *node, const void *parent, const char *field_name, unsigned int depth);
54
54
  static void _fingerprintDeleteStmt(FingerprintContext *ctx, const DeleteStmt *node, const void *parent, const char *field_name, unsigned int depth);
55
55
  static void _fingerprintUpdateStmt(FingerprintContext *ctx, const UpdateStmt *node, const void *parent, const char *field_name, unsigned int depth);
56
+ static void _fingerprintMergeStmt(FingerprintContext *ctx, const MergeStmt *node, const void *parent, const char *field_name, unsigned int depth);
56
57
  static void _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const void *parent, const char *field_name, unsigned int depth);
58
+ static void _fingerprintReturnStmt(FingerprintContext *ctx, const ReturnStmt *node, const void *parent, const char *field_name, unsigned int depth);
59
+ static void _fingerprintPLAssignStmt(FingerprintContext *ctx, const PLAssignStmt *node, const void *parent, const char *field_name, unsigned int depth);
57
60
  static void _fingerprintAlterTableStmt(FingerprintContext *ctx, const AlterTableStmt *node, const void *parent, const char *field_name, unsigned int depth);
58
61
  static void _fingerprintAlterTableCmd(FingerprintContext *ctx, const AlterTableCmd *node, const void *parent, const char *field_name, unsigned int depth);
59
62
  static void _fingerprintAlterDomainStmt(FingerprintContext *ctx, const AlterDomainStmt *node, const void *parent, const char *field_name, unsigned int depth);
@@ -104,6 +107,7 @@ static void _fingerprintReindexStmt(FingerprintContext *ctx, const ReindexStmt *
104
107
  static void _fingerprintCheckPointStmt(FingerprintContext *ctx, const CheckPointStmt *node, const void *parent, const char *field_name, unsigned int depth);
105
108
  static void _fingerprintCreateSchemaStmt(FingerprintContext *ctx, const CreateSchemaStmt *node, const void *parent, const char *field_name, unsigned int depth);
106
109
  static void _fingerprintAlterDatabaseStmt(FingerprintContext *ctx, const AlterDatabaseStmt *node, const void *parent, const char *field_name, unsigned int depth);
110
+ static void _fingerprintAlterDatabaseRefreshCollStmt(FingerprintContext *ctx, const AlterDatabaseRefreshCollStmt *node, const void *parent, const char *field_name, unsigned int depth);
107
111
  static void _fingerprintAlterDatabaseSetStmt(FingerprintContext *ctx, const AlterDatabaseSetStmt *node, const void *parent, const char *field_name, unsigned int depth);
108
112
  static void _fingerprintAlterRoleSetStmt(FingerprintContext *ctx, const AlterRoleSetStmt *node, const void *parent, const char *field_name, unsigned int depth);
109
113
  static void _fingerprintCreateConversionStmt(FingerprintContext *ctx, const CreateConversionStmt *node, const void *parent, const char *field_name, unsigned int depth);
@@ -166,7 +170,6 @@ static void _fingerprintAlterStatsStmt(FingerprintContext *ctx, const AlterStats
166
170
  static void _fingerprintA_Expr(FingerprintContext *ctx, const A_Expr *node, const void *parent, const char *field_name, unsigned int depth);
167
171
  static void _fingerprintColumnRef(FingerprintContext *ctx, const ColumnRef *node, const void *parent, const char *field_name, unsigned int depth);
168
172
  static void _fingerprintParamRef(FingerprintContext *ctx, const ParamRef *node, const void *parent, const char *field_name, unsigned int depth);
169
- static void _fingerprintA_Const(FingerprintContext *ctx, const A_Const *node, const void *parent, const char *field_name, unsigned int depth);
170
173
  static void _fingerprintFuncCall(FingerprintContext *ctx, const FuncCall *node, const void *parent, const char *field_name, unsigned int depth);
171
174
  static void _fingerprintA_Star(FingerprintContext *ctx, const A_Star *node, const void *parent, const char *field_name, unsigned int depth);
172
175
  static void _fingerprintA_Indices(FingerprintContext *ctx, const A_Indices *node, const void *parent, const char *field_name, unsigned int depth);
@@ -186,6 +189,7 @@ static void _fingerprintRangeTableFuncCol(FingerprintContext *ctx, const RangeTa
186
189
  static void _fingerprintTypeName(FingerprintContext *ctx, const TypeName *node, const void *parent, const char *field_name, unsigned int depth);
187
190
  static void _fingerprintColumnDef(FingerprintContext *ctx, const ColumnDef *node, const void *parent, const char *field_name, unsigned int depth);
188
191
  static void _fingerprintIndexElem(FingerprintContext *ctx, const IndexElem *node, const void *parent, const char *field_name, unsigned int depth);
192
+ static void _fingerprintStatsElem(FingerprintContext *ctx, const StatsElem *node, const void *parent, const char *field_name, unsigned int depth);
189
193
  static void _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const void *parent, const char *field_name, unsigned int depth);
190
194
  static void _fingerprintDefElem(FingerprintContext *ctx, const DefElem *node, const void *parent, const char *field_name, unsigned int depth);
191
195
  static void _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, const void *parent, const char *field_name, unsigned int depth);
@@ -206,7 +210,10 @@ static void _fingerprintXmlSerialize(FingerprintContext *ctx, const XmlSerialize
206
210
  static void _fingerprintWithClause(FingerprintContext *ctx, const WithClause *node, const void *parent, const char *field_name, unsigned int depth);
207
211
  static void _fingerprintInferClause(FingerprintContext *ctx, const InferClause *node, const void *parent, const char *field_name, unsigned int depth);
208
212
  static void _fingerprintOnConflictClause(FingerprintContext *ctx, const OnConflictClause *node, const void *parent, const char *field_name, unsigned int depth);
213
+ static void _fingerprintCTESearchClause(FingerprintContext *ctx, const CTESearchClause *node, const void *parent, const char *field_name, unsigned int depth);
214
+ static void _fingerprintCTECycleClause(FingerprintContext *ctx, const CTECycleClause *node, const void *parent, const char *field_name, unsigned int depth);
209
215
  static void _fingerprintCommonTableExpr(FingerprintContext *ctx, const CommonTableExpr *node, const void *parent, const char *field_name, unsigned int depth);
216
+ static void _fingerprintMergeWhenClause(FingerprintContext *ctx, const MergeWhenClause *node, const void *parent, const char *field_name, unsigned int depth);
210
217
  static void _fingerprintRoleSpec(FingerprintContext *ctx, const RoleSpec *node, const void *parent, const char *field_name, unsigned int depth);
211
218
  static void _fingerprintTriggerTransition(FingerprintContext *ctx, const TriggerTransition *node, const void *parent, const char *field_name, unsigned int depth);
212
219
  static void _fingerprintPartitionElem(FingerprintContext *ctx, const PartitionElem *node, const void *parent, const char *field_name, unsigned int depth);
@@ -215,6 +222,8 @@ static void _fingerprintPartitionBoundSpec(FingerprintContext *ctx, const Partit
215
222
  static void _fingerprintPartitionRangeDatum(FingerprintContext *ctx, const PartitionRangeDatum *node, const void *parent, const char *field_name, unsigned int depth);
216
223
  static void _fingerprintPartitionCmd(FingerprintContext *ctx, const PartitionCmd *node, const void *parent, const char *field_name, unsigned int depth);
217
224
  static void _fingerprintVacuumRelation(FingerprintContext *ctx, const VacuumRelation *node, const void *parent, const char *field_name, unsigned int depth);
225
+ static void _fingerprintPublicationObjSpec(FingerprintContext *ctx, const PublicationObjSpec *node, const void *parent, const char *field_name, unsigned int depth);
226
+ static void _fingerprintPublicationTable(FingerprintContext *ctx, const PublicationTable *node, const void *parent, const char *field_name, unsigned int depth);
218
227
  static void _fingerprintInlineCodeBlock(FingerprintContext *ctx, const InlineCodeBlock *node, const void *parent, const char *field_name, unsigned int depth);
219
228
  static void _fingerprintCallContext(FingerprintContext *ctx, const CallContext *node, const void *parent, const char *field_name, unsigned int depth);
220
229
 
@@ -302,7 +311,7 @@ _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void
302
311
 
303
312
  hash = XXH3_64bits_digest(ctx->xxh_state);
304
313
  _fingerprintNode(ctx, node->colcollations, node, "colcollations", depth + 1);
305
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
314
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->colcollations) == 1 && linitial(node->colcollations) == NIL)) {
306
315
  XXH3_copyState(ctx->xxh_state, prev);
307
316
  if (ctx->write_tokens)
308
317
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -318,7 +327,7 @@ _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void
318
327
 
319
328
  hash = XXH3_64bits_digest(ctx->xxh_state);
320
329
  _fingerprintNode(ctx, node->coldefexprs, node, "coldefexprs", depth + 1);
321
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
330
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->coldefexprs) == 1 && linitial(node->coldefexprs) == NIL)) {
322
331
  XXH3_copyState(ctx->xxh_state, prev);
323
332
  if (ctx->write_tokens)
324
333
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -334,7 +343,7 @@ _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void
334
343
 
335
344
  hash = XXH3_64bits_digest(ctx->xxh_state);
336
345
  _fingerprintNode(ctx, node->colexprs, node, "colexprs", depth + 1);
337
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
346
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->colexprs) == 1 && linitial(node->colexprs) == NIL)) {
338
347
  XXH3_copyState(ctx->xxh_state, prev);
339
348
  if (ctx->write_tokens)
340
349
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -350,7 +359,7 @@ _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void
350
359
 
351
360
  hash = XXH3_64bits_digest(ctx->xxh_state);
352
361
  _fingerprintNode(ctx, node->colnames, node, "colnames", depth + 1);
353
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
362
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->colnames) == 1 && linitial(node->colnames) == NIL)) {
354
363
  XXH3_copyState(ctx->xxh_state, prev);
355
364
  if (ctx->write_tokens)
356
365
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -366,7 +375,7 @@ _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void
366
375
 
367
376
  hash = XXH3_64bits_digest(ctx->xxh_state);
368
377
  _fingerprintNode(ctx, node->coltypes, node, "coltypes", depth + 1);
369
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
378
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->coltypes) == 1 && linitial(node->coltypes) == NIL)) {
370
379
  XXH3_copyState(ctx->xxh_state, prev);
371
380
  if (ctx->write_tokens)
372
381
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -382,7 +391,7 @@ _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void
382
391
 
383
392
  hash = XXH3_64bits_digest(ctx->xxh_state);
384
393
  _fingerprintNode(ctx, node->coltypmods, node, "coltypmods", depth + 1);
385
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
394
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->coltypmods) == 1 && linitial(node->coltypmods) == NIL)) {
386
395
  XXH3_copyState(ctx->xxh_state, prev);
387
396
  if (ctx->write_tokens)
388
397
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -432,7 +441,7 @@ _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void
432
441
 
433
442
  hash = XXH3_64bits_digest(ctx->xxh_state);
434
443
  _fingerprintNode(ctx, node->ns_names, node, "ns_names", depth + 1);
435
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
444
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->ns_names) == 1 && linitial(node->ns_names) == NIL)) {
436
445
  XXH3_copyState(ctx->xxh_state, prev);
437
446
  if (ctx->write_tokens)
438
447
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -448,7 +457,7 @@ _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void
448
457
 
449
458
  hash = XXH3_64bits_digest(ctx->xxh_state);
450
459
  _fingerprintNode(ctx, node->ns_uris, node, "ns_uris", depth + 1);
451
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
460
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->ns_uris) == 1 && linitial(node->ns_uris) == NIL)) {
452
461
  XXH3_copyState(ctx->xxh_state, prev);
453
462
  if (ctx->write_tokens)
454
463
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -481,11 +490,6 @@ _fingerprintTableFunc(FingerprintContext *ctx, const TableFunc *node, const void
481
490
 
482
491
  }
483
492
 
484
- static void
485
- _fingerprintExpr(FingerprintContext *ctx, const Expr *node, const void *parent, const char *field_name, unsigned int depth)
486
- {
487
- }
488
-
489
493
  static void
490
494
  _fingerprintVar(FingerprintContext *ctx, const Var *node, const void *parent, const char *field_name, unsigned int depth)
491
495
  {
@@ -646,7 +650,7 @@ _fingerprintAggref(FingerprintContext *ctx, const Aggref *node, const void *pare
646
650
 
647
651
  hash = XXH3_64bits_digest(ctx->xxh_state);
648
652
  _fingerprintNode(ctx, node->aggargtypes, node, "aggargtypes", depth + 1);
649
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
653
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->aggargtypes) == 1 && linitial(node->aggargtypes) == NIL)) {
650
654
  XXH3_copyState(ctx->xxh_state, prev);
651
655
  if (ctx->write_tokens)
652
656
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -669,7 +673,7 @@ _fingerprintAggref(FingerprintContext *ctx, const Aggref *node, const void *pare
669
673
 
670
674
  hash = XXH3_64bits_digest(ctx->xxh_state);
671
675
  _fingerprintNode(ctx, node->aggdirectargs, node, "aggdirectargs", depth + 1);
672
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
676
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->aggdirectargs) == 1 && linitial(node->aggdirectargs) == NIL)) {
673
677
  XXH3_copyState(ctx->xxh_state, prev);
674
678
  if (ctx->write_tokens)
675
679
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -685,7 +689,7 @@ _fingerprintAggref(FingerprintContext *ctx, const Aggref *node, const void *pare
685
689
 
686
690
  hash = XXH3_64bits_digest(ctx->xxh_state);
687
691
  _fingerprintNode(ctx, node->aggdistinct, node, "aggdistinct", depth + 1);
688
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
692
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->aggdistinct) == 1 && linitial(node->aggdistinct) == NIL)) {
689
693
  XXH3_copyState(ctx->xxh_state, prev);
690
694
  if (ctx->write_tokens)
691
695
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -729,6 +733,13 @@ _fingerprintAggref(FingerprintContext *ctx, const Aggref *node, const void *pare
729
733
  _fingerprintString(ctx, buffer);
730
734
  }
731
735
 
736
+ if (node->aggno != 0) {
737
+ char buffer[50];
738
+ sprintf(buffer, "%d", node->aggno);
739
+ _fingerprintString(ctx, "aggno");
740
+ _fingerprintString(ctx, buffer);
741
+ }
742
+
732
743
  if (node->aggorder != NULL && node->aggorder->length > 0) {
733
744
  XXH3_state_t* prev = XXH3_createState();
734
745
  XXH64_hash_t hash;
@@ -738,7 +749,7 @@ _fingerprintAggref(FingerprintContext *ctx, const Aggref *node, const void *pare
738
749
 
739
750
  hash = XXH3_64bits_digest(ctx->xxh_state);
740
751
  _fingerprintNode(ctx, node->aggorder, node, "aggorder", depth + 1);
741
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
752
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->aggorder) == 1 && linitial(node->aggorder) == NIL)) {
742
753
  XXH3_copyState(ctx->xxh_state, prev);
743
754
  if (ctx->write_tokens)
744
755
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -755,6 +766,13 @@ _fingerprintAggref(FingerprintContext *ctx, const Aggref *node, const void *pare
755
766
  _fingerprintString(ctx, "true");
756
767
  }
757
768
 
769
+ if (node->aggtransno != 0) {
770
+ char buffer[50];
771
+ sprintf(buffer, "%d", node->aggtransno);
772
+ _fingerprintString(ctx, "aggtransno");
773
+ _fingerprintString(ctx, buffer);
774
+ }
775
+
758
776
  if (node->aggtranstype != 0) {
759
777
  char buffer[50];
760
778
  sprintf(buffer, "%d", node->aggtranstype);
@@ -783,7 +801,7 @@ _fingerprintAggref(FingerprintContext *ctx, const Aggref *node, const void *pare
783
801
 
784
802
  hash = XXH3_64bits_digest(ctx->xxh_state);
785
803
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
786
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
804
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
787
805
  XXH3_copyState(ctx->xxh_state, prev);
788
806
  if (ctx->write_tokens)
789
807
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -820,7 +838,7 @@ _fingerprintGroupingFunc(FingerprintContext *ctx, const GroupingFunc *node, cons
820
838
 
821
839
  hash = XXH3_64bits_digest(ctx->xxh_state);
822
840
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
823
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
841
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
824
842
  XXH3_copyState(ctx->xxh_state, prev);
825
843
  if (ctx->write_tokens)
826
844
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -836,7 +854,7 @@ _fingerprintGroupingFunc(FingerprintContext *ctx, const GroupingFunc *node, cons
836
854
 
837
855
  hash = XXH3_64bits_digest(ctx->xxh_state);
838
856
  _fingerprintNode(ctx, node->cols, node, "cols", depth + 1);
839
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
857
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->cols) == 1 && linitial(node->cols) == NIL)) {
840
858
  XXH3_copyState(ctx->xxh_state, prev);
841
859
  if (ctx->write_tokens)
842
860
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -854,7 +872,7 @@ _fingerprintGroupingFunc(FingerprintContext *ctx, const GroupingFunc *node, cons
854
872
 
855
873
  hash = XXH3_64bits_digest(ctx->xxh_state);
856
874
  _fingerprintNode(ctx, node->refs, node, "refs", depth + 1);
857
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
875
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->refs) == 1 && linitial(node->refs) == NIL)) {
858
876
  XXH3_copyState(ctx->xxh_state, prev);
859
877
  if (ctx->write_tokens)
860
878
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -892,7 +910,7 @@ _fingerprintWindowFunc(FingerprintContext *ctx, const WindowFunc *node, const vo
892
910
 
893
911
  hash = XXH3_64bits_digest(ctx->xxh_state);
894
912
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
895
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
913
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
896
914
  XXH3_copyState(ctx->xxh_state, prev);
897
915
  if (ctx->write_tokens)
898
916
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1015,13 +1033,20 @@ _fingerprintSubscriptingRef(FingerprintContext *ctx, const SubscriptingRef *node
1015
1033
 
1016
1034
  hash = XXH3_64bits_digest(ctx->xxh_state);
1017
1035
  _fingerprintNode(ctx, node->reflowerindexpr, node, "reflowerindexpr", depth + 1);
1018
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1036
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->reflowerindexpr) == 1 && linitial(node->reflowerindexpr) == NIL)) {
1019
1037
  XXH3_copyState(ctx->xxh_state, prev);
1020
1038
  if (ctx->write_tokens)
1021
1039
  dlist_delete(dlist_tail_node(&ctx->tokens));
1022
1040
  }
1023
1041
  XXH3_freeState(prev);
1024
1042
  }
1043
+ if (node->refrestype != 0) {
1044
+ char buffer[50];
1045
+ sprintf(buffer, "%d", node->refrestype);
1046
+ _fingerprintString(ctx, "refrestype");
1047
+ _fingerprintString(ctx, buffer);
1048
+ }
1049
+
1025
1050
  if (node->reftypmod != 0) {
1026
1051
  char buffer[50];
1027
1052
  sprintf(buffer, "%d", node->reftypmod);
@@ -1038,7 +1063,7 @@ _fingerprintSubscriptingRef(FingerprintContext *ctx, const SubscriptingRef *node
1038
1063
 
1039
1064
  hash = XXH3_64bits_digest(ctx->xxh_state);
1040
1065
  _fingerprintNode(ctx, node->refupperindexpr, node, "refupperindexpr", depth + 1);
1041
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1066
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->refupperindexpr) == 1 && linitial(node->refupperindexpr) == NIL)) {
1042
1067
  XXH3_copyState(ctx->xxh_state, prev);
1043
1068
  if (ctx->write_tokens)
1044
1069
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1059,7 +1084,7 @@ _fingerprintFuncExpr(FingerprintContext *ctx, const FuncExpr *node, const void *
1059
1084
 
1060
1085
  hash = XXH3_64bits_digest(ctx->xxh_state);
1061
1086
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
1062
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1087
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
1063
1088
  XXH3_copyState(ctx->xxh_state, prev);
1064
1089
  if (ctx->write_tokens)
1065
1090
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1161,7 +1186,7 @@ _fingerprintOpExpr(FingerprintContext *ctx, const OpExpr *node, const void *pare
1161
1186
 
1162
1187
  hash = XXH3_64bits_digest(ctx->xxh_state);
1163
1188
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
1164
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1189
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
1165
1190
  XXH3_copyState(ctx->xxh_state, prev);
1166
1191
  if (ctx->write_tokens)
1167
1192
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1224,13 +1249,20 @@ _fingerprintScalarArrayOpExpr(FingerprintContext *ctx, const ScalarArrayOpExpr *
1224
1249
 
1225
1250
  hash = XXH3_64bits_digest(ctx->xxh_state);
1226
1251
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
1227
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1252
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
1228
1253
  XXH3_copyState(ctx->xxh_state, prev);
1229
1254
  if (ctx->write_tokens)
1230
1255
  dlist_delete(dlist_tail_node(&ctx->tokens));
1231
1256
  }
1232
1257
  XXH3_freeState(prev);
1233
1258
  }
1259
+ if (node->hashfuncid != 0) {
1260
+ char buffer[50];
1261
+ sprintf(buffer, "%d", node->hashfuncid);
1262
+ _fingerprintString(ctx, "hashfuncid");
1263
+ _fingerprintString(ctx, buffer);
1264
+ }
1265
+
1234
1266
  if (node->inputcollid != 0) {
1235
1267
  char buffer[50];
1236
1268
  sprintf(buffer, "%d", node->inputcollid);
@@ -1240,6 +1272,13 @@ _fingerprintScalarArrayOpExpr(FingerprintContext *ctx, const ScalarArrayOpExpr *
1240
1272
 
1241
1273
  // Intentionally ignoring node->location for fingerprinting
1242
1274
 
1275
+ if (node->negfuncid != 0) {
1276
+ char buffer[50];
1277
+ sprintf(buffer, "%d", node->negfuncid);
1278
+ _fingerprintString(ctx, "negfuncid");
1279
+ _fingerprintString(ctx, buffer);
1280
+ }
1281
+
1243
1282
  if (node->opfuncid != 0) {
1244
1283
  char buffer[50];
1245
1284
  sprintf(buffer, "%d", node->opfuncid);
@@ -1273,7 +1312,7 @@ _fingerprintBoolExpr(FingerprintContext *ctx, const BoolExpr *node, const void *
1273
1312
 
1274
1313
  hash = XXH3_64bits_digest(ctx->xxh_state);
1275
1314
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
1276
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1315
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
1277
1316
  XXH3_copyState(ctx->xxh_state, prev);
1278
1317
  if (ctx->write_tokens)
1279
1318
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1303,7 +1342,7 @@ _fingerprintSubLink(FingerprintContext *ctx, const SubLink *node, const void *pa
1303
1342
 
1304
1343
  hash = XXH3_64bits_digest(ctx->xxh_state);
1305
1344
  _fingerprintNode(ctx, node->operName, node, "operName", depth + 1);
1306
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1345
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->operName) == 1 && linitial(node->operName) == NIL)) {
1307
1346
  XXH3_copyState(ctx->xxh_state, prev);
1308
1347
  if (ctx->write_tokens)
1309
1348
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1370,7 +1409,7 @@ _fingerprintSubPlan(FingerprintContext *ctx, const SubPlan *node, const void *pa
1370
1409
 
1371
1410
  hash = XXH3_64bits_digest(ctx->xxh_state);
1372
1411
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
1373
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1412
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
1374
1413
  XXH3_copyState(ctx->xxh_state, prev);
1375
1414
  if (ctx->write_tokens)
1376
1415
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1407,7 +1446,7 @@ _fingerprintSubPlan(FingerprintContext *ctx, const SubPlan *node, const void *pa
1407
1446
 
1408
1447
  hash = XXH3_64bits_digest(ctx->xxh_state);
1409
1448
  _fingerprintNode(ctx, node->parParam, node, "parParam", depth + 1);
1410
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1449
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->parParam) == 1 && linitial(node->parParam) == NIL)) {
1411
1450
  XXH3_copyState(ctx->xxh_state, prev);
1412
1451
  if (ctx->write_tokens)
1413
1452
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1428,7 +1467,7 @@ _fingerprintSubPlan(FingerprintContext *ctx, const SubPlan *node, const void *pa
1428
1467
 
1429
1468
  hash = XXH3_64bits_digest(ctx->xxh_state);
1430
1469
  _fingerprintNode(ctx, node->paramIds, node, "paramIds", depth + 1);
1431
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1470
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->paramIds) == 1 && linitial(node->paramIds) == NIL)) {
1432
1471
  XXH3_copyState(ctx->xxh_state, prev);
1433
1472
  if (ctx->write_tokens)
1434
1473
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1463,7 +1502,7 @@ _fingerprintSubPlan(FingerprintContext *ctx, const SubPlan *node, const void *pa
1463
1502
 
1464
1503
  hash = XXH3_64bits_digest(ctx->xxh_state);
1465
1504
  _fingerprintNode(ctx, node->setParam, node, "setParam", depth + 1);
1466
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1505
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->setParam) == 1 && linitial(node->setParam) == NIL)) {
1467
1506
  XXH3_copyState(ctx->xxh_state, prev);
1468
1507
  if (ctx->write_tokens)
1469
1508
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1523,7 +1562,7 @@ _fingerprintAlternativeSubPlan(FingerprintContext *ctx, const AlternativeSubPlan
1523
1562
 
1524
1563
  hash = XXH3_64bits_digest(ctx->xxh_state);
1525
1564
  _fingerprintNode(ctx, node->subplans, node, "subplans", depth + 1);
1526
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1565
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->subplans) == 1 && linitial(node->subplans) == NIL)) {
1527
1566
  XXH3_copyState(ctx->xxh_state, prev);
1528
1567
  if (ctx->write_tokens)
1529
1568
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1611,7 +1650,7 @@ _fingerprintFieldStore(FingerprintContext *ctx, const FieldStore *node, const vo
1611
1650
 
1612
1651
  hash = XXH3_64bits_digest(ctx->xxh_state);
1613
1652
  _fingerprintNode(ctx, node->fieldnums, node, "fieldnums", depth + 1);
1614
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1653
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->fieldnums) == 1 && linitial(node->fieldnums) == NIL)) {
1615
1654
  XXH3_copyState(ctx->xxh_state, prev);
1616
1655
  if (ctx->write_tokens)
1617
1656
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1627,7 +1666,7 @@ _fingerprintFieldStore(FingerprintContext *ctx, const FieldStore *node, const vo
1627
1666
 
1628
1667
  hash = XXH3_64bits_digest(ctx->xxh_state);
1629
1668
  _fingerprintNode(ctx, node->newvals, node, "newvals", depth + 1);
1630
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1669
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->newvals) == 1 && linitial(node->newvals) == NIL)) {
1631
1670
  XXH3_copyState(ctx->xxh_state, prev);
1632
1671
  if (ctx->write_tokens)
1633
1672
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -1899,7 +1938,7 @@ _fingerprintCaseExpr(FingerprintContext *ctx, const CaseExpr *node, const void *
1899
1938
 
1900
1939
  hash = XXH3_64bits_digest(ctx->xxh_state);
1901
1940
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
1902
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
1941
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
1903
1942
  XXH3_copyState(ctx->xxh_state, prev);
1904
1943
  if (ctx->write_tokens)
1905
1944
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2041,7 +2080,7 @@ _fingerprintArrayExpr(FingerprintContext *ctx, const ArrayExpr *node, const void
2041
2080
 
2042
2081
  hash = XXH3_64bits_digest(ctx->xxh_state);
2043
2082
  _fingerprintNode(ctx, node->elements, node, "elements", depth + 1);
2044
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2083
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->elements) == 1 && linitial(node->elements) == NIL)) {
2045
2084
  XXH3_copyState(ctx->xxh_state, prev);
2046
2085
  if (ctx->write_tokens)
2047
2086
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2069,7 +2108,7 @@ _fingerprintRowExpr(FingerprintContext *ctx, const RowExpr *node, const void *pa
2069
2108
 
2070
2109
  hash = XXH3_64bits_digest(ctx->xxh_state);
2071
2110
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
2072
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2111
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
2073
2112
  XXH3_copyState(ctx->xxh_state, prev);
2074
2113
  if (ctx->write_tokens)
2075
2114
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2085,7 +2124,7 @@ _fingerprintRowExpr(FingerprintContext *ctx, const RowExpr *node, const void *pa
2085
2124
 
2086
2125
  hash = XXH3_64bits_digest(ctx->xxh_state);
2087
2126
  _fingerprintNode(ctx, node->colnames, node, "colnames", depth + 1);
2088
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2127
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->colnames) == 1 && linitial(node->colnames) == NIL)) {
2089
2128
  XXH3_copyState(ctx->xxh_state, prev);
2090
2129
  if (ctx->write_tokens)
2091
2130
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2120,7 +2159,7 @@ _fingerprintRowCompareExpr(FingerprintContext *ctx, const RowCompareExpr *node,
2120
2159
 
2121
2160
  hash = XXH3_64bits_digest(ctx->xxh_state);
2122
2161
  _fingerprintNode(ctx, node->inputcollids, node, "inputcollids", depth + 1);
2123
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2162
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->inputcollids) == 1 && linitial(node->inputcollids) == NIL)) {
2124
2163
  XXH3_copyState(ctx->xxh_state, prev);
2125
2164
  if (ctx->write_tokens)
2126
2165
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2136,7 +2175,7 @@ _fingerprintRowCompareExpr(FingerprintContext *ctx, const RowCompareExpr *node,
2136
2175
 
2137
2176
  hash = XXH3_64bits_digest(ctx->xxh_state);
2138
2177
  _fingerprintNode(ctx, node->largs, node, "largs", depth + 1);
2139
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2178
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->largs) == 1 && linitial(node->largs) == NIL)) {
2140
2179
  XXH3_copyState(ctx->xxh_state, prev);
2141
2180
  if (ctx->write_tokens)
2142
2181
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2152,7 +2191,7 @@ _fingerprintRowCompareExpr(FingerprintContext *ctx, const RowCompareExpr *node,
2152
2191
 
2153
2192
  hash = XXH3_64bits_digest(ctx->xxh_state);
2154
2193
  _fingerprintNode(ctx, node->opfamilies, node, "opfamilies", depth + 1);
2155
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2194
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->opfamilies) == 1 && linitial(node->opfamilies) == NIL)) {
2156
2195
  XXH3_copyState(ctx->xxh_state, prev);
2157
2196
  if (ctx->write_tokens)
2158
2197
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2168,7 +2207,7 @@ _fingerprintRowCompareExpr(FingerprintContext *ctx, const RowCompareExpr *node,
2168
2207
 
2169
2208
  hash = XXH3_64bits_digest(ctx->xxh_state);
2170
2209
  _fingerprintNode(ctx, node->opnos, node, "opnos", depth + 1);
2171
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2210
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->opnos) == 1 && linitial(node->opnos) == NIL)) {
2172
2211
  XXH3_copyState(ctx->xxh_state, prev);
2173
2212
  if (ctx->write_tokens)
2174
2213
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2184,7 +2223,7 @@ _fingerprintRowCompareExpr(FingerprintContext *ctx, const RowCompareExpr *node,
2184
2223
 
2185
2224
  hash = XXH3_64bits_digest(ctx->xxh_state);
2186
2225
  _fingerprintNode(ctx, node->rargs, node, "rargs", depth + 1);
2187
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2226
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->rargs) == 1 && linitial(node->rargs) == NIL)) {
2188
2227
  XXH3_copyState(ctx->xxh_state, prev);
2189
2228
  if (ctx->write_tokens)
2190
2229
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2210,7 +2249,7 @@ _fingerprintCoalesceExpr(FingerprintContext *ctx, const CoalesceExpr *node, cons
2210
2249
 
2211
2250
  hash = XXH3_64bits_digest(ctx->xxh_state);
2212
2251
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
2213
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2252
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
2214
2253
  XXH3_copyState(ctx->xxh_state, prev);
2215
2254
  if (ctx->write_tokens)
2216
2255
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2247,7 +2286,7 @@ _fingerprintMinMaxExpr(FingerprintContext *ctx, const MinMaxExpr *node, const vo
2247
2286
 
2248
2287
  hash = XXH3_64bits_digest(ctx->xxh_state);
2249
2288
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
2250
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2289
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
2251
2290
  XXH3_copyState(ctx->xxh_state, prev);
2252
2291
  if (ctx->write_tokens)
2253
2292
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2322,7 +2361,7 @@ _fingerprintXmlExpr(FingerprintContext *ctx, const XmlExpr *node, const void *pa
2322
2361
 
2323
2362
  hash = XXH3_64bits_digest(ctx->xxh_state);
2324
2363
  _fingerprintNode(ctx, node->arg_names, node, "arg_names", depth + 1);
2325
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2364
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->arg_names) == 1 && linitial(node->arg_names) == NIL)) {
2326
2365
  XXH3_copyState(ctx->xxh_state, prev);
2327
2366
  if (ctx->write_tokens)
2328
2367
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2338,7 +2377,7 @@ _fingerprintXmlExpr(FingerprintContext *ctx, const XmlExpr *node, const void *pa
2338
2377
 
2339
2378
  hash = XXH3_64bits_digest(ctx->xxh_state);
2340
2379
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
2341
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2380
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
2342
2381
  XXH3_copyState(ctx->xxh_state, prev);
2343
2382
  if (ctx->write_tokens)
2344
2383
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2361,7 +2400,7 @@ _fingerprintXmlExpr(FingerprintContext *ctx, const XmlExpr *node, const void *pa
2361
2400
 
2362
2401
  hash = XXH3_64bits_digest(ctx->xxh_state);
2363
2402
  _fingerprintNode(ctx, node->named_args, node, "named_args", depth + 1);
2364
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2403
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->named_args) == 1 && linitial(node->named_args) == NIL)) {
2365
2404
  XXH3_copyState(ctx->xxh_state, prev);
2366
2405
  if (ctx->write_tokens)
2367
2406
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2717,6 +2756,23 @@ _fingerprintJoinExpr(FingerprintContext *ctx, const JoinExpr *node, const void *
2717
2756
  _fingerprintString(ctx, "true");
2718
2757
  }
2719
2758
 
2759
+ if (node->join_using_alias != NULL) {
2760
+ XXH3_state_t* prev = XXH3_createState();
2761
+ XXH64_hash_t hash;
2762
+
2763
+ XXH3_copyState(prev, ctx->xxh_state);
2764
+ _fingerprintString(ctx, "join_using_alias");
2765
+
2766
+ hash = XXH3_64bits_digest(ctx->xxh_state);
2767
+ _fingerprintAlias(ctx, node->join_using_alias, node, "join_using_alias", depth + 1);
2768
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2769
+ XXH3_copyState(ctx->xxh_state, prev);
2770
+ if (ctx->write_tokens)
2771
+ dlist_delete(dlist_tail_node(&ctx->tokens));
2772
+ }
2773
+ XXH3_freeState(prev);
2774
+ }
2775
+
2720
2776
  if (true) {
2721
2777
  _fingerprintString(ctx, "jointype");
2722
2778
  _fingerprintString(ctx, _enumToStringJoinType(node->jointype));
@@ -2789,7 +2845,7 @@ _fingerprintJoinExpr(FingerprintContext *ctx, const JoinExpr *node, const void *
2789
2845
 
2790
2846
  hash = XXH3_64bits_digest(ctx->xxh_state);
2791
2847
  _fingerprintNode(ctx, node->usingClause, node, "usingClause", depth + 1);
2792
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2848
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->usingClause) == 1 && linitial(node->usingClause) == NIL)) {
2793
2849
  XXH3_copyState(ctx->xxh_state, prev);
2794
2850
  if (ctx->write_tokens)
2795
2851
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2810,7 +2866,7 @@ _fingerprintFromExpr(FingerprintContext *ctx, const FromExpr *node, const void *
2810
2866
 
2811
2867
  hash = XXH3_64bits_digest(ctx->xxh_state);
2812
2868
  _fingerprintNode(ctx, node->fromlist, node, "fromlist", depth + 1);
2813
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2869
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->fromlist) == 1 && linitial(node->fromlist) == NIL)) {
2814
2870
  XXH3_copyState(ctx->xxh_state, prev);
2815
2871
  if (ctx->write_tokens)
2816
2872
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2853,7 +2909,7 @@ _fingerprintOnConflictExpr(FingerprintContext *ctx, const OnConflictExpr *node,
2853
2909
 
2854
2910
  hash = XXH3_64bits_digest(ctx->xxh_state);
2855
2911
  _fingerprintNode(ctx, node->arbiterElems, node, "arbiterElems", depth + 1);
2856
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2912
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->arbiterElems) == 1 && linitial(node->arbiterElems) == NIL)) {
2857
2913
  XXH3_copyState(ctx->xxh_state, prev);
2858
2914
  if (ctx->write_tokens)
2859
2915
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2900,7 +2956,7 @@ _fingerprintOnConflictExpr(FingerprintContext *ctx, const OnConflictExpr *node,
2900
2956
 
2901
2957
  hash = XXH3_64bits_digest(ctx->xxh_state);
2902
2958
  _fingerprintNode(ctx, node->exclRelTlist, node, "exclRelTlist", depth + 1);
2903
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2959
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->exclRelTlist) == 1 && linitial(node->exclRelTlist) == NIL)) {
2904
2960
  XXH3_copyState(ctx->xxh_state, prev);
2905
2961
  if (ctx->write_tokens)
2906
2962
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2916,7 +2972,7 @@ _fingerprintOnConflictExpr(FingerprintContext *ctx, const OnConflictExpr *node,
2916
2972
 
2917
2973
  hash = XXH3_64bits_digest(ctx->xxh_state);
2918
2974
  _fingerprintNode(ctx, node->onConflictSet, node, "onConflictSet", depth + 1);
2919
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
2975
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->onConflictSet) == 1 && linitial(node->onConflictSet) == NIL)) {
2920
2976
  XXH3_copyState(ctx->xxh_state, prev);
2921
2977
  if (ctx->write_tokens)
2922
2978
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2959,7 +3015,7 @@ _fingerprintIntoClause(FingerprintContext *ctx, const IntoClause *node, const vo
2959
3015
 
2960
3016
  hash = XXH3_64bits_digest(ctx->xxh_state);
2961
3017
  _fingerprintNode(ctx, node->colNames, node, "colNames", depth + 1);
2962
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3018
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->colNames) == 1 && linitial(node->colNames) == NIL)) {
2963
3019
  XXH3_copyState(ctx->xxh_state, prev);
2964
3020
  if (ctx->write_tokens)
2965
3021
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -2980,7 +3036,7 @@ _fingerprintIntoClause(FingerprintContext *ctx, const IntoClause *node, const vo
2980
3036
 
2981
3037
  hash = XXH3_64bits_digest(ctx->xxh_state);
2982
3038
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
2983
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3039
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
2984
3040
  XXH3_copyState(ctx->xxh_state, prev);
2985
3041
  if (ctx->write_tokens)
2986
3042
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3033,6 +3089,75 @@ _fingerprintIntoClause(FingerprintContext *ctx, const IntoClause *node, const vo
3033
3089
 
3034
3090
  }
3035
3091
 
3092
+ static void
3093
+ _fingerprintMergeAction(FingerprintContext *ctx, const MergeAction *node, const void *parent, const char *field_name, unsigned int depth)
3094
+ {
3095
+ if (true) {
3096
+ _fingerprintString(ctx, "commandType");
3097
+ _fingerprintString(ctx, _enumToStringCmdType(node->commandType));
3098
+ }
3099
+
3100
+ if (node->matched) {
3101
+ _fingerprintString(ctx, "matched");
3102
+ _fingerprintString(ctx, "true");
3103
+ }
3104
+
3105
+ if (true) {
3106
+ _fingerprintString(ctx, "override");
3107
+ _fingerprintString(ctx, _enumToStringOverridingKind(node->override));
3108
+ }
3109
+
3110
+ if (node->qual != NULL) {
3111
+ XXH3_state_t* prev = XXH3_createState();
3112
+ XXH64_hash_t hash;
3113
+
3114
+ XXH3_copyState(prev, ctx->xxh_state);
3115
+ _fingerprintString(ctx, "qual");
3116
+
3117
+ hash = XXH3_64bits_digest(ctx->xxh_state);
3118
+ _fingerprintNode(ctx, node->qual, node, "qual", depth + 1);
3119
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3120
+ XXH3_copyState(ctx->xxh_state, prev);
3121
+ if (ctx->write_tokens)
3122
+ dlist_delete(dlist_tail_node(&ctx->tokens));
3123
+ }
3124
+ XXH3_freeState(prev);
3125
+ }
3126
+
3127
+ if (node->targetList != NULL && node->targetList->length > 0) {
3128
+ XXH3_state_t* prev = XXH3_createState();
3129
+ XXH64_hash_t hash;
3130
+
3131
+ XXH3_copyState(prev, ctx->xxh_state);
3132
+ _fingerprintString(ctx, "targetList");
3133
+
3134
+ hash = XXH3_64bits_digest(ctx->xxh_state);
3135
+ _fingerprintNode(ctx, node->targetList, node, "targetList", depth + 1);
3136
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->targetList) == 1 && linitial(node->targetList) == NIL)) {
3137
+ XXH3_copyState(ctx->xxh_state, prev);
3138
+ if (ctx->write_tokens)
3139
+ dlist_delete(dlist_tail_node(&ctx->tokens));
3140
+ }
3141
+ XXH3_freeState(prev);
3142
+ }
3143
+ if (node->updateColnos != NULL && node->updateColnos->length > 0) {
3144
+ XXH3_state_t* prev = XXH3_createState();
3145
+ XXH64_hash_t hash;
3146
+
3147
+ XXH3_copyState(prev, ctx->xxh_state);
3148
+ _fingerprintString(ctx, "updateColnos");
3149
+
3150
+ hash = XXH3_64bits_digest(ctx->xxh_state);
3151
+ _fingerprintNode(ctx, node->updateColnos, node, "updateColnos", depth + 1);
3152
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->updateColnos) == 1 && linitial(node->updateColnos) == NIL)) {
3153
+ XXH3_copyState(ctx->xxh_state, prev);
3154
+ if (ctx->write_tokens)
3155
+ dlist_delete(dlist_tail_node(&ctx->tokens));
3156
+ }
3157
+ XXH3_freeState(prev);
3158
+ }
3159
+ }
3160
+
3036
3161
  static void
3037
3162
  _fingerprintRawStmt(FingerprintContext *ctx, const RawStmt *node, const void *parent, const char *field_name, unsigned int depth)
3038
3163
  {
@@ -3081,7 +3206,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3081
3206
 
3082
3207
  hash = XXH3_64bits_digest(ctx->xxh_state);
3083
3208
  _fingerprintNode(ctx, node->constraintDeps, node, "constraintDeps", depth + 1);
3084
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3209
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->constraintDeps) == 1 && linitial(node->constraintDeps) == NIL)) {
3085
3210
  XXH3_copyState(ctx->xxh_state, prev);
3086
3211
  if (ctx->write_tokens)
3087
3212
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3097,7 +3222,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3097
3222
 
3098
3223
  hash = XXH3_64bits_digest(ctx->xxh_state);
3099
3224
  _fingerprintNode(ctx, node->cteList, node, "cteList", depth + 1);
3100
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3225
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->cteList) == 1 && linitial(node->cteList) == NIL)) {
3101
3226
  XXH3_copyState(ctx->xxh_state, prev);
3102
3227
  if (ctx->write_tokens)
3103
3228
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3113,7 +3238,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3113
3238
 
3114
3239
  hash = XXH3_64bits_digest(ctx->xxh_state);
3115
3240
  _fingerprintNode(ctx, node->distinctClause, node, "distinctClause", depth + 1);
3116
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3241
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->distinctClause) == 1 && linitial(node->distinctClause) == NIL)) {
3117
3242
  XXH3_copyState(ctx->xxh_state, prev);
3118
3243
  if (ctx->write_tokens)
3119
3244
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3129,13 +3254,18 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3129
3254
 
3130
3255
  hash = XXH3_64bits_digest(ctx->xxh_state);
3131
3256
  _fingerprintNode(ctx, node->groupClause, node, "groupClause", depth + 1);
3132
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3257
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->groupClause) == 1 && linitial(node->groupClause) == NIL)) {
3133
3258
  XXH3_copyState(ctx->xxh_state, prev);
3134
3259
  if (ctx->write_tokens)
3135
3260
  dlist_delete(dlist_tail_node(&ctx->tokens));
3136
3261
  }
3137
3262
  XXH3_freeState(prev);
3138
3263
  }
3264
+ if (node->groupDistinct) {
3265
+ _fingerprintString(ctx, "groupDistinct");
3266
+ _fingerprintString(ctx, "true");
3267
+ }
3268
+
3139
3269
  if (node->groupingSets != NULL && node->groupingSets->length > 0) {
3140
3270
  XXH3_state_t* prev = XXH3_createState();
3141
3271
  XXH64_hash_t hash;
@@ -3145,7 +3275,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3145
3275
 
3146
3276
  hash = XXH3_64bits_digest(ctx->xxh_state);
3147
3277
  _fingerprintNode(ctx, node->groupingSets, node, "groupingSets", depth + 1);
3148
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3278
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->groupingSets) == 1 && linitial(node->groupingSets) == NIL)) {
3149
3279
  XXH3_copyState(ctx->xxh_state, prev);
3150
3280
  if (ctx->write_tokens)
3151
3281
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3214,6 +3344,11 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3214
3344
  XXH3_freeState(prev);
3215
3345
  }
3216
3346
 
3347
+ if (node->isReturn) {
3348
+ _fingerprintString(ctx, "isReturn");
3349
+ _fingerprintString(ctx, "true");
3350
+ }
3351
+
3217
3352
  if (node->jointree != NULL) {
3218
3353
  XXH3_state_t* prev = XXH3_createState();
3219
3354
  XXH64_hash_t hash;
@@ -3270,6 +3405,27 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3270
3405
  _fingerprintString(ctx, _enumToStringLimitOption(node->limitOption));
3271
3406
  }
3272
3407
 
3408
+ if (node->mergeActionList != NULL && node->mergeActionList->length > 0) {
3409
+ XXH3_state_t* prev = XXH3_createState();
3410
+ XXH64_hash_t hash;
3411
+
3412
+ XXH3_copyState(prev, ctx->xxh_state);
3413
+ _fingerprintString(ctx, "mergeActionList");
3414
+
3415
+ hash = XXH3_64bits_digest(ctx->xxh_state);
3416
+ _fingerprintNode(ctx, node->mergeActionList, node, "mergeActionList", depth + 1);
3417
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->mergeActionList) == 1 && linitial(node->mergeActionList) == NIL)) {
3418
+ XXH3_copyState(ctx->xxh_state, prev);
3419
+ if (ctx->write_tokens)
3420
+ dlist_delete(dlist_tail_node(&ctx->tokens));
3421
+ }
3422
+ XXH3_freeState(prev);
3423
+ }
3424
+ if (node->mergeUseOuterJoin) {
3425
+ _fingerprintString(ctx, "mergeUseOuterJoin");
3426
+ _fingerprintString(ctx, "true");
3427
+ }
3428
+
3273
3429
  if (node->onConflict != NULL) {
3274
3430
  XXH3_state_t* prev = XXH3_createState();
3275
3431
  XXH64_hash_t hash;
@@ -3320,7 +3476,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3320
3476
 
3321
3477
  hash = XXH3_64bits_digest(ctx->xxh_state);
3322
3478
  _fingerprintNode(ctx, node->returningList, node, "returningList", depth + 1);
3323
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3479
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->returningList) == 1 && linitial(node->returningList) == NIL)) {
3324
3480
  XXH3_copyState(ctx->xxh_state, prev);
3325
3481
  if (ctx->write_tokens)
3326
3482
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3336,7 +3492,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3336
3492
 
3337
3493
  hash = XXH3_64bits_digest(ctx->xxh_state);
3338
3494
  _fingerprintNode(ctx, node->rowMarks, node, "rowMarks", depth + 1);
3339
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3495
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->rowMarks) == 1 && linitial(node->rowMarks) == NIL)) {
3340
3496
  XXH3_copyState(ctx->xxh_state, prev);
3341
3497
  if (ctx->write_tokens)
3342
3498
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3352,7 +3508,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3352
3508
 
3353
3509
  hash = XXH3_64bits_digest(ctx->xxh_state);
3354
3510
  _fingerprintNode(ctx, node->rtable, node, "rtable", depth + 1);
3355
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3511
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->rtable) == 1 && linitial(node->rtable) == NIL)) {
3356
3512
  XXH3_copyState(ctx->xxh_state, prev);
3357
3513
  if (ctx->write_tokens)
3358
3514
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3385,7 +3541,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3385
3541
 
3386
3542
  hash = XXH3_64bits_digest(ctx->xxh_state);
3387
3543
  _fingerprintNode(ctx, node->sortClause, node, "sortClause", depth + 1);
3388
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3544
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->sortClause) == 1 && linitial(node->sortClause) == NIL)) {
3389
3545
  XXH3_copyState(ctx->xxh_state, prev);
3390
3546
  if (ctx->write_tokens)
3391
3547
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3415,7 +3571,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3415
3571
 
3416
3572
  hash = XXH3_64bits_digest(ctx->xxh_state);
3417
3573
  _fingerprintNode(ctx, node->targetList, node, "targetList", depth + 1);
3418
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3574
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->targetList) == 1 && linitial(node->targetList) == NIL)) {
3419
3575
  XXH3_copyState(ctx->xxh_state, prev);
3420
3576
  if (ctx->write_tokens)
3421
3577
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3448,7 +3604,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3448
3604
 
3449
3605
  hash = XXH3_64bits_digest(ctx->xxh_state);
3450
3606
  _fingerprintNode(ctx, node->windowClause, node, "windowClause", depth + 1);
3451
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3607
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->windowClause) == 1 && linitial(node->windowClause) == NIL)) {
3452
3608
  XXH3_copyState(ctx->xxh_state, prev);
3453
3609
  if (ctx->write_tokens)
3454
3610
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3464,7 +3620,7 @@ _fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent
3464
3620
 
3465
3621
  hash = XXH3_64bits_digest(ctx->xxh_state);
3466
3622
  _fingerprintNode(ctx, node->withCheckOptions, node, "withCheckOptions", depth + 1);
3467
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3623
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->withCheckOptions) == 1 && linitial(node->withCheckOptions) == NIL)) {
3468
3624
  XXH3_copyState(ctx->xxh_state, prev);
3469
3625
  if (ctx->write_tokens)
3470
3626
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3485,7 +3641,7 @@ _fingerprintInsertStmt(FingerprintContext *ctx, const InsertStmt *node, const vo
3485
3641
 
3486
3642
  hash = XXH3_64bits_digest(ctx->xxh_state);
3487
3643
  _fingerprintNode(ctx, node->cols, node, "cols", depth + 1);
3488
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3644
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->cols) == 1 && linitial(node->cols) == NIL)) {
3489
3645
  XXH3_copyState(ctx->xxh_state, prev);
3490
3646
  if (ctx->write_tokens)
3491
3647
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3540,7 +3696,7 @@ _fingerprintInsertStmt(FingerprintContext *ctx, const InsertStmt *node, const vo
3540
3696
 
3541
3697
  hash = XXH3_64bits_digest(ctx->xxh_state);
3542
3698
  _fingerprintNode(ctx, node->returningList, node, "returningList", depth + 1);
3543
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3699
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->returningList) == 1 && linitial(node->returningList) == NIL)) {
3544
3700
  XXH3_copyState(ctx->xxh_state, prev);
3545
3701
  if (ctx->write_tokens)
3546
3702
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3612,7 +3768,7 @@ _fingerprintDeleteStmt(FingerprintContext *ctx, const DeleteStmt *node, const vo
3612
3768
 
3613
3769
  hash = XXH3_64bits_digest(ctx->xxh_state);
3614
3770
  _fingerprintNode(ctx, node->returningList, node, "returningList", depth + 1);
3615
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3771
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->returningList) == 1 && linitial(node->returningList) == NIL)) {
3616
3772
  XXH3_copyState(ctx->xxh_state, prev);
3617
3773
  if (ctx->write_tokens)
3618
3774
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3628,7 +3784,7 @@ _fingerprintDeleteStmt(FingerprintContext *ctx, const DeleteStmt *node, const vo
3628
3784
 
3629
3785
  hash = XXH3_64bits_digest(ctx->xxh_state);
3630
3786
  _fingerprintNode(ctx, node->usingClause, node, "usingClause", depth + 1);
3631
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3787
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->usingClause) == 1 && linitial(node->usingClause) == NIL)) {
3632
3788
  XXH3_copyState(ctx->xxh_state, prev);
3633
3789
  if (ctx->write_tokens)
3634
3790
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3683,7 +3839,7 @@ _fingerprintUpdateStmt(FingerprintContext *ctx, const UpdateStmt *node, const vo
3683
3839
 
3684
3840
  hash = XXH3_64bits_digest(ctx->xxh_state);
3685
3841
  _fingerprintNode(ctx, node->fromClause, node, "fromClause", depth + 1);
3686
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3842
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->fromClause) == 1 && linitial(node->fromClause) == NIL)) {
3687
3843
  XXH3_copyState(ctx->xxh_state, prev);
3688
3844
  if (ctx->write_tokens)
3689
3845
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3716,7 +3872,7 @@ _fingerprintUpdateStmt(FingerprintContext *ctx, const UpdateStmt *node, const vo
3716
3872
 
3717
3873
  hash = XXH3_64bits_digest(ctx->xxh_state);
3718
3874
  _fingerprintNode(ctx, node->returningList, node, "returningList", depth + 1);
3719
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3875
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->returningList) == 1 && linitial(node->returningList) == NIL)) {
3720
3876
  XXH3_copyState(ctx->xxh_state, prev);
3721
3877
  if (ctx->write_tokens)
3722
3878
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3732,7 +3888,7 @@ _fingerprintUpdateStmt(FingerprintContext *ctx, const UpdateStmt *node, const vo
3732
3888
 
3733
3889
  hash = XXH3_64bits_digest(ctx->xxh_state);
3734
3890
  _fingerprintNode(ctx, node->targetList, node, "targetList", depth + 1);
3735
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3891
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->targetList) == 1 && linitial(node->targetList) == NIL)) {
3736
3892
  XXH3_copyState(ctx->xxh_state, prev);
3737
3893
  if (ctx->write_tokens)
3738
3894
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3776,22 +3932,17 @@ _fingerprintUpdateStmt(FingerprintContext *ctx, const UpdateStmt *node, const vo
3776
3932
  }
3777
3933
 
3778
3934
  static void
3779
- _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const void *parent, const char *field_name, unsigned int depth)
3935
+ _fingerprintMergeStmt(FingerprintContext *ctx, const MergeStmt *node, const void *parent, const char *field_name, unsigned int depth)
3780
3936
  {
3781
- if (node->all) {
3782
- _fingerprintString(ctx, "all");
3783
- _fingerprintString(ctx, "true");
3784
- }
3785
-
3786
- if (node->distinctClause != NULL && node->distinctClause->length > 0) {
3937
+ if (node->joinCondition != NULL) {
3787
3938
  XXH3_state_t* prev = XXH3_createState();
3788
3939
  XXH64_hash_t hash;
3789
3940
 
3790
3941
  XXH3_copyState(prev, ctx->xxh_state);
3791
- _fingerprintString(ctx, "distinctClause");
3942
+ _fingerprintString(ctx, "joinCondition");
3792
3943
 
3793
3944
  hash = XXH3_64bits_digest(ctx->xxh_state);
3794
- _fingerprintNode(ctx, node->distinctClause, node, "distinctClause", depth + 1);
3945
+ _fingerprintNode(ctx, node->joinCondition, node, "joinCondition", depth + 1);
3795
3946
  if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3796
3947
  XXH3_copyState(ctx->xxh_state, prev);
3797
3948
  if (ctx->write_tokens)
@@ -3799,31 +3950,32 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
3799
3950
  }
3800
3951
  XXH3_freeState(prev);
3801
3952
  }
3802
- if (node->fromClause != NULL && node->fromClause->length > 0) {
3953
+
3954
+ if (node->mergeWhenClauses != NULL && node->mergeWhenClauses->length > 0) {
3803
3955
  XXH3_state_t* prev = XXH3_createState();
3804
3956
  XXH64_hash_t hash;
3805
3957
 
3806
3958
  XXH3_copyState(prev, ctx->xxh_state);
3807
- _fingerprintString(ctx, "fromClause");
3959
+ _fingerprintString(ctx, "mergeWhenClauses");
3808
3960
 
3809
3961
  hash = XXH3_64bits_digest(ctx->xxh_state);
3810
- _fingerprintNode(ctx, node->fromClause, node, "fromClause", depth + 1);
3811
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3962
+ _fingerprintNode(ctx, node->mergeWhenClauses, node, "mergeWhenClauses", depth + 1);
3963
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->mergeWhenClauses) == 1 && linitial(node->mergeWhenClauses) == NIL)) {
3812
3964
  XXH3_copyState(ctx->xxh_state, prev);
3813
3965
  if (ctx->write_tokens)
3814
3966
  dlist_delete(dlist_tail_node(&ctx->tokens));
3815
3967
  }
3816
3968
  XXH3_freeState(prev);
3817
3969
  }
3818
- if (node->groupClause != NULL && node->groupClause->length > 0) {
3970
+ if (node->relation != NULL) {
3819
3971
  XXH3_state_t* prev = XXH3_createState();
3820
3972
  XXH64_hash_t hash;
3821
3973
 
3822
3974
  XXH3_copyState(prev, ctx->xxh_state);
3823
- _fingerprintString(ctx, "groupClause");
3975
+ _fingerprintString(ctx, "relation");
3824
3976
 
3825
3977
  hash = XXH3_64bits_digest(ctx->xxh_state);
3826
- _fingerprintNode(ctx, node->groupClause, node, "groupClause", depth + 1);
3978
+ _fingerprintRangeVar(ctx, node->relation, node, "relation", depth + 1);
3827
3979
  if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3828
3980
  XXH3_copyState(ctx->xxh_state, prev);
3829
3981
  if (ctx->write_tokens)
@@ -3831,15 +3983,16 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
3831
3983
  }
3832
3984
  XXH3_freeState(prev);
3833
3985
  }
3834
- if (node->havingClause != NULL) {
3986
+
3987
+ if (node->sourceRelation != NULL) {
3835
3988
  XXH3_state_t* prev = XXH3_createState();
3836
3989
  XXH64_hash_t hash;
3837
3990
 
3838
3991
  XXH3_copyState(prev, ctx->xxh_state);
3839
- _fingerprintString(ctx, "havingClause");
3992
+ _fingerprintString(ctx, "sourceRelation");
3840
3993
 
3841
3994
  hash = XXH3_64bits_digest(ctx->xxh_state);
3842
- _fingerprintNode(ctx, node->havingClause, node, "havingClause", depth + 1);
3995
+ _fingerprintNode(ctx, node->sourceRelation, node, "sourceRelation", depth + 1);
3843
3996
  if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3844
3997
  XXH3_copyState(ctx->xxh_state, prev);
3845
3998
  if (ctx->write_tokens)
@@ -3848,15 +4001,15 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
3848
4001
  XXH3_freeState(prev);
3849
4002
  }
3850
4003
 
3851
- if (node->intoClause != NULL) {
4004
+ if (node->withClause != NULL) {
3852
4005
  XXH3_state_t* prev = XXH3_createState();
3853
4006
  XXH64_hash_t hash;
3854
4007
 
3855
4008
  XXH3_copyState(prev, ctx->xxh_state);
3856
- _fingerprintString(ctx, "intoClause");
4009
+ _fingerprintString(ctx, "withClause");
3857
4010
 
3858
4011
  hash = XXH3_64bits_digest(ctx->xxh_state);
3859
- _fingerprintIntoClause(ctx, node->intoClause, node, "intoClause", depth + 1);
4012
+ _fingerprintWithClause(ctx, node->withClause, node, "withClause", depth + 1);
3860
4013
  if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3861
4014
  XXH3_copyState(ctx->xxh_state, prev);
3862
4015
  if (ctx->write_tokens)
@@ -3865,50 +4018,147 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
3865
4018
  XXH3_freeState(prev);
3866
4019
  }
3867
4020
 
3868
- if (node->larg != NULL) {
4021
+ }
4022
+
4023
+ static void
4024
+ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const void *parent, const char *field_name, unsigned int depth)
4025
+ {
4026
+ if (node->all) {
4027
+ _fingerprintString(ctx, "all");
4028
+ _fingerprintString(ctx, "true");
4029
+ }
4030
+
4031
+ if (node->distinctClause != NULL && node->distinctClause->length > 0) {
3869
4032
  XXH3_state_t* prev = XXH3_createState();
3870
4033
  XXH64_hash_t hash;
3871
4034
 
3872
4035
  XXH3_copyState(prev, ctx->xxh_state);
3873
- _fingerprintString(ctx, "larg");
4036
+ _fingerprintString(ctx, "distinctClause");
3874
4037
 
3875
4038
  hash = XXH3_64bits_digest(ctx->xxh_state);
3876
- _fingerprintSelectStmt(ctx, node->larg, node, "larg", depth + 1);
3877
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4039
+ _fingerprintNode(ctx, node->distinctClause, node, "distinctClause", depth + 1);
4040
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->distinctClause) == 1 && linitial(node->distinctClause) == NIL)) {
3878
4041
  XXH3_copyState(ctx->xxh_state, prev);
3879
4042
  if (ctx->write_tokens)
3880
4043
  dlist_delete(dlist_tail_node(&ctx->tokens));
3881
4044
  }
3882
4045
  XXH3_freeState(prev);
3883
4046
  }
3884
-
3885
- if (node->limitCount != NULL) {
4047
+ if (node->fromClause != NULL && node->fromClause->length > 0) {
3886
4048
  XXH3_state_t* prev = XXH3_createState();
3887
4049
  XXH64_hash_t hash;
3888
4050
 
3889
4051
  XXH3_copyState(prev, ctx->xxh_state);
3890
- _fingerprintString(ctx, "limitCount");
4052
+ _fingerprintString(ctx, "fromClause");
3891
4053
 
3892
4054
  hash = XXH3_64bits_digest(ctx->xxh_state);
3893
- _fingerprintNode(ctx, node->limitCount, node, "limitCount", depth + 1);
3894
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4055
+ _fingerprintNode(ctx, node->fromClause, node, "fromClause", depth + 1);
4056
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->fromClause) == 1 && linitial(node->fromClause) == NIL)) {
3895
4057
  XXH3_copyState(ctx->xxh_state, prev);
3896
4058
  if (ctx->write_tokens)
3897
4059
  dlist_delete(dlist_tail_node(&ctx->tokens));
3898
4060
  }
3899
4061
  XXH3_freeState(prev);
3900
4062
  }
3901
-
3902
- if (node->limitOffset != NULL) {
4063
+ if (node->groupClause != NULL && node->groupClause->length > 0) {
3903
4064
  XXH3_state_t* prev = XXH3_createState();
3904
4065
  XXH64_hash_t hash;
3905
4066
 
3906
4067
  XXH3_copyState(prev, ctx->xxh_state);
3907
- _fingerprintString(ctx, "limitOffset");
4068
+ _fingerprintString(ctx, "groupClause");
3908
4069
 
3909
4070
  hash = XXH3_64bits_digest(ctx->xxh_state);
3910
- _fingerprintNode(ctx, node->limitOffset, node, "limitOffset", depth + 1);
3911
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4071
+ _fingerprintNode(ctx, node->groupClause, node, "groupClause", depth + 1);
4072
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->groupClause) == 1 && linitial(node->groupClause) == NIL)) {
4073
+ XXH3_copyState(ctx->xxh_state, prev);
4074
+ if (ctx->write_tokens)
4075
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4076
+ }
4077
+ XXH3_freeState(prev);
4078
+ }
4079
+ if (node->groupDistinct) {
4080
+ _fingerprintString(ctx, "groupDistinct");
4081
+ _fingerprintString(ctx, "true");
4082
+ }
4083
+
4084
+ if (node->havingClause != NULL) {
4085
+ XXH3_state_t* prev = XXH3_createState();
4086
+ XXH64_hash_t hash;
4087
+
4088
+ XXH3_copyState(prev, ctx->xxh_state);
4089
+ _fingerprintString(ctx, "havingClause");
4090
+
4091
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4092
+ _fingerprintNode(ctx, node->havingClause, node, "havingClause", depth + 1);
4093
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4094
+ XXH3_copyState(ctx->xxh_state, prev);
4095
+ if (ctx->write_tokens)
4096
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4097
+ }
4098
+ XXH3_freeState(prev);
4099
+ }
4100
+
4101
+ if (node->intoClause != NULL) {
4102
+ XXH3_state_t* prev = XXH3_createState();
4103
+ XXH64_hash_t hash;
4104
+
4105
+ XXH3_copyState(prev, ctx->xxh_state);
4106
+ _fingerprintString(ctx, "intoClause");
4107
+
4108
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4109
+ _fingerprintIntoClause(ctx, node->intoClause, node, "intoClause", depth + 1);
4110
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4111
+ XXH3_copyState(ctx->xxh_state, prev);
4112
+ if (ctx->write_tokens)
4113
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4114
+ }
4115
+ XXH3_freeState(prev);
4116
+ }
4117
+
4118
+ if (node->larg != NULL) {
4119
+ XXH3_state_t* prev = XXH3_createState();
4120
+ XXH64_hash_t hash;
4121
+
4122
+ XXH3_copyState(prev, ctx->xxh_state);
4123
+ _fingerprintString(ctx, "larg");
4124
+
4125
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4126
+ _fingerprintSelectStmt(ctx, node->larg, node, "larg", depth + 1);
4127
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4128
+ XXH3_copyState(ctx->xxh_state, prev);
4129
+ if (ctx->write_tokens)
4130
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4131
+ }
4132
+ XXH3_freeState(prev);
4133
+ }
4134
+
4135
+ if (node->limitCount != NULL) {
4136
+ XXH3_state_t* prev = XXH3_createState();
4137
+ XXH64_hash_t hash;
4138
+
4139
+ XXH3_copyState(prev, ctx->xxh_state);
4140
+ _fingerprintString(ctx, "limitCount");
4141
+
4142
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4143
+ _fingerprintNode(ctx, node->limitCount, node, "limitCount", depth + 1);
4144
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4145
+ XXH3_copyState(ctx->xxh_state, prev);
4146
+ if (ctx->write_tokens)
4147
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4148
+ }
4149
+ XXH3_freeState(prev);
4150
+ }
4151
+
4152
+ if (node->limitOffset != NULL) {
4153
+ XXH3_state_t* prev = XXH3_createState();
4154
+ XXH64_hash_t hash;
4155
+
4156
+ XXH3_copyState(prev, ctx->xxh_state);
4157
+ _fingerprintString(ctx, "limitOffset");
4158
+
4159
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4160
+ _fingerprintNode(ctx, node->limitOffset, node, "limitOffset", depth + 1);
4161
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
3912
4162
  XXH3_copyState(ctx->xxh_state, prev);
3913
4163
  if (ctx->write_tokens)
3914
4164
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3930,7 +4180,7 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
3930
4180
 
3931
4181
  hash = XXH3_64bits_digest(ctx->xxh_state);
3932
4182
  _fingerprintNode(ctx, node->lockingClause, node, "lockingClause", depth + 1);
3933
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4183
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->lockingClause) == 1 && linitial(node->lockingClause) == NIL)) {
3934
4184
  XXH3_copyState(ctx->xxh_state, prev);
3935
4185
  if (ctx->write_tokens)
3936
4186
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3968,7 +4218,7 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
3968
4218
 
3969
4219
  hash = XXH3_64bits_digest(ctx->xxh_state);
3970
4220
  _fingerprintNode(ctx, node->sortClause, node, "sortClause", depth + 1);
3971
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4221
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->sortClause) == 1 && linitial(node->sortClause) == NIL)) {
3972
4222
  XXH3_copyState(ctx->xxh_state, prev);
3973
4223
  if (ctx->write_tokens)
3974
4224
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -3984,7 +4234,7 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
3984
4234
 
3985
4235
  hash = XXH3_64bits_digest(ctx->xxh_state);
3986
4236
  _fingerprintNode(ctx, node->targetList, node, "targetList", depth + 1);
3987
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4237
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->targetList) == 1 && linitial(node->targetList) == NIL)) {
3988
4238
  XXH3_copyState(ctx->xxh_state, prev);
3989
4239
  if (ctx->write_tokens)
3990
4240
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4000,7 +4250,7 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
4000
4250
 
4001
4251
  hash = XXH3_64bits_digest(ctx->xxh_state);
4002
4252
  _fingerprintNode(ctx, node->valuesLists, node, "valuesLists", depth + 1);
4003
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4253
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->valuesLists) == 1 && linitial(node->valuesLists) == NIL)) {
4004
4254
  XXH3_copyState(ctx->xxh_state, prev);
4005
4255
  if (ctx->write_tokens)
4006
4256
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4033,7 +4283,7 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
4033
4283
 
4034
4284
  hash = XXH3_64bits_digest(ctx->xxh_state);
4035
4285
  _fingerprintNode(ctx, node->windowClause, node, "windowClause", depth + 1);
4036
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4286
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->windowClause) == 1 && linitial(node->windowClause) == NIL)) {
4037
4287
  XXH3_copyState(ctx->xxh_state, prev);
4038
4288
  if (ctx->write_tokens)
4039
4289
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4059,6 +4309,80 @@ _fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const vo
4059
4309
 
4060
4310
  }
4061
4311
 
4312
+ static void
4313
+ _fingerprintReturnStmt(FingerprintContext *ctx, const ReturnStmt *node, const void *parent, const char *field_name, unsigned int depth)
4314
+ {
4315
+ if (node->returnval != NULL) {
4316
+ XXH3_state_t* prev = XXH3_createState();
4317
+ XXH64_hash_t hash;
4318
+
4319
+ XXH3_copyState(prev, ctx->xxh_state);
4320
+ _fingerprintString(ctx, "returnval");
4321
+
4322
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4323
+ _fingerprintNode(ctx, node->returnval, node, "returnval", depth + 1);
4324
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4325
+ XXH3_copyState(ctx->xxh_state, prev);
4326
+ if (ctx->write_tokens)
4327
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4328
+ }
4329
+ XXH3_freeState(prev);
4330
+ }
4331
+
4332
+ }
4333
+
4334
+ static void
4335
+ _fingerprintPLAssignStmt(FingerprintContext *ctx, const PLAssignStmt *node, const void *parent, const char *field_name, unsigned int depth)
4336
+ {
4337
+ if (node->indirection != NULL && node->indirection->length > 0) {
4338
+ XXH3_state_t* prev = XXH3_createState();
4339
+ XXH64_hash_t hash;
4340
+
4341
+ XXH3_copyState(prev, ctx->xxh_state);
4342
+ _fingerprintString(ctx, "indirection");
4343
+
4344
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4345
+ _fingerprintNode(ctx, node->indirection, node, "indirection", depth + 1);
4346
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->indirection) == 1 && linitial(node->indirection) == NIL)) {
4347
+ XXH3_copyState(ctx->xxh_state, prev);
4348
+ if (ctx->write_tokens)
4349
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4350
+ }
4351
+ XXH3_freeState(prev);
4352
+ }
4353
+ // Intentionally ignoring node->location for fingerprinting
4354
+
4355
+ if (node->name != NULL) {
4356
+ _fingerprintString(ctx, "name");
4357
+ _fingerprintString(ctx, node->name);
4358
+ }
4359
+
4360
+ if (node->nnames != 0) {
4361
+ char buffer[50];
4362
+ sprintf(buffer, "%d", node->nnames);
4363
+ _fingerprintString(ctx, "nnames");
4364
+ _fingerprintString(ctx, buffer);
4365
+ }
4366
+
4367
+ if (node->val != NULL) {
4368
+ XXH3_state_t* prev = XXH3_createState();
4369
+ XXH64_hash_t hash;
4370
+
4371
+ XXH3_copyState(prev, ctx->xxh_state);
4372
+ _fingerprintString(ctx, "val");
4373
+
4374
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4375
+ _fingerprintSelectStmt(ctx, node->val, node, "val", depth + 1);
4376
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4377
+ XXH3_copyState(ctx->xxh_state, prev);
4378
+ if (ctx->write_tokens)
4379
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4380
+ }
4381
+ XXH3_freeState(prev);
4382
+ }
4383
+
4384
+ }
4385
+
4062
4386
  static void
4063
4387
  _fingerprintAlterTableStmt(FingerprintContext *ctx, const AlterTableStmt *node, const void *parent, const char *field_name, unsigned int depth)
4064
4388
  {
@@ -4071,7 +4395,7 @@ _fingerprintAlterTableStmt(FingerprintContext *ctx, const AlterTableStmt *node,
4071
4395
 
4072
4396
  hash = XXH3_64bits_digest(ctx->xxh_state);
4073
4397
  _fingerprintNode(ctx, node->cmds, node, "cmds", depth + 1);
4074
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4398
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->cmds) == 1 && linitial(node->cmds) == NIL)) {
4075
4399
  XXH3_copyState(ctx->xxh_state, prev);
4076
4400
  if (ctx->write_tokens)
4077
4401
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4083,6 +4407,11 @@ _fingerprintAlterTableStmt(FingerprintContext *ctx, const AlterTableStmt *node,
4083
4407
  _fingerprintString(ctx, "true");
4084
4408
  }
4085
4409
 
4410
+ if (true) {
4411
+ _fingerprintString(ctx, "objtype");
4412
+ _fingerprintString(ctx, _enumToStringObjectType(node->objtype));
4413
+ }
4414
+
4086
4415
  if (node->relation != NULL) {
4087
4416
  XXH3_state_t* prev = XXH3_createState();
4088
4417
  XXH64_hash_t hash;
@@ -4100,11 +4429,6 @@ _fingerprintAlterTableStmt(FingerprintContext *ctx, const AlterTableStmt *node,
4100
4429
  XXH3_freeState(prev);
4101
4430
  }
4102
4431
 
4103
- if (true) {
4104
- _fingerprintString(ctx, "relkind");
4105
- _fingerprintString(ctx, _enumToStringObjectType(node->relkind));
4106
- }
4107
-
4108
4432
  }
4109
4433
 
4110
4434
  static void
@@ -4166,6 +4490,11 @@ _fingerprintAlterTableCmd(FingerprintContext *ctx, const AlterTableCmd *node, co
4166
4490
  _fingerprintString(ctx, buffer);
4167
4491
  }
4168
4492
 
4493
+ if (node->recurse) {
4494
+ _fingerprintString(ctx, "recurse");
4495
+ _fingerprintString(ctx, "true");
4496
+ }
4497
+
4169
4498
  if (true) {
4170
4499
  _fingerprintString(ctx, "subtype");
4171
4500
  _fingerprintString(ctx, _enumToStringAlterTableType(node->subtype));
@@ -4223,7 +4552,7 @@ _fingerprintAlterDomainStmt(FingerprintContext *ctx, const AlterDomainStmt *node
4223
4552
 
4224
4553
  hash = XXH3_64bits_digest(ctx->xxh_state);
4225
4554
  _fingerprintNode(ctx, node->typeName, node, "typeName", depth + 1);
4226
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4555
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->typeName) == 1 && linitial(node->typeName) == NIL)) {
4227
4556
  XXH3_copyState(ctx->xxh_state, prev);
4228
4557
  if (ctx->write_tokens)
4229
4558
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4249,7 +4578,7 @@ _fingerprintSetOperationStmt(FingerprintContext *ctx, const SetOperationStmt *no
4249
4578
 
4250
4579
  hash = XXH3_64bits_digest(ctx->xxh_state);
4251
4580
  _fingerprintNode(ctx, node->colCollations, node, "colCollations", depth + 1);
4252
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4581
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->colCollations) == 1 && linitial(node->colCollations) == NIL)) {
4253
4582
  XXH3_copyState(ctx->xxh_state, prev);
4254
4583
  if (ctx->write_tokens)
4255
4584
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4265,7 +4594,7 @@ _fingerprintSetOperationStmt(FingerprintContext *ctx, const SetOperationStmt *no
4265
4594
 
4266
4595
  hash = XXH3_64bits_digest(ctx->xxh_state);
4267
4596
  _fingerprintNode(ctx, node->colTypes, node, "colTypes", depth + 1);
4268
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4597
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->colTypes) == 1 && linitial(node->colTypes) == NIL)) {
4269
4598
  XXH3_copyState(ctx->xxh_state, prev);
4270
4599
  if (ctx->write_tokens)
4271
4600
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4281,7 +4610,7 @@ _fingerprintSetOperationStmt(FingerprintContext *ctx, const SetOperationStmt *no
4281
4610
 
4282
4611
  hash = XXH3_64bits_digest(ctx->xxh_state);
4283
4612
  _fingerprintNode(ctx, node->colTypmods, node, "colTypmods", depth + 1);
4284
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4613
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->colTypmods) == 1 && linitial(node->colTypmods) == NIL)) {
4285
4614
  XXH3_copyState(ctx->xxh_state, prev);
4286
4615
  if (ctx->write_tokens)
4287
4616
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4297,7 +4626,7 @@ _fingerprintSetOperationStmt(FingerprintContext *ctx, const SetOperationStmt *no
4297
4626
 
4298
4627
  hash = XXH3_64bits_digest(ctx->xxh_state);
4299
4628
  _fingerprintNode(ctx, node->groupClauses, node, "groupClauses", depth + 1);
4300
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4629
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->groupClauses) == 1 && linitial(node->groupClauses) == NIL)) {
4301
4630
  XXH3_copyState(ctx->xxh_state, prev);
4302
4631
  if (ctx->write_tokens)
4303
4632
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4367,6 +4696,22 @@ _fingerprintGrantStmt(FingerprintContext *ctx, const GrantStmt *node, const void
4367
4696
 
4368
4697
  hash = XXH3_64bits_digest(ctx->xxh_state);
4369
4698
  _fingerprintNode(ctx, node->grantees, node, "grantees", depth + 1);
4699
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->grantees) == 1 && linitial(node->grantees) == NIL)) {
4700
+ XXH3_copyState(ctx->xxh_state, prev);
4701
+ if (ctx->write_tokens)
4702
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4703
+ }
4704
+ XXH3_freeState(prev);
4705
+ }
4706
+ if (node->grantor != NULL) {
4707
+ XXH3_state_t* prev = XXH3_createState();
4708
+ XXH64_hash_t hash;
4709
+
4710
+ XXH3_copyState(prev, ctx->xxh_state);
4711
+ _fingerprintString(ctx, "grantor");
4712
+
4713
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4714
+ _fingerprintRoleSpec(ctx, node->grantor, node, "grantor", depth + 1);
4370
4715
  if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4371
4716
  XXH3_copyState(ctx->xxh_state, prev);
4372
4717
  if (ctx->write_tokens)
@@ -4374,6 +4719,7 @@ _fingerprintGrantStmt(FingerprintContext *ctx, const GrantStmt *node, const void
4374
4719
  }
4375
4720
  XXH3_freeState(prev);
4376
4721
  }
4722
+
4377
4723
  if (node->is_grant) {
4378
4724
  _fingerprintString(ctx, "is_grant");
4379
4725
  _fingerprintString(ctx, "true");
@@ -4388,7 +4734,7 @@ _fingerprintGrantStmt(FingerprintContext *ctx, const GrantStmt *node, const void
4388
4734
 
4389
4735
  hash = XXH3_64bits_digest(ctx->xxh_state);
4390
4736
  _fingerprintNode(ctx, node->objects, node, "objects", depth + 1);
4391
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4737
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->objects) == 1 && linitial(node->objects) == NIL)) {
4392
4738
  XXH3_copyState(ctx->xxh_state, prev);
4393
4739
  if (ctx->write_tokens)
4394
4740
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4409,7 +4755,7 @@ _fingerprintGrantStmt(FingerprintContext *ctx, const GrantStmt *node, const void
4409
4755
 
4410
4756
  hash = XXH3_64bits_digest(ctx->xxh_state);
4411
4757
  _fingerprintNode(ctx, node->privileges, node, "privileges", depth + 1);
4412
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4758
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->privileges) == 1 && linitial(node->privileges) == NIL)) {
4413
4759
  XXH3_copyState(ctx->xxh_state, prev);
4414
4760
  if (ctx->write_tokens)
4415
4761
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4445,7 +4791,7 @@ _fingerprintGrantRoleStmt(FingerprintContext *ctx, const GrantRoleStmt *node, co
4445
4791
 
4446
4792
  hash = XXH3_64bits_digest(ctx->xxh_state);
4447
4793
  _fingerprintNode(ctx, node->granted_roles, node, "granted_roles", depth + 1);
4448
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4794
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->granted_roles) == 1 && linitial(node->granted_roles) == NIL)) {
4449
4795
  XXH3_copyState(ctx->xxh_state, prev);
4450
4796
  if (ctx->write_tokens)
4451
4797
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4461,7 +4807,7 @@ _fingerprintGrantRoleStmt(FingerprintContext *ctx, const GrantRoleStmt *node, co
4461
4807
 
4462
4808
  hash = XXH3_64bits_digest(ctx->xxh_state);
4463
4809
  _fingerprintNode(ctx, node->grantee_roles, node, "grantee_roles", depth + 1);
4464
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4810
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->grantee_roles) == 1 && linitial(node->grantee_roles) == NIL)) {
4465
4811
  XXH3_copyState(ctx->xxh_state, prev);
4466
4812
  if (ctx->write_tokens)
4467
4813
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4521,7 +4867,7 @@ _fingerprintAlterDefaultPrivilegesStmt(FingerprintContext *ctx, const AlterDefau
4521
4867
 
4522
4868
  hash = XXH3_64bits_digest(ctx->xxh_state);
4523
4869
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
4524
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4870
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
4525
4871
  XXH3_copyState(ctx->xxh_state, prev);
4526
4872
  if (ctx->write_tokens)
4527
4873
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4545,13 +4891,22 @@ _fingerprintClusterStmt(FingerprintContext *ctx, const ClusterStmt *node, const
4545
4891
  _fingerprintString(ctx, node->indexname);
4546
4892
  }
4547
4893
 
4548
- if (node->options != 0) {
4549
- char buffer[50];
4550
- sprintf(buffer, "%d", node->options);
4551
- _fingerprintString(ctx, "options");
4552
- _fingerprintString(ctx, buffer);
4553
- }
4894
+ if (node->params != NULL && node->params->length > 0) {
4895
+ XXH3_state_t* prev = XXH3_createState();
4896
+ XXH64_hash_t hash;
4897
+
4898
+ XXH3_copyState(prev, ctx->xxh_state);
4899
+ _fingerprintString(ctx, "params");
4554
4900
 
4901
+ hash = XXH3_64bits_digest(ctx->xxh_state);
4902
+ _fingerprintNode(ctx, node->params, node, "params", depth + 1);
4903
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->params) == 1 && linitial(node->params) == NIL)) {
4904
+ XXH3_copyState(ctx->xxh_state, prev);
4905
+ if (ctx->write_tokens)
4906
+ dlist_delete(dlist_tail_node(&ctx->tokens));
4907
+ }
4908
+ XXH3_freeState(prev);
4909
+ }
4555
4910
  if (node->relation != NULL) {
4556
4911
  XXH3_state_t* prev = XXH3_createState();
4557
4912
  XXH64_hash_t hash;
@@ -4583,7 +4938,7 @@ _fingerprintCopyStmt(FingerprintContext *ctx, const CopyStmt *node, const void *
4583
4938
 
4584
4939
  hash = XXH3_64bits_digest(ctx->xxh_state);
4585
4940
  _fingerprintNode(ctx, node->attlist, node, "attlist", depth + 1);
4586
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4941
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->attlist) == 1 && linitial(node->attlist) == NIL)) {
4587
4942
  XXH3_copyState(ctx->xxh_state, prev);
4588
4943
  if (ctx->write_tokens)
4589
4944
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4614,7 +4969,7 @@ _fingerprintCopyStmt(FingerprintContext *ctx, const CopyStmt *node, const void *
4614
4969
 
4615
4970
  hash = XXH3_64bits_digest(ctx->xxh_state);
4616
4971
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
4617
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
4972
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
4618
4973
  XXH3_copyState(ctx->xxh_state, prev);
4619
4974
  if (ctx->write_tokens)
4620
4975
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4691,7 +5046,7 @@ _fingerprintCreateStmt(FingerprintContext *ctx, const CreateStmt *node, const vo
4691
5046
 
4692
5047
  hash = XXH3_64bits_digest(ctx->xxh_state);
4693
5048
  _fingerprintNode(ctx, node->constraints, node, "constraints", depth + 1);
4694
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5049
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->constraints) == 1 && linitial(node->constraints) == NIL)) {
4695
5050
  XXH3_copyState(ctx->xxh_state, prev);
4696
5051
  if (ctx->write_tokens)
4697
5052
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4712,7 +5067,7 @@ _fingerprintCreateStmt(FingerprintContext *ctx, const CreateStmt *node, const vo
4712
5067
 
4713
5068
  hash = XXH3_64bits_digest(ctx->xxh_state);
4714
5069
  _fingerprintNode(ctx, node->inhRelations, node, "inhRelations", depth + 1);
4715
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5070
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->inhRelations) == 1 && linitial(node->inhRelations) == NIL)) {
4716
5071
  XXH3_copyState(ctx->xxh_state, prev);
4717
5072
  if (ctx->write_tokens)
4718
5073
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4750,7 +5105,7 @@ _fingerprintCreateStmt(FingerprintContext *ctx, const CreateStmt *node, const vo
4750
5105
 
4751
5106
  hash = XXH3_64bits_digest(ctx->xxh_state);
4752
5107
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
4753
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5108
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
4754
5109
  XXH3_copyState(ctx->xxh_state, prev);
4755
5110
  if (ctx->write_tokens)
4756
5111
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4817,7 +5172,7 @@ _fingerprintCreateStmt(FingerprintContext *ctx, const CreateStmt *node, const vo
4817
5172
 
4818
5173
  hash = XXH3_64bits_digest(ctx->xxh_state);
4819
5174
  _fingerprintNode(ctx, node->tableElts, node, "tableElts", depth + 1);
4820
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5175
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->tableElts) == 1 && linitial(node->tableElts) == NIL)) {
4821
5176
  XXH3_copyState(ctx->xxh_state, prev);
4822
5177
  if (ctx->write_tokens)
4823
5178
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4843,7 +5198,7 @@ _fingerprintDefineStmt(FingerprintContext *ctx, const DefineStmt *node, const vo
4843
5198
 
4844
5199
  hash = XXH3_64bits_digest(ctx->xxh_state);
4845
5200
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
4846
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5201
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
4847
5202
  XXH3_copyState(ctx->xxh_state, prev);
4848
5203
  if (ctx->write_tokens)
4849
5204
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4859,7 +5214,7 @@ _fingerprintDefineStmt(FingerprintContext *ctx, const DefineStmt *node, const vo
4859
5214
 
4860
5215
  hash = XXH3_64bits_digest(ctx->xxh_state);
4861
5216
  _fingerprintNode(ctx, node->definition, node, "definition", depth + 1);
4862
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5217
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->definition) == 1 && linitial(node->definition) == NIL)) {
4863
5218
  XXH3_copyState(ctx->xxh_state, prev);
4864
5219
  if (ctx->write_tokens)
4865
5220
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4875,7 +5230,7 @@ _fingerprintDefineStmt(FingerprintContext *ctx, const DefineStmt *node, const vo
4875
5230
 
4876
5231
  hash = XXH3_64bits_digest(ctx->xxh_state);
4877
5232
  _fingerprintNode(ctx, node->defnames, node, "defnames", depth + 1);
4878
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5233
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->defnames) == 1 && linitial(node->defnames) == NIL)) {
4879
5234
  XXH3_copyState(ctx->xxh_state, prev);
4880
5235
  if (ctx->write_tokens)
4881
5236
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4931,7 +5286,7 @@ _fingerprintDropStmt(FingerprintContext *ctx, const DropStmt *node, const void *
4931
5286
 
4932
5287
  hash = XXH3_64bits_digest(ctx->xxh_state);
4933
5288
  _fingerprintNode(ctx, node->objects, node, "objects", depth + 1);
4934
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5289
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->objects) == 1 && linitial(node->objects) == NIL)) {
4935
5290
  XXH3_copyState(ctx->xxh_state, prev);
4936
5291
  if (ctx->write_tokens)
4937
5292
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -4962,7 +5317,7 @@ _fingerprintTruncateStmt(FingerprintContext *ctx, const TruncateStmt *node, cons
4962
5317
 
4963
5318
  hash = XXH3_64bits_digest(ctx->xxh_state);
4964
5319
  _fingerprintNode(ctx, node->relations, node, "relations", depth + 1);
4965
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5320
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->relations) == 1 && linitial(node->relations) == NIL)) {
4966
5321
  XXH3_copyState(ctx->xxh_state, prev);
4967
5322
  if (ctx->write_tokens)
4968
5323
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5059,7 +5414,7 @@ _fingerprintIndexStmt(FingerprintContext *ctx, const IndexStmt *node, const void
5059
5414
 
5060
5415
  hash = XXH3_64bits_digest(ctx->xxh_state);
5061
5416
  _fingerprintNode(ctx, node->excludeOpNames, node, "excludeOpNames", depth + 1);
5062
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5417
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->excludeOpNames) == 1 && linitial(node->excludeOpNames) == NIL)) {
5063
5418
  XXH3_copyState(ctx->xxh_state, prev);
5064
5419
  if (ctx->write_tokens)
5065
5420
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5090,7 +5445,7 @@ _fingerprintIndexStmt(FingerprintContext *ctx, const IndexStmt *node, const void
5090
5445
 
5091
5446
  hash = XXH3_64bits_digest(ctx->xxh_state);
5092
5447
  _fingerprintNode(ctx, node->indexIncludingParams, node, "indexIncludingParams", depth + 1);
5093
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5448
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->indexIncludingParams) == 1 && linitial(node->indexIncludingParams) == NIL)) {
5094
5449
  XXH3_copyState(ctx->xxh_state, prev);
5095
5450
  if (ctx->write_tokens)
5096
5451
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5113,7 +5468,7 @@ _fingerprintIndexStmt(FingerprintContext *ctx, const IndexStmt *node, const void
5113
5468
 
5114
5469
  hash = XXH3_64bits_digest(ctx->xxh_state);
5115
5470
  _fingerprintNode(ctx, node->indexParams, node, "indexParams", depth + 1);
5116
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5471
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->indexParams) == 1 && linitial(node->indexParams) == NIL)) {
5117
5472
  XXH3_copyState(ctx->xxh_state, prev);
5118
5473
  if (ctx->write_tokens)
5119
5474
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5130,6 +5485,11 @@ _fingerprintIndexStmt(FingerprintContext *ctx, const IndexStmt *node, const void
5130
5485
  _fingerprintString(ctx, "true");
5131
5486
  }
5132
5487
 
5488
+ if (node->nulls_not_distinct) {
5489
+ _fingerprintString(ctx, "nulls_not_distinct");
5490
+ _fingerprintString(ctx, "true");
5491
+ }
5492
+
5133
5493
  if (node->oldCreateSubid != 0) {
5134
5494
  char buffer[50];
5135
5495
  sprintf(buffer, "%d", node->oldCreateSubid);
@@ -5160,7 +5520,7 @@ _fingerprintIndexStmt(FingerprintContext *ctx, const IndexStmt *node, const void
5160
5520
 
5161
5521
  hash = XXH3_64bits_digest(ctx->xxh_state);
5162
5522
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
5163
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5523
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
5164
5524
  XXH3_copyState(ctx->xxh_state, prev);
5165
5525
  if (ctx->write_tokens)
5166
5526
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5240,7 +5600,7 @@ _fingerprintCreateFunctionStmt(FingerprintContext *ctx, const CreateFunctionStmt
5240
5600
 
5241
5601
  hash = XXH3_64bits_digest(ctx->xxh_state);
5242
5602
  _fingerprintNode(ctx, node->funcname, node, "funcname", depth + 1);
5243
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5603
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->funcname) == 1 && linitial(node->funcname) == NIL)) {
5244
5604
  XXH3_copyState(ctx->xxh_state, prev);
5245
5605
  if (ctx->write_tokens)
5246
5606
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5252,22 +5612,8 @@ _fingerprintCreateFunctionStmt(FingerprintContext *ctx, const CreateFunctionStmt
5252
5612
  _fingerprintString(ctx, "true");
5253
5613
  }
5254
5614
 
5255
- if (node->options != NULL && node->options->length > 0) {
5256
- XXH3_state_t* prev = XXH3_createState();
5257
- XXH64_hash_t hash;
5258
-
5259
- XXH3_copyState(prev, ctx->xxh_state);
5260
- _fingerprintString(ctx, "options");
5615
+ // Intentionally ignoring node->options for fingerprinting
5261
5616
 
5262
- hash = XXH3_64bits_digest(ctx->xxh_state);
5263
- _fingerprintNode(ctx, node->options, node, "options", depth + 1);
5264
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5265
- XXH3_copyState(ctx->xxh_state, prev);
5266
- if (ctx->write_tokens)
5267
- dlist_delete(dlist_tail_node(&ctx->tokens));
5268
- }
5269
- XXH3_freeState(prev);
5270
- }
5271
5617
  if (node->parameters != NULL && node->parameters->length > 0) {
5272
5618
  XXH3_state_t* prev = XXH3_createState();
5273
5619
  XXH64_hash_t hash;
@@ -5277,7 +5623,7 @@ _fingerprintCreateFunctionStmt(FingerprintContext *ctx, const CreateFunctionStmt
5277
5623
 
5278
5624
  hash = XXH3_64bits_digest(ctx->xxh_state);
5279
5625
  _fingerprintNode(ctx, node->parameters, node, "parameters", depth + 1);
5280
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5626
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->parameters) == 1 && linitial(node->parameters) == NIL)) {
5281
5627
  XXH3_copyState(ctx->xxh_state, prev);
5282
5628
  if (ctx->write_tokens)
5283
5629
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5306,20 +5652,15 @@ _fingerprintCreateFunctionStmt(FingerprintContext *ctx, const CreateFunctionStmt
5306
5652
  XXH3_freeState(prev);
5307
5653
  }
5308
5654
 
5309
- }
5310
-
5311
- static void
5312
- _fingerprintAlterFunctionStmt(FingerprintContext *ctx, const AlterFunctionStmt *node, const void *parent, const char *field_name, unsigned int depth)
5313
- {
5314
- if (node->actions != NULL && node->actions->length > 0) {
5655
+ if (node->sql_body != NULL) {
5315
5656
  XXH3_state_t* prev = XXH3_createState();
5316
5657
  XXH64_hash_t hash;
5317
5658
 
5318
5659
  XXH3_copyState(prev, ctx->xxh_state);
5319
- _fingerprintString(ctx, "actions");
5660
+ _fingerprintString(ctx, "sql_body");
5320
5661
 
5321
5662
  hash = XXH3_64bits_digest(ctx->xxh_state);
5322
- _fingerprintNode(ctx, node->actions, node, "actions", depth + 1);
5663
+ _fingerprintNode(ctx, node->sql_body, node, "sql_body", depth + 1);
5323
5664
  if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5324
5665
  XXH3_copyState(ctx->xxh_state, prev);
5325
5666
  if (ctx->write_tokens)
@@ -5327,6 +5668,28 @@ _fingerprintAlterFunctionStmt(FingerprintContext *ctx, const AlterFunctionStmt *
5327
5668
  }
5328
5669
  XXH3_freeState(prev);
5329
5670
  }
5671
+
5672
+ }
5673
+
5674
+ static void
5675
+ _fingerprintAlterFunctionStmt(FingerprintContext *ctx, const AlterFunctionStmt *node, const void *parent, const char *field_name, unsigned int depth)
5676
+ {
5677
+ if (node->actions != NULL && node->actions->length > 0) {
5678
+ XXH3_state_t* prev = XXH3_createState();
5679
+ XXH64_hash_t hash;
5680
+
5681
+ XXH3_copyState(prev, ctx->xxh_state);
5682
+ _fingerprintString(ctx, "actions");
5683
+
5684
+ hash = XXH3_64bits_digest(ctx->xxh_state);
5685
+ _fingerprintNode(ctx, node->actions, node, "actions", depth + 1);
5686
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->actions) == 1 && linitial(node->actions) == NIL)) {
5687
+ XXH3_copyState(ctx->xxh_state, prev);
5688
+ if (ctx->write_tokens)
5689
+ dlist_delete(dlist_tail_node(&ctx->tokens));
5690
+ }
5691
+ XXH3_freeState(prev);
5692
+ }
5330
5693
  if (node->func != NULL) {
5331
5694
  XXH3_state_t* prev = XXH3_createState();
5332
5695
  XXH64_hash_t hash;
@@ -5354,22 +5717,8 @@ _fingerprintAlterFunctionStmt(FingerprintContext *ctx, const AlterFunctionStmt *
5354
5717
  static void
5355
5718
  _fingerprintDoStmt(FingerprintContext *ctx, const DoStmt *node, const void *parent, const char *field_name, unsigned int depth)
5356
5719
  {
5357
- if (node->args != NULL && node->args->length > 0) {
5358
- XXH3_state_t* prev = XXH3_createState();
5359
- XXH64_hash_t hash;
5360
-
5361
- XXH3_copyState(prev, ctx->xxh_state);
5362
- _fingerprintString(ctx, "args");
5720
+ // Intentionally ignoring node->args for fingerprinting
5363
5721
 
5364
- hash = XXH3_64bits_digest(ctx->xxh_state);
5365
- _fingerprintNode(ctx, node->args, node, "args", depth + 1);
5366
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5367
- XXH3_copyState(ctx->xxh_state, prev);
5368
- if (ctx->write_tokens)
5369
- dlist_delete(dlist_tail_node(&ctx->tokens));
5370
- }
5371
- XXH3_freeState(prev);
5372
- }
5373
5722
  }
5374
5723
 
5375
5724
  static void
@@ -5453,7 +5802,7 @@ _fingerprintRuleStmt(FingerprintContext *ctx, const RuleStmt *node, const void *
5453
5802
 
5454
5803
  hash = XXH3_64bits_digest(ctx->xxh_state);
5455
5804
  _fingerprintNode(ctx, node->actions, node, "actions", depth + 1);
5456
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5805
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->actions) == 1 && linitial(node->actions) == NIL)) {
5457
5806
  XXH3_copyState(ctx->xxh_state, prev);
5458
5807
  if (ctx->write_tokens)
5459
5808
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5519,10 +5868,7 @@ _fingerprintRuleStmt(FingerprintContext *ctx, const RuleStmt *node, const void *
5519
5868
  static void
5520
5869
  _fingerprintNotifyStmt(FingerprintContext *ctx, const NotifyStmt *node, const void *parent, const char *field_name, unsigned int depth)
5521
5870
  {
5522
- if (node->conditionname != NULL) {
5523
- _fingerprintString(ctx, "conditionname");
5524
- _fingerprintString(ctx, node->conditionname);
5525
- }
5871
+ // Intentionally ignoring node->conditionname for fingerprinting
5526
5872
 
5527
5873
  if (node->payload != NULL) {
5528
5874
  _fingerprintString(ctx, "payload");
@@ -5534,20 +5880,14 @@ _fingerprintNotifyStmt(FingerprintContext *ctx, const NotifyStmt *node, const vo
5534
5880
  static void
5535
5881
  _fingerprintListenStmt(FingerprintContext *ctx, const ListenStmt *node, const void *parent, const char *field_name, unsigned int depth)
5536
5882
  {
5537
- if (node->conditionname != NULL) {
5538
- _fingerprintString(ctx, "conditionname");
5539
- _fingerprintString(ctx, node->conditionname);
5540
- }
5883
+ // Intentionally ignoring node->conditionname for fingerprinting
5541
5884
 
5542
5885
  }
5543
5886
 
5544
5887
  static void
5545
5888
  _fingerprintUnlistenStmt(FingerprintContext *ctx, const UnlistenStmt *node, const void *parent, const char *field_name, unsigned int depth)
5546
5889
  {
5547
- if (node->conditionname != NULL) {
5548
- _fingerprintString(ctx, "conditionname");
5549
- _fingerprintString(ctx, node->conditionname);
5550
- }
5890
+ // Intentionally ignoring node->conditionname for fingerprinting
5551
5891
 
5552
5892
  }
5553
5893
 
@@ -5584,7 +5924,7 @@ _fingerprintViewStmt(FingerprintContext *ctx, const ViewStmt *node, const void *
5584
5924
 
5585
5925
  hash = XXH3_64bits_digest(ctx->xxh_state);
5586
5926
  _fingerprintNode(ctx, node->aliases, node, "aliases", depth + 1);
5587
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5927
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->aliases) == 1 && linitial(node->aliases) == NIL)) {
5588
5928
  XXH3_copyState(ctx->xxh_state, prev);
5589
5929
  if (ctx->write_tokens)
5590
5930
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5600,7 +5940,7 @@ _fingerprintViewStmt(FingerprintContext *ctx, const ViewStmt *node, const void *
5600
5940
 
5601
5941
  hash = XXH3_64bits_digest(ctx->xxh_state);
5602
5942
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
5603
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
5943
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
5604
5944
  XXH3_copyState(ctx->xxh_state, prev);
5605
5945
  if (ctx->write_tokens)
5606
5946
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5692,7 +6032,7 @@ _fingerprintCreateDomainStmt(FingerprintContext *ctx, const CreateDomainStmt *no
5692
6032
 
5693
6033
  hash = XXH3_64bits_digest(ctx->xxh_state);
5694
6034
  _fingerprintNode(ctx, node->constraints, node, "constraints", depth + 1);
5695
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6035
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->constraints) == 1 && linitial(node->constraints) == NIL)) {
5696
6036
  XXH3_copyState(ctx->xxh_state, prev);
5697
6037
  if (ctx->write_tokens)
5698
6038
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5708,7 +6048,7 @@ _fingerprintCreateDomainStmt(FingerprintContext *ctx, const CreateDomainStmt *no
5708
6048
 
5709
6049
  hash = XXH3_64bits_digest(ctx->xxh_state);
5710
6050
  _fingerprintNode(ctx, node->domainname, node, "domainname", depth + 1);
5711
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6051
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->domainname) == 1 && linitial(node->domainname) == NIL)) {
5712
6052
  XXH3_copyState(ctx->xxh_state, prev);
5713
6053
  if (ctx->write_tokens)
5714
6054
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5751,7 +6091,7 @@ _fingerprintCreatedbStmt(FingerprintContext *ctx, const CreatedbStmt *node, cons
5751
6091
 
5752
6092
  hash = XXH3_64bits_digest(ctx->xxh_state);
5753
6093
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
5754
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6094
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
5755
6095
  XXH3_copyState(ctx->xxh_state, prev);
5756
6096
  if (ctx->write_tokens)
5757
6097
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5782,7 +6122,7 @@ _fingerprintDropdbStmt(FingerprintContext *ctx, const DropdbStmt *node, const vo
5782
6122
 
5783
6123
  hash = XXH3_64bits_digest(ctx->xxh_state);
5784
6124
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
5785
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6125
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
5786
6126
  XXH3_copyState(ctx->xxh_state, prev);
5787
6127
  if (ctx->write_tokens)
5788
6128
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5808,7 +6148,7 @@ _fingerprintVacuumStmt(FingerprintContext *ctx, const VacuumStmt *node, const vo
5808
6148
 
5809
6149
  hash = XXH3_64bits_digest(ctx->xxh_state);
5810
6150
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
5811
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6151
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
5812
6152
  XXH3_copyState(ctx->xxh_state, prev);
5813
6153
  if (ctx->write_tokens)
5814
6154
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5824,7 +6164,7 @@ _fingerprintVacuumStmt(FingerprintContext *ctx, const VacuumStmt *node, const vo
5824
6164
 
5825
6165
  hash = XXH3_64bits_digest(ctx->xxh_state);
5826
6166
  _fingerprintNode(ctx, node->rels, node, "rels", depth + 1);
5827
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6167
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->rels) == 1 && linitial(node->rels) == NIL)) {
5828
6168
  XXH3_copyState(ctx->xxh_state, prev);
5829
6169
  if (ctx->write_tokens)
5830
6170
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5845,7 +6185,7 @@ _fingerprintExplainStmt(FingerprintContext *ctx, const ExplainStmt *node, const
5845
6185
 
5846
6186
  hash = XXH3_64bits_digest(ctx->xxh_state);
5847
6187
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
5848
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6188
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
5849
6189
  XXH3_copyState(ctx->xxh_state, prev);
5850
6190
  if (ctx->write_tokens)
5851
6191
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -5901,6 +6241,11 @@ _fingerprintCreateTableAsStmt(FingerprintContext *ctx, const CreateTableAsStmt *
5901
6241
  _fingerprintString(ctx, "true");
5902
6242
  }
5903
6243
 
6244
+ if (true) {
6245
+ _fingerprintString(ctx, "objtype");
6246
+ _fingerprintString(ctx, _enumToStringObjectType(node->objtype));
6247
+ }
6248
+
5904
6249
  if (node->query != NULL) {
5905
6250
  XXH3_state_t* prev = XXH3_createState();
5906
6251
  XXH64_hash_t hash;
@@ -5918,11 +6263,6 @@ _fingerprintCreateTableAsStmt(FingerprintContext *ctx, const CreateTableAsStmt *
5918
6263
  XXH3_freeState(prev);
5919
6264
  }
5920
6265
 
5921
- if (true) {
5922
- _fingerprintString(ctx, "relkind");
5923
- _fingerprintString(ctx, _enumToStringObjectType(node->relkind));
5924
- }
5925
-
5926
6266
  }
5927
6267
 
5928
6268
  static void
@@ -5947,7 +6287,7 @@ _fingerprintCreateSeqStmt(FingerprintContext *ctx, const CreateSeqStmt *node, co
5947
6287
 
5948
6288
  hash = XXH3_64bits_digest(ctx->xxh_state);
5949
6289
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
5950
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6290
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
5951
6291
  XXH3_copyState(ctx->xxh_state, prev);
5952
6292
  if (ctx->write_tokens)
5953
6293
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6002,7 +6342,7 @@ _fingerprintAlterSeqStmt(FingerprintContext *ctx, const AlterSeqStmt *node, cons
6002
6342
 
6003
6343
  hash = XXH3_64bits_digest(ctx->xxh_state);
6004
6344
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
6005
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6345
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
6006
6346
  XXH3_copyState(ctx->xxh_state, prev);
6007
6347
  if (ctx->write_tokens)
6008
6348
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6040,7 +6380,7 @@ _fingerprintVariableSetStmt(FingerprintContext *ctx, const VariableSetStmt *node
6040
6380
 
6041
6381
  hash = XXH3_64bits_digest(ctx->xxh_state);
6042
6382
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
6043
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6383
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
6044
6384
  XXH3_copyState(ctx->xxh_state, prev);
6045
6385
  if (ctx->write_tokens)
6046
6386
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6096,7 +6436,7 @@ _fingerprintCreateTrigStmt(FingerprintContext *ctx, const CreateTrigStmt *node,
6096
6436
 
6097
6437
  hash = XXH3_64bits_digest(ctx->xxh_state);
6098
6438
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
6099
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6439
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
6100
6440
  XXH3_copyState(ctx->xxh_state, prev);
6101
6441
  if (ctx->write_tokens)
6102
6442
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6112,7 +6452,7 @@ _fingerprintCreateTrigStmt(FingerprintContext *ctx, const CreateTrigStmt *node,
6112
6452
 
6113
6453
  hash = XXH3_64bits_digest(ctx->xxh_state);
6114
6454
  _fingerprintNode(ctx, node->columns, node, "columns", depth + 1);
6115
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6455
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->columns) == 1 && linitial(node->columns) == NIL)) {
6116
6456
  XXH3_copyState(ctx->xxh_state, prev);
6117
6457
  if (ctx->write_tokens)
6118
6458
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6157,7 +6497,7 @@ _fingerprintCreateTrigStmt(FingerprintContext *ctx, const CreateTrigStmt *node,
6157
6497
 
6158
6498
  hash = XXH3_64bits_digest(ctx->xxh_state);
6159
6499
  _fingerprintNode(ctx, node->funcname, node, "funcname", depth + 1);
6160
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6500
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->funcname) == 1 && linitial(node->funcname) == NIL)) {
6161
6501
  XXH3_copyState(ctx->xxh_state, prev);
6162
6502
  if (ctx->write_tokens)
6163
6503
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6191,6 +6531,11 @@ _fingerprintCreateTrigStmt(FingerprintContext *ctx, const CreateTrigStmt *node,
6191
6531
  XXH3_freeState(prev);
6192
6532
  }
6193
6533
 
6534
+ if (node->replace) {
6535
+ _fingerprintString(ctx, "replace");
6536
+ _fingerprintString(ctx, "true");
6537
+ }
6538
+
6194
6539
  if (node->row) {
6195
6540
  _fingerprintString(ctx, "row");
6196
6541
  _fingerprintString(ctx, "true");
@@ -6212,7 +6557,7 @@ _fingerprintCreateTrigStmt(FingerprintContext *ctx, const CreateTrigStmt *node,
6212
6557
 
6213
6558
  hash = XXH3_64bits_digest(ctx->xxh_state);
6214
6559
  _fingerprintNode(ctx, node->transitionRels, node, "transitionRels", depth + 1);
6215
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6560
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->transitionRels) == 1 && linitial(node->transitionRels) == NIL)) {
6216
6561
  XXH3_copyState(ctx->xxh_state, prev);
6217
6562
  if (ctx->write_tokens)
6218
6563
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6255,7 +6600,7 @@ _fingerprintCreatePLangStmt(FingerprintContext *ctx, const CreatePLangStmt *node
6255
6600
 
6256
6601
  hash = XXH3_64bits_digest(ctx->xxh_state);
6257
6602
  _fingerprintNode(ctx, node->plhandler, node, "plhandler", depth + 1);
6258
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6603
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->plhandler) == 1 && linitial(node->plhandler) == NIL)) {
6259
6604
  XXH3_copyState(ctx->xxh_state, prev);
6260
6605
  if (ctx->write_tokens)
6261
6606
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6271,7 +6616,7 @@ _fingerprintCreatePLangStmt(FingerprintContext *ctx, const CreatePLangStmt *node
6271
6616
 
6272
6617
  hash = XXH3_64bits_digest(ctx->xxh_state);
6273
6618
  _fingerprintNode(ctx, node->plinline, node, "plinline", depth + 1);
6274
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6619
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->plinline) == 1 && linitial(node->plinline) == NIL)) {
6275
6620
  XXH3_copyState(ctx->xxh_state, prev);
6276
6621
  if (ctx->write_tokens)
6277
6622
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6297,7 +6642,7 @@ _fingerprintCreatePLangStmt(FingerprintContext *ctx, const CreatePLangStmt *node
6297
6642
 
6298
6643
  hash = XXH3_64bits_digest(ctx->xxh_state);
6299
6644
  _fingerprintNode(ctx, node->plvalidator, node, "plvalidator", depth + 1);
6300
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6645
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->plvalidator) == 1 && linitial(node->plvalidator) == NIL)) {
6301
6646
  XXH3_copyState(ctx->xxh_state, prev);
6302
6647
  if (ctx->write_tokens)
6303
6648
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6323,7 +6668,7 @@ _fingerprintCreateRoleStmt(FingerprintContext *ctx, const CreateRoleStmt *node,
6323
6668
 
6324
6669
  hash = XXH3_64bits_digest(ctx->xxh_state);
6325
6670
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
6326
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6671
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
6327
6672
  XXH3_copyState(ctx->xxh_state, prev);
6328
6673
  if (ctx->write_tokens)
6329
6674
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6361,7 +6706,7 @@ _fingerprintAlterRoleStmt(FingerprintContext *ctx, const AlterRoleStmt *node, co
6361
6706
 
6362
6707
  hash = XXH3_64bits_digest(ctx->xxh_state);
6363
6708
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
6364
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6709
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
6365
6710
  XXH3_copyState(ctx->xxh_state, prev);
6366
6711
  if (ctx->write_tokens)
6367
6712
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6404,7 +6749,7 @@ _fingerprintDropRoleStmt(FingerprintContext *ctx, const DropRoleStmt *node, cons
6404
6749
 
6405
6750
  hash = XXH3_64bits_digest(ctx->xxh_state);
6406
6751
  _fingerprintNode(ctx, node->roles, node, "roles", depth + 1);
6407
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6752
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->roles) == 1 && linitial(node->roles) == NIL)) {
6408
6753
  XXH3_copyState(ctx->xxh_state, prev);
6409
6754
  if (ctx->write_tokens)
6410
6755
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6437,7 +6782,7 @@ _fingerprintLockStmt(FingerprintContext *ctx, const LockStmt *node, const void *
6437
6782
 
6438
6783
  hash = XXH3_64bits_digest(ctx->xxh_state);
6439
6784
  _fingerprintNode(ctx, node->relations, node, "relations", depth + 1);
6440
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6785
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->relations) == 1 && linitial(node->relations) == NIL)) {
6441
6786
  XXH3_copyState(ctx->xxh_state, prev);
6442
6787
  if (ctx->write_tokens)
6443
6788
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6458,7 +6803,7 @@ _fingerprintConstraintsSetStmt(FingerprintContext *ctx, const ConstraintsSetStmt
6458
6803
 
6459
6804
  hash = XXH3_64bits_digest(ctx->xxh_state);
6460
6805
  _fingerprintNode(ctx, node->constraints, node, "constraints", depth + 1);
6461
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6806
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->constraints) == 1 && linitial(node->constraints) == NIL)) {
6462
6807
  XXH3_copyState(ctx->xxh_state, prev);
6463
6808
  if (ctx->write_tokens)
6464
6809
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6475,11 +6820,6 @@ _fingerprintConstraintsSetStmt(FingerprintContext *ctx, const ConstraintsSetStmt
6475
6820
  static void
6476
6821
  _fingerprintReindexStmt(FingerprintContext *ctx, const ReindexStmt *node, const void *parent, const char *field_name, unsigned int depth)
6477
6822
  {
6478
- if (node->concurrent) {
6479
- _fingerprintString(ctx, "concurrent");
6480
- _fingerprintString(ctx, "true");
6481
- }
6482
-
6483
6823
  if (true) {
6484
6824
  _fingerprintString(ctx, "kind");
6485
6825
  _fingerprintString(ctx, _enumToStringReindexObjectType(node->kind));
@@ -6490,13 +6830,22 @@ _fingerprintReindexStmt(FingerprintContext *ctx, const ReindexStmt *node, const
6490
6830
  _fingerprintString(ctx, node->name);
6491
6831
  }
6492
6832
 
6493
- if (node->options != 0) {
6494
- char buffer[50];
6495
- sprintf(buffer, "%d", node->options);
6496
- _fingerprintString(ctx, "options");
6497
- _fingerprintString(ctx, buffer);
6498
- }
6833
+ if (node->params != NULL && node->params->length > 0) {
6834
+ XXH3_state_t* prev = XXH3_createState();
6835
+ XXH64_hash_t hash;
6836
+
6837
+ XXH3_copyState(prev, ctx->xxh_state);
6838
+ _fingerprintString(ctx, "params");
6499
6839
 
6840
+ hash = XXH3_64bits_digest(ctx->xxh_state);
6841
+ _fingerprintNode(ctx, node->params, node, "params", depth + 1);
6842
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->params) == 1 && linitial(node->params) == NIL)) {
6843
+ XXH3_copyState(ctx->xxh_state, prev);
6844
+ if (ctx->write_tokens)
6845
+ dlist_delete(dlist_tail_node(&ctx->tokens));
6846
+ }
6847
+ XXH3_freeState(prev);
6848
+ }
6500
6849
  if (node->relation != NULL) {
6501
6850
  XXH3_state_t* prev = XXH3_createState();
6502
6851
  XXH64_hash_t hash;
@@ -6555,7 +6904,7 @@ _fingerprintCreateSchemaStmt(FingerprintContext *ctx, const CreateSchemaStmt *no
6555
6904
 
6556
6905
  hash = XXH3_64bits_digest(ctx->xxh_state);
6557
6906
  _fingerprintNode(ctx, node->schemaElts, node, "schemaElts", depth + 1);
6558
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6907
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->schemaElts) == 1 && linitial(node->schemaElts) == NIL)) {
6559
6908
  XXH3_copyState(ctx->xxh_state, prev);
6560
6909
  if (ctx->write_tokens)
6561
6910
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6586,7 +6935,7 @@ _fingerprintAlterDatabaseStmt(FingerprintContext *ctx, const AlterDatabaseStmt *
6586
6935
 
6587
6936
  hash = XXH3_64bits_digest(ctx->xxh_state);
6588
6937
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
6589
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
6938
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
6590
6939
  XXH3_copyState(ctx->xxh_state, prev);
6591
6940
  if (ctx->write_tokens)
6592
6941
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6595,6 +6944,16 @@ _fingerprintAlterDatabaseStmt(FingerprintContext *ctx, const AlterDatabaseStmt *
6595
6944
  }
6596
6945
  }
6597
6946
 
6947
+ static void
6948
+ _fingerprintAlterDatabaseRefreshCollStmt(FingerprintContext *ctx, const AlterDatabaseRefreshCollStmt *node, const void *parent, const char *field_name, unsigned int depth)
6949
+ {
6950
+ if (node->dbname != NULL) {
6951
+ _fingerprintString(ctx, "dbname");
6952
+ _fingerprintString(ctx, node->dbname);
6953
+ }
6954
+
6955
+ }
6956
+
6598
6957
  static void
6599
6958
  _fingerprintAlterDatabaseSetStmt(FingerprintContext *ctx, const AlterDatabaseSetStmt *node, const void *parent, const char *field_name, unsigned int depth)
6600
6959
  {
@@ -6678,7 +7037,7 @@ _fingerprintCreateConversionStmt(FingerprintContext *ctx, const CreateConversion
6678
7037
 
6679
7038
  hash = XXH3_64bits_digest(ctx->xxh_state);
6680
7039
  _fingerprintNode(ctx, node->conversion_name, node, "conversion_name", depth + 1);
6681
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7040
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->conversion_name) == 1 && linitial(node->conversion_name) == NIL)) {
6682
7041
  XXH3_copyState(ctx->xxh_state, prev);
6683
7042
  if (ctx->write_tokens)
6684
7043
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6704,7 +7063,7 @@ _fingerprintCreateConversionStmt(FingerprintContext *ctx, const CreateConversion
6704
7063
 
6705
7064
  hash = XXH3_64bits_digest(ctx->xxh_state);
6706
7065
  _fingerprintNode(ctx, node->func_name, node, "func_name", depth + 1);
6707
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7066
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->func_name) == 1 && linitial(node->func_name) == NIL)) {
6708
7067
  XXH3_copyState(ctx->xxh_state, prev);
6709
7068
  if (ctx->write_tokens)
6710
7069
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6823,7 +7182,7 @@ _fingerprintCreateOpClassStmt(FingerprintContext *ctx, const CreateOpClassStmt *
6823
7182
 
6824
7183
  hash = XXH3_64bits_digest(ctx->xxh_state);
6825
7184
  _fingerprintNode(ctx, node->items, node, "items", depth + 1);
6826
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7185
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->items) == 1 && linitial(node->items) == NIL)) {
6827
7186
  XXH3_copyState(ctx->xxh_state, prev);
6828
7187
  if (ctx->write_tokens)
6829
7188
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6839,7 +7198,7 @@ _fingerprintCreateOpClassStmt(FingerprintContext *ctx, const CreateOpClassStmt *
6839
7198
 
6840
7199
  hash = XXH3_64bits_digest(ctx->xxh_state);
6841
7200
  _fingerprintNode(ctx, node->opclassname, node, "opclassname", depth + 1);
6842
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7201
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->opclassname) == 1 && linitial(node->opclassname) == NIL)) {
6843
7202
  XXH3_copyState(ctx->xxh_state, prev);
6844
7203
  if (ctx->write_tokens)
6845
7204
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6855,7 +7214,7 @@ _fingerprintCreateOpClassStmt(FingerprintContext *ctx, const CreateOpClassStmt *
6855
7214
 
6856
7215
  hash = XXH3_64bits_digest(ctx->xxh_state);
6857
7216
  _fingerprintNode(ctx, node->opfamilyname, node, "opfamilyname", depth + 1);
6858
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7217
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->opfamilyname) == 1 && linitial(node->opfamilyname) == NIL)) {
6859
7218
  XXH3_copyState(ctx->xxh_state, prev);
6860
7219
  if (ctx->write_tokens)
6861
7220
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6881,7 +7240,7 @@ _fingerprintCreateOpFamilyStmt(FingerprintContext *ctx, const CreateOpFamilyStmt
6881
7240
 
6882
7241
  hash = XXH3_64bits_digest(ctx->xxh_state);
6883
7242
  _fingerprintNode(ctx, node->opfamilyname, node, "opfamilyname", depth + 1);
6884
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7243
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->opfamilyname) == 1 && linitial(node->opfamilyname) == NIL)) {
6885
7244
  XXH3_copyState(ctx->xxh_state, prev);
6886
7245
  if (ctx->write_tokens)
6887
7246
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6912,7 +7271,7 @@ _fingerprintAlterOpFamilyStmt(FingerprintContext *ctx, const AlterOpFamilyStmt *
6912
7271
 
6913
7272
  hash = XXH3_64bits_digest(ctx->xxh_state);
6914
7273
  _fingerprintNode(ctx, node->items, node, "items", depth + 1);
6915
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7274
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->items) == 1 && linitial(node->items) == NIL)) {
6916
7275
  XXH3_copyState(ctx->xxh_state, prev);
6917
7276
  if (ctx->write_tokens)
6918
7277
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6928,7 +7287,7 @@ _fingerprintAlterOpFamilyStmt(FingerprintContext *ctx, const AlterOpFamilyStmt *
6928
7287
 
6929
7288
  hash = XXH3_64bits_digest(ctx->xxh_state);
6930
7289
  _fingerprintNode(ctx, node->opfamilyname, node, "opfamilyname", depth + 1);
6931
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7290
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->opfamilyname) == 1 && linitial(node->opfamilyname) == NIL)) {
6932
7291
  XXH3_copyState(ctx->xxh_state, prev);
6933
7292
  if (ctx->write_tokens)
6934
7293
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6949,7 +7308,7 @@ _fingerprintPrepareStmt(FingerprintContext *ctx, const PrepareStmt *node, const
6949
7308
 
6950
7309
  hash = XXH3_64bits_digest(ctx->xxh_state);
6951
7310
  _fingerprintNode(ctx, node->argtypes, node, "argtypes", depth + 1);
6952
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7311
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->argtypes) == 1 && linitial(node->argtypes) == NIL)) {
6953
7312
  XXH3_copyState(ctx->xxh_state, prev);
6954
7313
  if (ctx->write_tokens)
6955
7314
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -6991,7 +7350,7 @@ _fingerprintExecuteStmt(FingerprintContext *ctx, const ExecuteStmt *node, const
6991
7350
 
6992
7351
  hash = XXH3_64bits_digest(ctx->xxh_state);
6993
7352
  _fingerprintNode(ctx, node->params, node, "params", depth + 1);
6994
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7353
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->params) == 1 && linitial(node->params) == NIL)) {
6995
7354
  XXH3_copyState(ctx->xxh_state, prev);
6996
7355
  if (ctx->write_tokens)
6997
7356
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7052,7 +7411,7 @@ _fingerprintCreateTableSpaceStmt(FingerprintContext *ctx, const CreateTableSpace
7052
7411
 
7053
7412
  hash = XXH3_64bits_digest(ctx->xxh_state);
7054
7413
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7055
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7414
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7056
7415
  XXH3_copyState(ctx->xxh_state, prev);
7057
7416
  if (ctx->write_tokens)
7058
7417
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7101,21 +7460,9 @@ _fingerprintDropTableSpaceStmt(FingerprintContext *ctx, const DropTableSpaceStmt
7101
7460
  static void
7102
7461
  _fingerprintAlterObjectDependsStmt(FingerprintContext *ctx, const AlterObjectDependsStmt *node, const void *parent, const char *field_name, unsigned int depth)
7103
7462
  {
7104
- if (node->extname != NULL) {
7105
- XXH3_state_t* prev = XXH3_createState();
7106
- XXH64_hash_t hash;
7107
-
7108
- XXH3_copyState(prev, ctx->xxh_state);
7463
+ if (strlen(node->extname->sval) > 0) {
7109
7464
  _fingerprintString(ctx, "extname");
7110
-
7111
- hash = XXH3_64bits_digest(ctx->xxh_state);
7112
- _fingerprintNode(ctx, node->extname, node, "extname", depth + 1);
7113
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7114
- XXH3_copyState(ctx->xxh_state, prev);
7115
- if (ctx->write_tokens)
7116
- dlist_delete(dlist_tail_node(&ctx->tokens));
7117
- }
7118
- XXH3_freeState(prev);
7465
+ _fingerprintString(ctx, node->extname->sval);
7119
7466
  }
7120
7467
 
7121
7468
  if (node->object != NULL) {
@@ -7308,7 +7655,7 @@ _fingerprintAlterOperatorStmt(FingerprintContext *ctx, const AlterOperatorStmt *
7308
7655
 
7309
7656
  hash = XXH3_64bits_digest(ctx->xxh_state);
7310
7657
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7311
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7658
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7312
7659
  XXH3_copyState(ctx->xxh_state, prev);
7313
7660
  if (ctx->write_tokens)
7314
7661
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7329,7 +7676,7 @@ _fingerprintAlterTypeStmt(FingerprintContext *ctx, const AlterTypeStmt *node, co
7329
7676
 
7330
7677
  hash = XXH3_64bits_digest(ctx->xxh_state);
7331
7678
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7332
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7679
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7333
7680
  XXH3_copyState(ctx->xxh_state, prev);
7334
7681
  if (ctx->write_tokens)
7335
7682
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7345,7 +7692,7 @@ _fingerprintAlterTypeStmt(FingerprintContext *ctx, const AlterTypeStmt *node, co
7345
7692
 
7346
7693
  hash = XXH3_64bits_digest(ctx->xxh_state);
7347
7694
  _fingerprintNode(ctx, node->typeName, node, "typeName", depth + 1);
7348
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7695
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->typeName) == 1 && linitial(node->typeName) == NIL)) {
7349
7696
  XXH3_copyState(ctx->xxh_state, prev);
7350
7697
  if (ctx->write_tokens)
7351
7698
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7371,7 +7718,7 @@ _fingerprintDropOwnedStmt(FingerprintContext *ctx, const DropOwnedStmt *node, co
7371
7718
 
7372
7719
  hash = XXH3_64bits_digest(ctx->xxh_state);
7373
7720
  _fingerprintNode(ctx, node->roles, node, "roles", depth + 1);
7374
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7721
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->roles) == 1 && linitial(node->roles) == NIL)) {
7375
7722
  XXH3_copyState(ctx->xxh_state, prev);
7376
7723
  if (ctx->write_tokens)
7377
7724
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7409,7 +7756,7 @@ _fingerprintReassignOwnedStmt(FingerprintContext *ctx, const ReassignOwnedStmt *
7409
7756
 
7410
7757
  hash = XXH3_64bits_digest(ctx->xxh_state);
7411
7758
  _fingerprintNode(ctx, node->roles, node, "roles", depth + 1);
7412
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7759
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->roles) == 1 && linitial(node->roles) == NIL)) {
7413
7760
  XXH3_copyState(ctx->xxh_state, prev);
7414
7761
  if (ctx->write_tokens)
7415
7762
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7430,7 +7777,7 @@ _fingerprintCompositeTypeStmt(FingerprintContext *ctx, const CompositeTypeStmt *
7430
7777
 
7431
7778
  hash = XXH3_64bits_digest(ctx->xxh_state);
7432
7779
  _fingerprintNode(ctx, node->coldeflist, node, "coldeflist", depth + 1);
7433
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7780
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->coldeflist) == 1 && linitial(node->coldeflist) == NIL)) {
7434
7781
  XXH3_copyState(ctx->xxh_state, prev);
7435
7782
  if (ctx->write_tokens)
7436
7783
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7468,7 +7815,7 @@ _fingerprintCreateEnumStmt(FingerprintContext *ctx, const CreateEnumStmt *node,
7468
7815
 
7469
7816
  hash = XXH3_64bits_digest(ctx->xxh_state);
7470
7817
  _fingerprintNode(ctx, node->typeName, node, "typeName", depth + 1);
7471
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7818
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->typeName) == 1 && linitial(node->typeName) == NIL)) {
7472
7819
  XXH3_copyState(ctx->xxh_state, prev);
7473
7820
  if (ctx->write_tokens)
7474
7821
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7484,7 +7831,7 @@ _fingerprintCreateEnumStmt(FingerprintContext *ctx, const CreateEnumStmt *node,
7484
7831
 
7485
7832
  hash = XXH3_64bits_digest(ctx->xxh_state);
7486
7833
  _fingerprintNode(ctx, node->vals, node, "vals", depth + 1);
7487
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7834
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->vals) == 1 && linitial(node->vals) == NIL)) {
7488
7835
  XXH3_copyState(ctx->xxh_state, prev);
7489
7836
  if (ctx->write_tokens)
7490
7837
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7505,7 +7852,7 @@ _fingerprintCreateRangeStmt(FingerprintContext *ctx, const CreateRangeStmt *node
7505
7852
 
7506
7853
  hash = XXH3_64bits_digest(ctx->xxh_state);
7507
7854
  _fingerprintNode(ctx, node->params, node, "params", depth + 1);
7508
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7855
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->params) == 1 && linitial(node->params) == NIL)) {
7509
7856
  XXH3_copyState(ctx->xxh_state, prev);
7510
7857
  if (ctx->write_tokens)
7511
7858
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7521,7 +7868,7 @@ _fingerprintCreateRangeStmt(FingerprintContext *ctx, const CreateRangeStmt *node
7521
7868
 
7522
7869
  hash = XXH3_64bits_digest(ctx->xxh_state);
7523
7870
  _fingerprintNode(ctx, node->typeName, node, "typeName", depth + 1);
7524
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7871
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->typeName) == 1 && linitial(node->typeName) == NIL)) {
7525
7872
  XXH3_copyState(ctx->xxh_state, prev);
7526
7873
  if (ctx->write_tokens)
7527
7874
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7567,7 +7914,7 @@ _fingerprintAlterEnumStmt(FingerprintContext *ctx, const AlterEnumStmt *node, co
7567
7914
 
7568
7915
  hash = XXH3_64bits_digest(ctx->xxh_state);
7569
7916
  _fingerprintNode(ctx, node->typeName, node, "typeName", depth + 1);
7570
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7917
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->typeName) == 1 && linitial(node->typeName) == NIL)) {
7571
7918
  XXH3_copyState(ctx->xxh_state, prev);
7572
7919
  if (ctx->write_tokens)
7573
7920
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7588,7 +7935,7 @@ _fingerprintAlterTSDictionaryStmt(FingerprintContext *ctx, const AlterTSDictiona
7588
7935
 
7589
7936
  hash = XXH3_64bits_digest(ctx->xxh_state);
7590
7937
  _fingerprintNode(ctx, node->dictname, node, "dictname", depth + 1);
7591
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7938
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->dictname) == 1 && linitial(node->dictname) == NIL)) {
7592
7939
  XXH3_copyState(ctx->xxh_state, prev);
7593
7940
  if (ctx->write_tokens)
7594
7941
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7604,7 +7951,7 @@ _fingerprintAlterTSDictionaryStmt(FingerprintContext *ctx, const AlterTSDictiona
7604
7951
 
7605
7952
  hash = XXH3_64bits_digest(ctx->xxh_state);
7606
7953
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7607
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7954
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7608
7955
  XXH3_copyState(ctx->xxh_state, prev);
7609
7956
  if (ctx->write_tokens)
7610
7957
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7625,7 +7972,7 @@ _fingerprintAlterTSConfigurationStmt(FingerprintContext *ctx, const AlterTSConfi
7625
7972
 
7626
7973
  hash = XXH3_64bits_digest(ctx->xxh_state);
7627
7974
  _fingerprintNode(ctx, node->cfgname, node, "cfgname", depth + 1);
7628
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7975
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->cfgname) == 1 && linitial(node->cfgname) == NIL)) {
7629
7976
  XXH3_copyState(ctx->xxh_state, prev);
7630
7977
  if (ctx->write_tokens)
7631
7978
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7641,7 +7988,7 @@ _fingerprintAlterTSConfigurationStmt(FingerprintContext *ctx, const AlterTSConfi
7641
7988
 
7642
7989
  hash = XXH3_64bits_digest(ctx->xxh_state);
7643
7990
  _fingerprintNode(ctx, node->dicts, node, "dicts", depth + 1);
7644
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
7991
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->dicts) == 1 && linitial(node->dicts) == NIL)) {
7645
7992
  XXH3_copyState(ctx->xxh_state, prev);
7646
7993
  if (ctx->write_tokens)
7647
7994
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7677,7 +8024,7 @@ _fingerprintAlterTSConfigurationStmt(FingerprintContext *ctx, const AlterTSConfi
7677
8024
 
7678
8025
  hash = XXH3_64bits_digest(ctx->xxh_state);
7679
8026
  _fingerprintNode(ctx, node->tokentype, node, "tokentype", depth + 1);
7680
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8027
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->tokentype) == 1 && linitial(node->tokentype) == NIL)) {
7681
8028
  XXH3_copyState(ctx->xxh_state, prev);
7682
8029
  if (ctx->write_tokens)
7683
8030
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7703,7 +8050,7 @@ _fingerprintCreateFdwStmt(FingerprintContext *ctx, const CreateFdwStmt *node, co
7703
8050
 
7704
8051
  hash = XXH3_64bits_digest(ctx->xxh_state);
7705
8052
  _fingerprintNode(ctx, node->func_options, node, "func_options", depth + 1);
7706
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8053
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->func_options) == 1 && linitial(node->func_options) == NIL)) {
7707
8054
  XXH3_copyState(ctx->xxh_state, prev);
7708
8055
  if (ctx->write_tokens)
7709
8056
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7719,7 +8066,7 @@ _fingerprintCreateFdwStmt(FingerprintContext *ctx, const CreateFdwStmt *node, co
7719
8066
 
7720
8067
  hash = XXH3_64bits_digest(ctx->xxh_state);
7721
8068
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7722
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8069
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7723
8070
  XXH3_copyState(ctx->xxh_state, prev);
7724
8071
  if (ctx->write_tokens)
7725
8072
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7745,7 +8092,7 @@ _fingerprintAlterFdwStmt(FingerprintContext *ctx, const AlterFdwStmt *node, cons
7745
8092
 
7746
8093
  hash = XXH3_64bits_digest(ctx->xxh_state);
7747
8094
  _fingerprintNode(ctx, node->func_options, node, "func_options", depth + 1);
7748
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8095
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->func_options) == 1 && linitial(node->func_options) == NIL)) {
7749
8096
  XXH3_copyState(ctx->xxh_state, prev);
7750
8097
  if (ctx->write_tokens)
7751
8098
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7761,7 +8108,7 @@ _fingerprintAlterFdwStmt(FingerprintContext *ctx, const AlterFdwStmt *node, cons
7761
8108
 
7762
8109
  hash = XXH3_64bits_digest(ctx->xxh_state);
7763
8110
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7764
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8111
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7765
8112
  XXH3_copyState(ctx->xxh_state, prev);
7766
8113
  if (ctx->write_tokens)
7767
8114
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7792,7 +8139,7 @@ _fingerprintCreateForeignServerStmt(FingerprintContext *ctx, const CreateForeign
7792
8139
 
7793
8140
  hash = XXH3_64bits_digest(ctx->xxh_state);
7794
8141
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7795
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8142
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7796
8143
  XXH3_copyState(ctx->xxh_state, prev);
7797
8144
  if (ctx->write_tokens)
7798
8145
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7833,7 +8180,7 @@ _fingerprintAlterForeignServerStmt(FingerprintContext *ctx, const AlterForeignSe
7833
8180
 
7834
8181
  hash = XXH3_64bits_digest(ctx->xxh_state);
7835
8182
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7836
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8183
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7837
8184
  XXH3_copyState(ctx->xxh_state, prev);
7838
8185
  if (ctx->write_tokens)
7839
8186
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7869,7 +8216,7 @@ _fingerprintCreateUserMappingStmt(FingerprintContext *ctx, const CreateUserMappi
7869
8216
 
7870
8217
  hash = XXH3_64bits_digest(ctx->xxh_state);
7871
8218
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7872
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8219
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7873
8220
  XXH3_copyState(ctx->xxh_state, prev);
7874
8221
  if (ctx->write_tokens)
7875
8222
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7912,7 +8259,7 @@ _fingerprintAlterUserMappingStmt(FingerprintContext *ctx, const AlterUserMapping
7912
8259
 
7913
8260
  hash = XXH3_64bits_digest(ctx->xxh_state);
7914
8261
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7915
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8262
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7916
8263
  XXH3_copyState(ctx->xxh_state, prev);
7917
8264
  if (ctx->write_tokens)
7918
8265
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -7992,7 +8339,7 @@ _fingerprintAlterTableSpaceOptionsStmt(FingerprintContext *ctx, const AlterTable
7992
8339
 
7993
8340
  hash = XXH3_64bits_digest(ctx->xxh_state);
7994
8341
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
7995
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8342
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
7996
8343
  XXH3_copyState(ctx->xxh_state, prev);
7997
8344
  if (ctx->write_tokens)
7998
8345
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8038,7 +8385,7 @@ _fingerprintAlterTableMoveAllStmt(FingerprintContext *ctx, const AlterTableMoveA
8038
8385
 
8039
8386
  hash = XXH3_64bits_digest(ctx->xxh_state);
8040
8387
  _fingerprintNode(ctx, node->roles, node, "roles", depth + 1);
8041
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8388
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->roles) == 1 && linitial(node->roles) == NIL)) {
8042
8389
  XXH3_copyState(ctx->xxh_state, prev);
8043
8390
  if (ctx->write_tokens)
8044
8391
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8098,7 +8445,7 @@ _fingerprintCreateForeignTableStmt(FingerprintContext *ctx, const CreateForeignT
8098
8445
 
8099
8446
  hash = XXH3_64bits_digest(ctx->xxh_state);
8100
8447
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
8101
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8448
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
8102
8449
  XXH3_copyState(ctx->xxh_state, prev);
8103
8450
  if (ctx->write_tokens)
8104
8451
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8134,7 +8481,7 @@ _fingerprintImportForeignSchemaStmt(FingerprintContext *ctx, const ImportForeign
8134
8481
 
8135
8482
  hash = XXH3_64bits_digest(ctx->xxh_state);
8136
8483
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
8137
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8484
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
8138
8485
  XXH3_copyState(ctx->xxh_state, prev);
8139
8486
  if (ctx->write_tokens)
8140
8487
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8160,7 +8507,7 @@ _fingerprintImportForeignSchemaStmt(FingerprintContext *ctx, const ImportForeign
8160
8507
 
8161
8508
  hash = XXH3_64bits_digest(ctx->xxh_state);
8162
8509
  _fingerprintNode(ctx, node->table_list, node, "table_list", depth + 1);
8163
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8510
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->table_list) == 1 && linitial(node->table_list) == NIL)) {
8164
8511
  XXH3_copyState(ctx->xxh_state, prev);
8165
8512
  if (ctx->write_tokens)
8166
8513
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8191,7 +8538,7 @@ _fingerprintCreateExtensionStmt(FingerprintContext *ctx, const CreateExtensionSt
8191
8538
 
8192
8539
  hash = XXH3_64bits_digest(ctx->xxh_state);
8193
8540
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
8194
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8541
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
8195
8542
  XXH3_copyState(ctx->xxh_state, prev);
8196
8543
  if (ctx->write_tokens)
8197
8544
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8217,7 +8564,7 @@ _fingerprintAlterExtensionStmt(FingerprintContext *ctx, const AlterExtensionStmt
8217
8564
 
8218
8565
  hash = XXH3_64bits_digest(ctx->xxh_state);
8219
8566
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
8220
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8567
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
8221
8568
  XXH3_copyState(ctx->xxh_state, prev);
8222
8569
  if (ctx->write_tokens)
8223
8570
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8282,7 +8629,7 @@ _fingerprintCreateEventTrigStmt(FingerprintContext *ctx, const CreateEventTrigSt
8282
8629
 
8283
8630
  hash = XXH3_64bits_digest(ctx->xxh_state);
8284
8631
  _fingerprintNode(ctx, node->funcname, node, "funcname", depth + 1);
8285
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8632
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->funcname) == 1 && linitial(node->funcname) == NIL)) {
8286
8633
  XXH3_copyState(ctx->xxh_state, prev);
8287
8634
  if (ctx->write_tokens)
8288
8635
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8303,7 +8650,7 @@ _fingerprintCreateEventTrigStmt(FingerprintContext *ctx, const CreateEventTrigSt
8303
8650
 
8304
8651
  hash = XXH3_64bits_digest(ctx->xxh_state);
8305
8652
  _fingerprintNode(ctx, node->whenclause, node, "whenclause", depth + 1);
8306
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8653
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->whenclause) == 1 && linitial(node->whenclause) == NIL)) {
8307
8654
  XXH3_copyState(ctx->xxh_state, prev);
8308
8655
  if (ctx->write_tokens)
8309
8656
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8442,7 +8789,7 @@ _fingerprintCreatePolicyStmt(FingerprintContext *ctx, const CreatePolicyStmt *no
8442
8789
 
8443
8790
  hash = XXH3_64bits_digest(ctx->xxh_state);
8444
8791
  _fingerprintNode(ctx, node->roles, node, "roles", depth + 1);
8445
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8792
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->roles) == 1 && linitial(node->roles) == NIL)) {
8446
8793
  XXH3_copyState(ctx->xxh_state, prev);
8447
8794
  if (ctx->write_tokens)
8448
8795
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8519,7 +8866,7 @@ _fingerprintAlterPolicyStmt(FingerprintContext *ctx, const AlterPolicyStmt *node
8519
8866
 
8520
8867
  hash = XXH3_64bits_digest(ctx->xxh_state);
8521
8868
  _fingerprintNode(ctx, node->roles, node, "roles", depth + 1);
8522
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
8869
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->roles) == 1 && linitial(node->roles) == NIL)) {
8523
8870
  XXH3_copyState(ctx->xxh_state, prev);
8524
8871
  if (ctx->write_tokens)
8525
8872
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8651,7 +8998,7 @@ _fingerprintCreateAmStmt(FingerprintContext *ctx, const CreateAmStmt *node, cons
8651
8998
 
8652
8999
  hash = XXH3_64bits_digest(ctx->xxh_state);
8653
9000
  _fingerprintNode(ctx, node->handler_name, node, "handler_name", depth + 1);
8654
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9001
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->handler_name) == 1 && linitial(node->handler_name) == NIL)) {
8655
9002
  XXH3_copyState(ctx->xxh_state, prev);
8656
9003
  if (ctx->write_tokens)
8657
9004
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8677,7 +9024,7 @@ _fingerprintCreatePublicationStmt(FingerprintContext *ctx, const CreatePublicati
8677
9024
 
8678
9025
  hash = XXH3_64bits_digest(ctx->xxh_state);
8679
9026
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
8680
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9027
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
8681
9028
  XXH3_copyState(ctx->xxh_state, prev);
8682
9029
  if (ctx->write_tokens)
8683
9030
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8689,16 +9036,16 @@ _fingerprintCreatePublicationStmt(FingerprintContext *ctx, const CreatePublicati
8689
9036
  _fingerprintString(ctx, node->pubname);
8690
9037
  }
8691
9038
 
8692
- if (node->tables != NULL && node->tables->length > 0) {
9039
+ if (node->pubobjects != NULL && node->pubobjects->length > 0) {
8693
9040
  XXH3_state_t* prev = XXH3_createState();
8694
9041
  XXH64_hash_t hash;
8695
9042
 
8696
9043
  XXH3_copyState(prev, ctx->xxh_state);
8697
- _fingerprintString(ctx, "tables");
9044
+ _fingerprintString(ctx, "pubobjects");
8698
9045
 
8699
9046
  hash = XXH3_64bits_digest(ctx->xxh_state);
8700
- _fingerprintNode(ctx, node->tables, node, "tables", depth + 1);
8701
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9047
+ _fingerprintNode(ctx, node->pubobjects, node, "pubobjects", depth + 1);
9048
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->pubobjects) == 1 && linitial(node->pubobjects) == NIL)) {
8702
9049
  XXH3_copyState(ctx->xxh_state, prev);
8703
9050
  if (ctx->write_tokens)
8704
9051
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8710,6 +9057,11 @@ _fingerprintCreatePublicationStmt(FingerprintContext *ctx, const CreatePublicati
8710
9057
  static void
8711
9058
  _fingerprintAlterPublicationStmt(FingerprintContext *ctx, const AlterPublicationStmt *node, const void *parent, const char *field_name, unsigned int depth)
8712
9059
  {
9060
+ if (true) {
9061
+ _fingerprintString(ctx, "action");
9062
+ _fingerprintString(ctx, _enumToStringAlterPublicationAction(node->action));
9063
+ }
9064
+
8713
9065
  if (node->for_all_tables) {
8714
9066
  _fingerprintString(ctx, "for_all_tables");
8715
9067
  _fingerprintString(ctx, "true");
@@ -8724,7 +9076,7 @@ _fingerprintAlterPublicationStmt(FingerprintContext *ctx, const AlterPublication
8724
9076
 
8725
9077
  hash = XXH3_64bits_digest(ctx->xxh_state);
8726
9078
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
8727
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9079
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
8728
9080
  XXH3_copyState(ctx->xxh_state, prev);
8729
9081
  if (ctx->write_tokens)
8730
9082
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8736,21 +9088,16 @@ _fingerprintAlterPublicationStmt(FingerprintContext *ctx, const AlterPublication
8736
9088
  _fingerprintString(ctx, node->pubname);
8737
9089
  }
8738
9090
 
8739
- if (true) {
8740
- _fingerprintString(ctx, "tableAction");
8741
- _fingerprintString(ctx, _enumToStringDefElemAction(node->tableAction));
8742
- }
8743
-
8744
- if (node->tables != NULL && node->tables->length > 0) {
9091
+ if (node->pubobjects != NULL && node->pubobjects->length > 0) {
8745
9092
  XXH3_state_t* prev = XXH3_createState();
8746
9093
  XXH64_hash_t hash;
8747
9094
 
8748
9095
  XXH3_copyState(prev, ctx->xxh_state);
8749
- _fingerprintString(ctx, "tables");
9096
+ _fingerprintString(ctx, "pubobjects");
8750
9097
 
8751
9098
  hash = XXH3_64bits_digest(ctx->xxh_state);
8752
- _fingerprintNode(ctx, node->tables, node, "tables", depth + 1);
8753
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9099
+ _fingerprintNode(ctx, node->pubobjects, node, "pubobjects", depth + 1);
9100
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->pubobjects) == 1 && linitial(node->pubobjects) == NIL)) {
8754
9101
  XXH3_copyState(ctx->xxh_state, prev);
8755
9102
  if (ctx->write_tokens)
8756
9103
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8776,7 +9123,7 @@ _fingerprintCreateSubscriptionStmt(FingerprintContext *ctx, const CreateSubscrip
8776
9123
 
8777
9124
  hash = XXH3_64bits_digest(ctx->xxh_state);
8778
9125
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
8779
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9126
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
8780
9127
  XXH3_copyState(ctx->xxh_state, prev);
8781
9128
  if (ctx->write_tokens)
8782
9129
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8792,7 +9139,7 @@ _fingerprintCreateSubscriptionStmt(FingerprintContext *ctx, const CreateSubscrip
8792
9139
 
8793
9140
  hash = XXH3_64bits_digest(ctx->xxh_state);
8794
9141
  _fingerprintNode(ctx, node->publication, node, "publication", depth + 1);
8795
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9142
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->publication) == 1 && linitial(node->publication) == NIL)) {
8796
9143
  XXH3_copyState(ctx->xxh_state, prev);
8797
9144
  if (ctx->write_tokens)
8798
9145
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8828,7 +9175,7 @@ _fingerprintAlterSubscriptionStmt(FingerprintContext *ctx, const AlterSubscripti
8828
9175
 
8829
9176
  hash = XXH3_64bits_digest(ctx->xxh_state);
8830
9177
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
8831
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9178
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
8832
9179
  XXH3_copyState(ctx->xxh_state, prev);
8833
9180
  if (ctx->write_tokens)
8834
9181
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8844,7 +9191,7 @@ _fingerprintAlterSubscriptionStmt(FingerprintContext *ctx, const AlterSubscripti
8844
9191
 
8845
9192
  hash = XXH3_64bits_digest(ctx->xxh_state);
8846
9193
  _fingerprintNode(ctx, node->publication, node, "publication", depth + 1);
8847
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9194
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->publication) == 1 && linitial(node->publication) == NIL)) {
8848
9195
  XXH3_copyState(ctx->xxh_state, prev);
8849
9196
  if (ctx->write_tokens)
8850
9197
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8890,7 +9237,7 @@ _fingerprintCreateStatsStmt(FingerprintContext *ctx, const CreateStatsStmt *node
8890
9237
 
8891
9238
  hash = XXH3_64bits_digest(ctx->xxh_state);
8892
9239
  _fingerprintNode(ctx, node->defnames, node, "defnames", depth + 1);
8893
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9240
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->defnames) == 1 && linitial(node->defnames) == NIL)) {
8894
9241
  XXH3_copyState(ctx->xxh_state, prev);
8895
9242
  if (ctx->write_tokens)
8896
9243
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8906,7 +9253,7 @@ _fingerprintCreateStatsStmt(FingerprintContext *ctx, const CreateStatsStmt *node
8906
9253
 
8907
9254
  hash = XXH3_64bits_digest(ctx->xxh_state);
8908
9255
  _fingerprintNode(ctx, node->exprs, node, "exprs", depth + 1);
8909
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9256
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->exprs) == 1 && linitial(node->exprs) == NIL)) {
8910
9257
  XXH3_copyState(ctx->xxh_state, prev);
8911
9258
  if (ctx->write_tokens)
8912
9259
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8927,7 +9274,7 @@ _fingerprintCreateStatsStmt(FingerprintContext *ctx, const CreateStatsStmt *node
8927
9274
 
8928
9275
  hash = XXH3_64bits_digest(ctx->xxh_state);
8929
9276
  _fingerprintNode(ctx, node->relations, node, "relations", depth + 1);
8930
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9277
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->relations) == 1 && linitial(node->relations) == NIL)) {
8931
9278
  XXH3_copyState(ctx->xxh_state, prev);
8932
9279
  if (ctx->write_tokens)
8933
9280
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8943,7 +9290,7 @@ _fingerprintCreateStatsStmt(FingerprintContext *ctx, const CreateStatsStmt *node
8943
9290
 
8944
9291
  hash = XXH3_64bits_digest(ctx->xxh_state);
8945
9292
  _fingerprintNode(ctx, node->stat_types, node, "stat_types", depth + 1);
8946
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9293
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->stat_types) == 1 && linitial(node->stat_types) == NIL)) {
8947
9294
  XXH3_copyState(ctx->xxh_state, prev);
8948
9295
  if (ctx->write_tokens)
8949
9296
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -8955,6 +9302,11 @@ _fingerprintCreateStatsStmt(FingerprintContext *ctx, const CreateStatsStmt *node
8955
9302
  _fingerprintString(ctx, node->stxcomment);
8956
9303
  }
8957
9304
 
9305
+ if (node->transformed) {
9306
+ _fingerprintString(ctx, "transformed");
9307
+ _fingerprintString(ctx, "true");
9308
+ }
9309
+
8958
9310
  }
8959
9311
 
8960
9312
  static void
@@ -8969,7 +9321,7 @@ _fingerprintAlterCollationStmt(FingerprintContext *ctx, const AlterCollationStmt
8969
9321
 
8970
9322
  hash = XXH3_64bits_digest(ctx->xxh_state);
8971
9323
  _fingerprintNode(ctx, node->collname, node, "collname", depth + 1);
8972
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9324
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->collname) == 1 && linitial(node->collname) == NIL)) {
8973
9325
  XXH3_copyState(ctx->xxh_state, prev);
8974
9326
  if (ctx->write_tokens)
8975
9327
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9015,6 +9367,22 @@ _fingerprintCallStmt(FingerprintContext *ctx, const CallStmt *node, const void *
9015
9367
  XXH3_freeState(prev);
9016
9368
  }
9017
9369
 
9370
+ if (node->outargs != NULL && node->outargs->length > 0) {
9371
+ XXH3_state_t* prev = XXH3_createState();
9372
+ XXH64_hash_t hash;
9373
+
9374
+ XXH3_copyState(prev, ctx->xxh_state);
9375
+ _fingerprintString(ctx, "outargs");
9376
+
9377
+ hash = XXH3_64bits_digest(ctx->xxh_state);
9378
+ _fingerprintNode(ctx, node->outargs, node, "outargs", depth + 1);
9379
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->outargs) == 1 && linitial(node->outargs) == NIL)) {
9380
+ XXH3_copyState(ctx->xxh_state, prev);
9381
+ if (ctx->write_tokens)
9382
+ dlist_delete(dlist_tail_node(&ctx->tokens));
9383
+ }
9384
+ XXH3_freeState(prev);
9385
+ }
9018
9386
  }
9019
9387
 
9020
9388
  static void
@@ -9029,7 +9397,7 @@ _fingerprintAlterStatsStmt(FingerprintContext *ctx, const AlterStatsStmt *node,
9029
9397
 
9030
9398
  hash = XXH3_64bits_digest(ctx->xxh_state);
9031
9399
  _fingerprintNode(ctx, node->defnames, node, "defnames", depth + 1);
9032
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9400
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->defnames) == 1 && linitial(node->defnames) == NIL)) {
9033
9401
  XXH3_copyState(ctx->xxh_state, prev);
9034
9402
  if (ctx->write_tokens)
9035
9403
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9089,7 +9457,7 @@ _fingerprintA_Expr(FingerprintContext *ctx, const A_Expr *node, const void *pare
9089
9457
 
9090
9458
  hash = XXH3_64bits_digest(ctx->xxh_state);
9091
9459
  _fingerprintNode(ctx, node->name, node, "name", depth + 1);
9092
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9460
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->name) == 1 && linitial(node->name) == NIL)) {
9093
9461
  XXH3_copyState(ctx->xxh_state, prev);
9094
9462
  if (ctx->write_tokens)
9095
9463
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9127,7 +9495,7 @@ _fingerprintColumnRef(FingerprintContext *ctx, const ColumnRef *node, const void
9127
9495
 
9128
9496
  hash = XXH3_64bits_digest(ctx->xxh_state);
9129
9497
  _fingerprintNode(ctx, node->fields, node, "fields", depth + 1);
9130
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9498
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->fields) == 1 && linitial(node->fields) == NIL)) {
9131
9499
  XXH3_copyState(ctx->xxh_state, prev);
9132
9500
  if (ctx->write_tokens)
9133
9501
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9144,12 +9512,6 @@ _fingerprintParamRef(FingerprintContext *ctx, const ParamRef *node, const void *
9144
9512
  // Intentionally ignoring all fields for fingerprinting
9145
9513
  }
9146
9514
 
9147
- static void
9148
- _fingerprintA_Const(FingerprintContext *ctx, const A_Const *node, const void *parent, const char *field_name, unsigned int depth)
9149
- {
9150
- // Intentionally ignoring all fields for fingerprinting
9151
- }
9152
-
9153
9515
  static void
9154
9516
  _fingerprintFuncCall(FingerprintContext *ctx, const FuncCall *node, const void *parent, const char *field_name, unsigned int depth)
9155
9517
  {
@@ -9184,7 +9546,7 @@ _fingerprintFuncCall(FingerprintContext *ctx, const FuncCall *node, const void *
9184
9546
 
9185
9547
  hash = XXH3_64bits_digest(ctx->xxh_state);
9186
9548
  _fingerprintNode(ctx, node->agg_order, node, "agg_order", depth + 1);
9187
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9549
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->agg_order) == 1 && linitial(node->agg_order) == NIL)) {
9188
9550
  XXH3_copyState(ctx->xxh_state, prev);
9189
9551
  if (ctx->write_tokens)
9190
9552
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9210,7 +9572,7 @@ _fingerprintFuncCall(FingerprintContext *ctx, const FuncCall *node, const void *
9210
9572
 
9211
9573
  hash = XXH3_64bits_digest(ctx->xxh_state);
9212
9574
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
9213
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9575
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
9214
9576
  XXH3_copyState(ctx->xxh_state, prev);
9215
9577
  if (ctx->write_tokens)
9216
9578
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9222,6 +9584,11 @@ _fingerprintFuncCall(FingerprintContext *ctx, const FuncCall *node, const void *
9222
9584
  _fingerprintString(ctx, "true");
9223
9585
  }
9224
9586
 
9587
+ if (true) {
9588
+ _fingerprintString(ctx, "funcformat");
9589
+ _fingerprintString(ctx, _enumToStringCoercionForm(node->funcformat));
9590
+ }
9591
+
9225
9592
  if (node->funcname != NULL && node->funcname->length > 0) {
9226
9593
  XXH3_state_t* prev = XXH3_createState();
9227
9594
  XXH64_hash_t hash;
@@ -9231,7 +9598,7 @@ _fingerprintFuncCall(FingerprintContext *ctx, const FuncCall *node, const void *
9231
9598
 
9232
9599
  hash = XXH3_64bits_digest(ctx->xxh_state);
9233
9600
  _fingerprintNode(ctx, node->funcname, node, "funcname", depth + 1);
9234
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9601
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->funcname) == 1 && linitial(node->funcname) == NIL)) {
9235
9602
  XXH3_copyState(ctx->xxh_state, prev);
9236
9603
  if (ctx->write_tokens)
9237
9604
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9337,7 +9704,7 @@ _fingerprintA_Indirection(FingerprintContext *ctx, const A_Indirection *node, co
9337
9704
 
9338
9705
  hash = XXH3_64bits_digest(ctx->xxh_state);
9339
9706
  _fingerprintNode(ctx, node->indirection, node, "indirection", depth + 1);
9340
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9707
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->indirection) == 1 && linitial(node->indirection) == NIL)) {
9341
9708
  XXH3_copyState(ctx->xxh_state, prev);
9342
9709
  if (ctx->write_tokens)
9343
9710
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9358,7 +9725,7 @@ _fingerprintA_ArrayExpr(FingerprintContext *ctx, const A_ArrayExpr *node, const
9358
9725
 
9359
9726
  hash = XXH3_64bits_digest(ctx->xxh_state);
9360
9727
  _fingerprintNode(ctx, node->elements, node, "elements", depth + 1);
9361
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9728
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->elements) == 1 && linitial(node->elements) == NIL)) {
9362
9729
  XXH3_copyState(ctx->xxh_state, prev);
9363
9730
  if (ctx->write_tokens)
9364
9731
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9381,7 +9748,7 @@ _fingerprintResTarget(FingerprintContext *ctx, const ResTarget *node, const void
9381
9748
 
9382
9749
  hash = XXH3_64bits_digest(ctx->xxh_state);
9383
9750
  _fingerprintNode(ctx, node->indirection, node, "indirection", depth + 1);
9384
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9751
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->indirection) == 1 && linitial(node->indirection) == NIL)) {
9385
9752
  XXH3_copyState(ctx->xxh_state, prev);
9386
9753
  if (ctx->write_tokens)
9387
9754
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9520,7 +9887,7 @@ _fingerprintCollateClause(FingerprintContext *ctx, const CollateClause *node, co
9520
9887
 
9521
9888
  hash = XXH3_64bits_digest(ctx->xxh_state);
9522
9889
  _fingerprintNode(ctx, node->collname, node, "collname", depth + 1);
9523
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9890
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->collname) == 1 && linitial(node->collname) == NIL)) {
9524
9891
  XXH3_copyState(ctx->xxh_state, prev);
9525
9892
  if (ctx->write_tokens)
9526
9893
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9572,7 +9939,7 @@ _fingerprintSortBy(FingerprintContext *ctx, const SortBy *node, const void *pare
9572
9939
 
9573
9940
  hash = XXH3_64bits_digest(ctx->xxh_state);
9574
9941
  _fingerprintNode(ctx, node->useOp, node, "useOp", depth + 1);
9575
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9942
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->useOp) == 1 && linitial(node->useOp) == NIL)) {
9576
9943
  XXH3_copyState(ctx->xxh_state, prev);
9577
9944
  if (ctx->write_tokens)
9578
9945
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9624,7 +9991,7 @@ _fingerprintWindowDef(FingerprintContext *ctx, const WindowDef *node, const void
9624
9991
 
9625
9992
  hash = XXH3_64bits_digest(ctx->xxh_state);
9626
9993
  _fingerprintNode(ctx, node->orderClause, node, "orderClause", depth + 1);
9627
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
9994
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->orderClause) == 1 && linitial(node->orderClause) == NIL)) {
9628
9995
  XXH3_copyState(ctx->xxh_state, prev);
9629
9996
  if (ctx->write_tokens)
9630
9997
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9640,7 +10007,7 @@ _fingerprintWindowDef(FingerprintContext *ctx, const WindowDef *node, const void
9640
10007
 
9641
10008
  hash = XXH3_64bits_digest(ctx->xxh_state);
9642
10009
  _fingerprintNode(ctx, node->partitionClause, node, "partitionClause", depth + 1);
9643
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10010
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->partitionClause) == 1 && linitial(node->partitionClause) == NIL)) {
9644
10011
  XXH3_copyState(ctx->xxh_state, prev);
9645
10012
  if (ctx->write_tokens)
9646
10013
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9744,7 +10111,7 @@ _fingerprintRangeFunction(FingerprintContext *ctx, const RangeFunction *node, co
9744
10111
 
9745
10112
  hash = XXH3_64bits_digest(ctx->xxh_state);
9746
10113
  _fingerprintNode(ctx, node->coldeflist, node, "coldeflist", depth + 1);
9747
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10114
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->coldeflist) == 1 && linitial(node->coldeflist) == NIL)) {
9748
10115
  XXH3_copyState(ctx->xxh_state, prev);
9749
10116
  if (ctx->write_tokens)
9750
10117
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9760,7 +10127,7 @@ _fingerprintRangeFunction(FingerprintContext *ctx, const RangeFunction *node, co
9760
10127
 
9761
10128
  hash = XXH3_64bits_digest(ctx->xxh_state);
9762
10129
  _fingerprintNode(ctx, node->functions, node, "functions", depth + 1);
9763
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10130
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->functions) == 1 && linitial(node->functions) == NIL)) {
9764
10131
  XXH3_copyState(ctx->xxh_state, prev);
9765
10132
  if (ctx->write_tokens)
9766
10133
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9796,7 +10163,7 @@ _fingerprintRangeTableSample(FingerprintContext *ctx, const RangeTableSample *no
9796
10163
 
9797
10164
  hash = XXH3_64bits_digest(ctx->xxh_state);
9798
10165
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
9799
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10166
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
9800
10167
  XXH3_copyState(ctx->xxh_state, prev);
9801
10168
  if (ctx->write_tokens)
9802
10169
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9814,7 +10181,7 @@ _fingerprintRangeTableSample(FingerprintContext *ctx, const RangeTableSample *no
9814
10181
 
9815
10182
  hash = XXH3_64bits_digest(ctx->xxh_state);
9816
10183
  _fingerprintNode(ctx, node->method, node, "method", depth + 1);
9817
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10184
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->method) == 1 && linitial(node->method) == NIL)) {
9818
10185
  XXH3_copyState(ctx->xxh_state, prev);
9819
10186
  if (ctx->write_tokens)
9820
10187
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9886,7 +10253,7 @@ _fingerprintRangeTableFunc(FingerprintContext *ctx, const RangeTableFunc *node,
9886
10253
 
9887
10254
  hash = XXH3_64bits_digest(ctx->xxh_state);
9888
10255
  _fingerprintNode(ctx, node->columns, node, "columns", depth + 1);
9889
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10256
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->columns) == 1 && linitial(node->columns) == NIL)) {
9890
10257
  XXH3_copyState(ctx->xxh_state, prev);
9891
10258
  if (ctx->write_tokens)
9892
10259
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -9926,7 +10293,7 @@ _fingerprintRangeTableFunc(FingerprintContext *ctx, const RangeTableFunc *node,
9926
10293
 
9927
10294
  hash = XXH3_64bits_digest(ctx->xxh_state);
9928
10295
  _fingerprintNode(ctx, node->namespaces, node, "namespaces", depth + 1);
9929
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10296
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->namespaces) == 1 && linitial(node->namespaces) == NIL)) {
9930
10297
  XXH3_copyState(ctx->xxh_state, prev);
9931
10298
  if (ctx->write_tokens)
9932
10299
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10037,7 +10404,7 @@ _fingerprintTypeName(FingerprintContext *ctx, const TypeName *node, const void *
10037
10404
 
10038
10405
  hash = XXH3_64bits_digest(ctx->xxh_state);
10039
10406
  _fingerprintNode(ctx, node->arrayBounds, node, "arrayBounds", depth + 1);
10040
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10407
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->arrayBounds) == 1 && linitial(node->arrayBounds) == NIL)) {
10041
10408
  XXH3_copyState(ctx->xxh_state, prev);
10042
10409
  if (ctx->write_tokens)
10043
10410
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10055,7 +10422,7 @@ _fingerprintTypeName(FingerprintContext *ctx, const TypeName *node, const void *
10055
10422
 
10056
10423
  hash = XXH3_64bits_digest(ctx->xxh_state);
10057
10424
  _fingerprintNode(ctx, node->names, node, "names", depth + 1);
10058
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10425
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->names) == 1 && linitial(node->names) == NIL)) {
10059
10426
  XXH3_copyState(ctx->xxh_state, prev);
10060
10427
  if (ctx->write_tokens)
10061
10428
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10095,7 +10462,7 @@ _fingerprintTypeName(FingerprintContext *ctx, const TypeName *node, const void *
10095
10462
 
10096
10463
  hash = XXH3_64bits_digest(ctx->xxh_state);
10097
10464
  _fingerprintNode(ctx, node->typmods, node, "typmods", depth + 1);
10098
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10465
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->typmods) == 1 && linitial(node->typmods) == NIL)) {
10099
10466
  XXH3_copyState(ctx->xxh_state, prev);
10100
10467
  if (ctx->write_tokens)
10101
10468
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10136,6 +10503,11 @@ _fingerprintColumnDef(FingerprintContext *ctx, const ColumnDef *node, const void
10136
10503
  _fingerprintString(ctx, node->colname);
10137
10504
  }
10138
10505
 
10506
+ if (node->compression != NULL) {
10507
+ _fingerprintString(ctx, "compression");
10508
+ _fingerprintString(ctx, node->compression);
10509
+ }
10510
+
10139
10511
  if (node->constraints != NULL && node->constraints->length > 0) {
10140
10512
  XXH3_state_t* prev = XXH3_createState();
10141
10513
  XXH64_hash_t hash;
@@ -10145,7 +10517,7 @@ _fingerprintColumnDef(FingerprintContext *ctx, const ColumnDef *node, const void
10145
10517
 
10146
10518
  hash = XXH3_64bits_digest(ctx->xxh_state);
10147
10519
  _fingerprintNode(ctx, node->constraints, node, "constraints", depth + 1);
10148
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10520
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->constraints) == 1 && linitial(node->constraints) == NIL)) {
10149
10521
  XXH3_copyState(ctx->xxh_state, prev);
10150
10522
  if (ctx->write_tokens)
10151
10523
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10178,7 +10550,7 @@ _fingerprintColumnDef(FingerprintContext *ctx, const ColumnDef *node, const void
10178
10550
 
10179
10551
  hash = XXH3_64bits_digest(ctx->xxh_state);
10180
10552
  _fingerprintNode(ctx, node->fdwoptions, node, "fdwoptions", depth + 1);
10181
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10553
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->fdwoptions) == 1 && linitial(node->fdwoptions) == NIL)) {
10182
10554
  XXH3_copyState(ctx->xxh_state, prev);
10183
10555
  if (ctx->write_tokens)
10184
10556
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10292,7 +10664,7 @@ _fingerprintIndexElem(FingerprintContext *ctx, const IndexElem *node, const void
10292
10664
 
10293
10665
  hash = XXH3_64bits_digest(ctx->xxh_state);
10294
10666
  _fingerprintNode(ctx, node->collation, node, "collation", depth + 1);
10295
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10667
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->collation) == 1 && linitial(node->collation) == NIL)) {
10296
10668
  XXH3_copyState(ctx->xxh_state, prev);
10297
10669
  if (ctx->write_tokens)
10298
10670
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10340,7 +10712,7 @@ _fingerprintIndexElem(FingerprintContext *ctx, const IndexElem *node, const void
10340
10712
 
10341
10713
  hash = XXH3_64bits_digest(ctx->xxh_state);
10342
10714
  _fingerprintNode(ctx, node->opclass, node, "opclass", depth + 1);
10343
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10715
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->opclass) == 1 && linitial(node->opclass) == NIL)) {
10344
10716
  XXH3_copyState(ctx->xxh_state, prev);
10345
10717
  if (ctx->write_tokens)
10346
10718
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10356,7 +10728,7 @@ _fingerprintIndexElem(FingerprintContext *ctx, const IndexElem *node, const void
10356
10728
 
10357
10729
  hash = XXH3_64bits_digest(ctx->xxh_state);
10358
10730
  _fingerprintNode(ctx, node->opclassopts, node, "opclassopts", depth + 1);
10359
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10731
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->opclassopts) == 1 && linitial(node->opclassopts) == NIL)) {
10360
10732
  XXH3_copyState(ctx->xxh_state, prev);
10361
10733
  if (ctx->write_tokens)
10362
10734
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10371,12 +10743,39 @@ _fingerprintIndexElem(FingerprintContext *ctx, const IndexElem *node, const void
10371
10743
  }
10372
10744
 
10373
10745
  static void
10374
- _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const void *parent, const char *field_name, unsigned int depth)
10746
+ _fingerprintStatsElem(FingerprintContext *ctx, const StatsElem *node, const void *parent, const char *field_name, unsigned int depth)
10375
10747
  {
10376
- if (node->access_method != NULL) {
10377
- _fingerprintString(ctx, "access_method");
10378
- _fingerprintString(ctx, node->access_method);
10379
- }
10748
+ if (node->expr != NULL) {
10749
+ XXH3_state_t* prev = XXH3_createState();
10750
+ XXH64_hash_t hash;
10751
+
10752
+ XXH3_copyState(prev, ctx->xxh_state);
10753
+ _fingerprintString(ctx, "expr");
10754
+
10755
+ hash = XXH3_64bits_digest(ctx->xxh_state);
10756
+ _fingerprintNode(ctx, node->expr, node, "expr", depth + 1);
10757
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10758
+ XXH3_copyState(ctx->xxh_state, prev);
10759
+ if (ctx->write_tokens)
10760
+ dlist_delete(dlist_tail_node(&ctx->tokens));
10761
+ }
10762
+ XXH3_freeState(prev);
10763
+ }
10764
+
10765
+ if (node->name != NULL) {
10766
+ _fingerprintString(ctx, "name");
10767
+ _fingerprintString(ctx, node->name);
10768
+ }
10769
+
10770
+ }
10771
+
10772
+ static void
10773
+ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const void *parent, const char *field_name, unsigned int depth)
10774
+ {
10775
+ if (node->access_method != NULL) {
10776
+ _fingerprintString(ctx, "access_method");
10777
+ _fingerprintString(ctx, node->access_method);
10778
+ }
10380
10779
 
10381
10780
  if (node->conname != NULL) {
10382
10781
  _fingerprintString(ctx, "conname");
@@ -10407,7 +10806,7 @@ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const vo
10407
10806
 
10408
10807
  hash = XXH3_64bits_digest(ctx->xxh_state);
10409
10808
  _fingerprintNode(ctx, node->exclusions, node, "exclusions", depth + 1);
10410
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10809
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->exclusions) == 1 && linitial(node->exclusions) == NIL)) {
10411
10810
  XXH3_copyState(ctx->xxh_state, prev);
10412
10811
  if (ctx->write_tokens)
10413
10812
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10423,7 +10822,7 @@ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const vo
10423
10822
 
10424
10823
  hash = XXH3_64bits_digest(ctx->xxh_state);
10425
10824
  _fingerprintNode(ctx, node->fk_attrs, node, "fk_attrs", depth + 1);
10426
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10825
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->fk_attrs) == 1 && linitial(node->fk_attrs) == NIL)) {
10427
10826
  XXH3_copyState(ctx->xxh_state, prev);
10428
10827
  if (ctx->write_tokens)
10429
10828
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10436,6 +10835,22 @@ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const vo
10436
10835
  _fingerprintString(ctx, buffer);
10437
10836
  }
10438
10837
 
10838
+ if (node->fk_del_set_cols != NULL && node->fk_del_set_cols->length > 0) {
10839
+ XXH3_state_t* prev = XXH3_createState();
10840
+ XXH64_hash_t hash;
10841
+
10842
+ XXH3_copyState(prev, ctx->xxh_state);
10843
+ _fingerprintString(ctx, "fk_del_set_cols");
10844
+
10845
+ hash = XXH3_64bits_digest(ctx->xxh_state);
10846
+ _fingerprintNode(ctx, node->fk_del_set_cols, node, "fk_del_set_cols", depth + 1);
10847
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->fk_del_set_cols) == 1 && linitial(node->fk_del_set_cols) == NIL)) {
10848
+ XXH3_copyState(ctx->xxh_state, prev);
10849
+ if (ctx->write_tokens)
10850
+ dlist_delete(dlist_tail_node(&ctx->tokens));
10851
+ }
10852
+ XXH3_freeState(prev);
10853
+ }
10439
10854
  if (node->fk_matchtype != 0) {
10440
10855
  char buffer[2] = {node->fk_matchtype, '\0'};
10441
10856
  _fingerprintString(ctx, "fk_matchtype");
@@ -10463,7 +10878,7 @@ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const vo
10463
10878
 
10464
10879
  hash = XXH3_64bits_digest(ctx->xxh_state);
10465
10880
  _fingerprintNode(ctx, node->including, node, "including", depth + 1);
10466
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10881
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->including) == 1 && linitial(node->including) == NIL)) {
10467
10882
  XXH3_copyState(ctx->xxh_state, prev);
10468
10883
  if (ctx->write_tokens)
10469
10884
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10504,7 +10919,7 @@ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const vo
10504
10919
 
10505
10920
  hash = XXH3_64bits_digest(ctx->xxh_state);
10506
10921
  _fingerprintNode(ctx, node->keys, node, "keys", depth + 1);
10507
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10922
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->keys) == 1 && linitial(node->keys) == NIL)) {
10508
10923
  XXH3_copyState(ctx->xxh_state, prev);
10509
10924
  if (ctx->write_tokens)
10510
10925
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10513,6 +10928,11 @@ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const vo
10513
10928
  }
10514
10929
  // Intentionally ignoring node->location for fingerprinting
10515
10930
 
10931
+ if (node->nulls_not_distinct) {
10932
+ _fingerprintString(ctx, "nulls_not_distinct");
10933
+ _fingerprintString(ctx, "true");
10934
+ }
10935
+
10516
10936
  if (node->old_conpfeqop != NULL && node->old_conpfeqop->length > 0) {
10517
10937
  XXH3_state_t* prev = XXH3_createState();
10518
10938
  XXH64_hash_t hash;
@@ -10522,7 +10942,7 @@ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const vo
10522
10942
 
10523
10943
  hash = XXH3_64bits_digest(ctx->xxh_state);
10524
10944
  _fingerprintNode(ctx, node->old_conpfeqop, node, "old_conpfeqop", depth + 1);
10525
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10945
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->old_conpfeqop) == 1 && linitial(node->old_conpfeqop) == NIL)) {
10526
10946
  XXH3_copyState(ctx->xxh_state, prev);
10527
10947
  if (ctx->write_tokens)
10528
10948
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10545,7 +10965,7 @@ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const vo
10545
10965
 
10546
10966
  hash = XXH3_64bits_digest(ctx->xxh_state);
10547
10967
  _fingerprintNode(ctx, node->options, node, "options", depth + 1);
10548
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10968
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
10549
10969
  XXH3_copyState(ctx->xxh_state, prev);
10550
10970
  if (ctx->write_tokens)
10551
10971
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10561,7 +10981,7 @@ _fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const vo
10561
10981
 
10562
10982
  hash = XXH3_64bits_digest(ctx->xxh_state);
10563
10983
  _fingerprintNode(ctx, node->pk_attrs, node, "pk_attrs", depth + 1);
10564
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
10984
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->pk_attrs) == 1 && linitial(node->pk_attrs) == NIL)) {
10565
10985
  XXH3_copyState(ctx->xxh_state, prev);
10566
10986
  if (ctx->write_tokens)
10567
10987
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10706,7 +11126,7 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
10706
11126
 
10707
11127
  hash = XXH3_64bits_digest(ctx->xxh_state);
10708
11128
  _fingerprintNode(ctx, node->colcollations, node, "colcollations", depth + 1);
10709
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11129
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->colcollations) == 1 && linitial(node->colcollations) == NIL)) {
10710
11130
  XXH3_copyState(ctx->xxh_state, prev);
10711
11131
  if (ctx->write_tokens)
10712
11132
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10722,7 +11142,7 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
10722
11142
 
10723
11143
  hash = XXH3_64bits_digest(ctx->xxh_state);
10724
11144
  _fingerprintNode(ctx, node->coltypes, node, "coltypes", depth + 1);
10725
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11145
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->coltypes) == 1 && linitial(node->coltypes) == NIL)) {
10726
11146
  XXH3_copyState(ctx->xxh_state, prev);
10727
11147
  if (ctx->write_tokens)
10728
11148
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10738,7 +11158,7 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
10738
11158
 
10739
11159
  hash = XXH3_64bits_digest(ctx->xxh_state);
10740
11160
  _fingerprintNode(ctx, node->coltypmods, node, "coltypmods", depth + 1);
10741
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11161
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->coltypmods) == 1 && linitial(node->coltypmods) == NIL)) {
10742
11162
  XXH3_copyState(ctx->xxh_state, prev);
10743
11163
  if (ctx->write_tokens)
10744
11164
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10815,7 +11235,7 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
10815
11235
 
10816
11236
  hash = XXH3_64bits_digest(ctx->xxh_state);
10817
11237
  _fingerprintNode(ctx, node->functions, node, "functions", depth + 1);
10818
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11238
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->functions) == 1 && linitial(node->functions) == NIL)) {
10819
11239
  XXH3_copyState(ctx->xxh_state, prev);
10820
11240
  if (ctx->write_tokens)
10821
11241
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10847,6 +11267,23 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
10847
11267
  bms_free(bms);
10848
11268
  }
10849
11269
 
11270
+ if (node->join_using_alias != NULL) {
11271
+ XXH3_state_t* prev = XXH3_createState();
11272
+ XXH64_hash_t hash;
11273
+
11274
+ XXH3_copyState(prev, ctx->xxh_state);
11275
+ _fingerprintString(ctx, "join_using_alias");
11276
+
11277
+ hash = XXH3_64bits_digest(ctx->xxh_state);
11278
+ _fingerprintAlias(ctx, node->join_using_alias, node, "join_using_alias", depth + 1);
11279
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11280
+ XXH3_copyState(ctx->xxh_state, prev);
11281
+ if (ctx->write_tokens)
11282
+ dlist_delete(dlist_tail_node(&ctx->tokens));
11283
+ }
11284
+ XXH3_freeState(prev);
11285
+ }
11286
+
10850
11287
  if (node->joinaliasvars != NULL && node->joinaliasvars->length > 0) {
10851
11288
  XXH3_state_t* prev = XXH3_createState();
10852
11289
  XXH64_hash_t hash;
@@ -10856,7 +11293,7 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
10856
11293
 
10857
11294
  hash = XXH3_64bits_digest(ctx->xxh_state);
10858
11295
  _fingerprintNode(ctx, node->joinaliasvars, node, "joinaliasvars", depth + 1);
10859
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11296
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->joinaliasvars) == 1 && linitial(node->joinaliasvars) == NIL)) {
10860
11297
  XXH3_copyState(ctx->xxh_state, prev);
10861
11298
  if (ctx->write_tokens)
10862
11299
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10872,7 +11309,7 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
10872
11309
 
10873
11310
  hash = XXH3_64bits_digest(ctx->xxh_state);
10874
11311
  _fingerprintNode(ctx, node->joinleftcols, node, "joinleftcols", depth + 1);
10875
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11312
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->joinleftcols) == 1 && linitial(node->joinleftcols) == NIL)) {
10876
11313
  XXH3_copyState(ctx->xxh_state, prev);
10877
11314
  if (ctx->write_tokens)
10878
11315
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10895,7 +11332,7 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
10895
11332
 
10896
11333
  hash = XXH3_64bits_digest(ctx->xxh_state);
10897
11334
  _fingerprintNode(ctx, node->joinrightcols, node, "joinrightcols", depth + 1);
10898
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11335
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->joinrightcols) == 1 && linitial(node->joinrightcols) == NIL)) {
10899
11336
  XXH3_copyState(ctx->xxh_state, prev);
10900
11337
  if (ctx->write_tokens)
10901
11338
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -10953,7 +11390,7 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
10953
11390
 
10954
11391
  hash = XXH3_64bits_digest(ctx->xxh_state);
10955
11392
  _fingerprintNode(ctx, node->securityQuals, node, "securityQuals", depth + 1);
10956
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11393
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->securityQuals) == 1 && linitial(node->securityQuals) == NIL)) {
10957
11394
  XXH3_copyState(ctx->xxh_state, prev);
10958
11395
  if (ctx->write_tokens)
10959
11396
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11060,7 +11497,7 @@ _fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, co
11060
11497
 
11061
11498
  hash = XXH3_64bits_digest(ctx->xxh_state);
11062
11499
  _fingerprintNode(ctx, node->values_lists, node, "values_lists", depth + 1);
11063
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11500
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->values_lists) == 1 && linitial(node->values_lists) == NIL)) {
11064
11501
  XXH3_copyState(ctx->xxh_state, prev);
11065
11502
  if (ctx->write_tokens)
11066
11503
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11081,7 +11518,7 @@ _fingerprintRangeTblFunction(FingerprintContext *ctx, const RangeTblFunction *no
11081
11518
 
11082
11519
  hash = XXH3_64bits_digest(ctx->xxh_state);
11083
11520
  _fingerprintNode(ctx, node->funccolcollations, node, "funccolcollations", depth + 1);
11084
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11521
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->funccolcollations) == 1 && linitial(node->funccolcollations) == NIL)) {
11085
11522
  XXH3_copyState(ctx->xxh_state, prev);
11086
11523
  if (ctx->write_tokens)
11087
11524
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11104,7 +11541,7 @@ _fingerprintRangeTblFunction(FingerprintContext *ctx, const RangeTblFunction *no
11104
11541
 
11105
11542
  hash = XXH3_64bits_digest(ctx->xxh_state);
11106
11543
  _fingerprintNode(ctx, node->funccolnames, node, "funccolnames", depth + 1);
11107
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11544
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->funccolnames) == 1 && linitial(node->funccolnames) == NIL)) {
11108
11545
  XXH3_copyState(ctx->xxh_state, prev);
11109
11546
  if (ctx->write_tokens)
11110
11547
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11120,7 +11557,7 @@ _fingerprintRangeTblFunction(FingerprintContext *ctx, const RangeTblFunction *no
11120
11557
 
11121
11558
  hash = XXH3_64bits_digest(ctx->xxh_state);
11122
11559
  _fingerprintNode(ctx, node->funccoltypes, node, "funccoltypes", depth + 1);
11123
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11560
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->funccoltypes) == 1 && linitial(node->funccoltypes) == NIL)) {
11124
11561
  XXH3_copyState(ctx->xxh_state, prev);
11125
11562
  if (ctx->write_tokens)
11126
11563
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11136,7 +11573,7 @@ _fingerprintRangeTblFunction(FingerprintContext *ctx, const RangeTblFunction *no
11136
11573
 
11137
11574
  hash = XXH3_64bits_digest(ctx->xxh_state);
11138
11575
  _fingerprintNode(ctx, node->funccoltypmods, node, "funccoltypmods", depth + 1);
11139
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11576
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->funccoltypmods) == 1 && linitial(node->funccoltypmods) == NIL)) {
11140
11577
  XXH3_copyState(ctx->xxh_state, prev);
11141
11578
  if (ctx->write_tokens)
11142
11579
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11189,7 +11626,7 @@ _fingerprintTableSampleClause(FingerprintContext *ctx, const TableSampleClause *
11189
11626
 
11190
11627
  hash = XXH3_64bits_digest(ctx->xxh_state);
11191
11628
  _fingerprintNode(ctx, node->args, node, "args", depth + 1);
11192
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11629
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->args) == 1 && linitial(node->args) == NIL)) {
11193
11630
  XXH3_copyState(ctx->xxh_state, prev);
11194
11631
  if (ctx->write_tokens)
11195
11632
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11312,7 +11749,7 @@ _fingerprintGroupingSet(FingerprintContext *ctx, const GroupingSet *node, const
11312
11749
 
11313
11750
  hash = XXH3_64bits_digest(ctx->xxh_state);
11314
11751
  _fingerprintNode(ctx, node->content, node, "content", depth + 1);
11315
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11752
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->content) == 1 && linitial(node->content) == NIL)) {
11316
11753
  XXH3_copyState(ctx->xxh_state, prev);
11317
11754
  if (ctx->write_tokens)
11318
11755
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11398,7 +11835,7 @@ _fingerprintWindowClause(FingerprintContext *ctx, const WindowClause *node, cons
11398
11835
 
11399
11836
  hash = XXH3_64bits_digest(ctx->xxh_state);
11400
11837
  _fingerprintNode(ctx, node->orderClause, node, "orderClause", depth + 1);
11401
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11838
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->orderClause) == 1 && linitial(node->orderClause) == NIL)) {
11402
11839
  XXH3_copyState(ctx->xxh_state, prev);
11403
11840
  if (ctx->write_tokens)
11404
11841
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11414,7 +11851,7 @@ _fingerprintWindowClause(FingerprintContext *ctx, const WindowClause *node, cons
11414
11851
 
11415
11852
  hash = XXH3_64bits_digest(ctx->xxh_state);
11416
11853
  _fingerprintNode(ctx, node->partitionClause, node, "partitionClause", depth + 1);
11417
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11854
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->partitionClause) == 1 && linitial(node->partitionClause) == NIL)) {
11418
11855
  XXH3_copyState(ctx->xxh_state, prev);
11419
11856
  if (ctx->write_tokens)
11420
11857
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11426,6 +11863,22 @@ _fingerprintWindowClause(FingerprintContext *ctx, const WindowClause *node, cons
11426
11863
  _fingerprintString(ctx, node->refname);
11427
11864
  }
11428
11865
 
11866
+ if (node->runCondition != NULL && node->runCondition->length > 0) {
11867
+ XXH3_state_t* prev = XXH3_createState();
11868
+ XXH64_hash_t hash;
11869
+
11870
+ XXH3_copyState(prev, ctx->xxh_state);
11871
+ _fingerprintString(ctx, "runCondition");
11872
+
11873
+ hash = XXH3_64bits_digest(ctx->xxh_state);
11874
+ _fingerprintNode(ctx, node->runCondition, node, "runCondition", depth + 1);
11875
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->runCondition) == 1 && linitial(node->runCondition) == NIL)) {
11876
+ XXH3_copyState(ctx->xxh_state, prev);
11877
+ if (ctx->write_tokens)
11878
+ dlist_delete(dlist_tail_node(&ctx->tokens));
11879
+ }
11880
+ XXH3_freeState(prev);
11881
+ }
11429
11882
  if (node->startInRangeFunc != 0) {
11430
11883
  char buffer[50];
11431
11884
  sprintf(buffer, "%d", node->startInRangeFunc);
@@ -11476,7 +11929,23 @@ _fingerprintObjectWithArgs(FingerprintContext *ctx, const ObjectWithArgs *node,
11476
11929
 
11477
11930
  hash = XXH3_64bits_digest(ctx->xxh_state);
11478
11931
  _fingerprintNode(ctx, node->objargs, node, "objargs", depth + 1);
11479
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11932
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->objargs) == 1 && linitial(node->objargs) == NIL)) {
11933
+ XXH3_copyState(ctx->xxh_state, prev);
11934
+ if (ctx->write_tokens)
11935
+ dlist_delete(dlist_tail_node(&ctx->tokens));
11936
+ }
11937
+ XXH3_freeState(prev);
11938
+ }
11939
+ if (node->objfuncargs != NULL && node->objfuncargs->length > 0) {
11940
+ XXH3_state_t* prev = XXH3_createState();
11941
+ XXH64_hash_t hash;
11942
+
11943
+ XXH3_copyState(prev, ctx->xxh_state);
11944
+ _fingerprintString(ctx, "objfuncargs");
11945
+
11946
+ hash = XXH3_64bits_digest(ctx->xxh_state);
11947
+ _fingerprintNode(ctx, node->objfuncargs, node, "objfuncargs", depth + 1);
11948
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->objfuncargs) == 1 && linitial(node->objfuncargs) == NIL)) {
11480
11949
  XXH3_copyState(ctx->xxh_state, prev);
11481
11950
  if (ctx->write_tokens)
11482
11951
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11492,7 +11961,7 @@ _fingerprintObjectWithArgs(FingerprintContext *ctx, const ObjectWithArgs *node,
11492
11961
 
11493
11962
  hash = XXH3_64bits_digest(ctx->xxh_state);
11494
11963
  _fingerprintNode(ctx, node->objname, node, "objname", depth + 1);
11495
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11964
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->objname) == 1 && linitial(node->objname) == NIL)) {
11496
11965
  XXH3_copyState(ctx->xxh_state, prev);
11497
11966
  if (ctx->write_tokens)
11498
11967
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11513,7 +11982,7 @@ _fingerprintAccessPriv(FingerprintContext *ctx, const AccessPriv *node, const vo
11513
11982
 
11514
11983
  hash = XXH3_64bits_digest(ctx->xxh_state);
11515
11984
  _fingerprintNode(ctx, node->cols, node, "cols", depth + 1);
11516
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
11985
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->cols) == 1 && linitial(node->cols) == NIL)) {
11517
11986
  XXH3_copyState(ctx->xxh_state, prev);
11518
11987
  if (ctx->write_tokens)
11519
11988
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11539,7 +12008,7 @@ _fingerprintCreateOpClassItem(FingerprintContext *ctx, const CreateOpClassItem *
11539
12008
 
11540
12009
  hash = XXH3_64bits_digest(ctx->xxh_state);
11541
12010
  _fingerprintNode(ctx, node->class_args, node, "class_args", depth + 1);
11542
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12011
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->class_args) == 1 && linitial(node->class_args) == NIL)) {
11543
12012
  XXH3_copyState(ctx->xxh_state, prev);
11544
12013
  if (ctx->write_tokens)
11545
12014
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11586,7 +12055,7 @@ _fingerprintCreateOpClassItem(FingerprintContext *ctx, const CreateOpClassItem *
11586
12055
 
11587
12056
  hash = XXH3_64bits_digest(ctx->xxh_state);
11588
12057
  _fingerprintNode(ctx, node->order_family, node, "order_family", depth + 1);
11589
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12058
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->order_family) == 1 && linitial(node->order_family) == NIL)) {
11590
12059
  XXH3_copyState(ctx->xxh_state, prev);
11591
12060
  if (ctx->write_tokens)
11592
12061
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11639,6 +12108,13 @@ _fingerprintTableLikeClause(FingerprintContext *ctx, const TableLikeClause *node
11639
12108
  XXH3_freeState(prev);
11640
12109
  }
11641
12110
 
12111
+ if (node->relationOid != 0) {
12112
+ char buffer[50];
12113
+ sprintf(buffer, "%d", node->relationOid);
12114
+ _fingerprintString(ctx, "relationOid");
12115
+ _fingerprintString(ctx, buffer);
12116
+ }
12117
+
11642
12118
  }
11643
12119
 
11644
12120
  static void
@@ -11683,10 +12159,7 @@ _fingerprintFunctionParameter(FingerprintContext *ctx, const FunctionParameter *
11683
12159
  _fingerprintString(ctx, _enumToStringFunctionParameterMode(node->mode));
11684
12160
  }
11685
12161
 
11686
- if (node->name != NULL) {
11687
- _fingerprintString(ctx, "name");
11688
- _fingerprintString(ctx, node->name);
11689
- }
12162
+ // Intentionally ignoring node->name for fingerprinting
11690
12163
 
11691
12164
  }
11692
12165
 
@@ -11702,7 +12175,7 @@ _fingerprintLockingClause(FingerprintContext *ctx, const LockingClause *node, co
11702
12175
 
11703
12176
  hash = XXH3_64bits_digest(ctx->xxh_state);
11704
12177
  _fingerprintNode(ctx, node->lockedRels, node, "lockedRels", depth + 1);
11705
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12178
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->lockedRels) == 1 && linitial(node->lockedRels) == NIL)) {
11706
12179
  XXH3_copyState(ctx->xxh_state, prev);
11707
12180
  if (ctx->write_tokens)
11708
12181
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11806,7 +12279,7 @@ _fingerprintWithClause(FingerprintContext *ctx, const WithClause *node, const vo
11806
12279
 
11807
12280
  hash = XXH3_64bits_digest(ctx->xxh_state);
11808
12281
  _fingerprintNode(ctx, node->ctes, node, "ctes", depth + 1);
11809
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12282
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->ctes) == 1 && linitial(node->ctes) == NIL)) {
11810
12283
  XXH3_copyState(ctx->xxh_state, prev);
11811
12284
  if (ctx->write_tokens)
11812
12285
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11839,7 +12312,7 @@ _fingerprintInferClause(FingerprintContext *ctx, const InferClause *node, const
11839
12312
 
11840
12313
  hash = XXH3_64bits_digest(ctx->xxh_state);
11841
12314
  _fingerprintNode(ctx, node->indexElems, node, "indexElems", depth + 1);
11842
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12315
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->indexElems) == 1 && linitial(node->indexElems) == NIL)) {
11843
12316
  XXH3_copyState(ctx->xxh_state, prev);
11844
12317
  if (ctx->write_tokens)
11845
12318
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11903,7 +12376,7 @@ _fingerprintOnConflictClause(FingerprintContext *ctx, const OnConflictClause *no
11903
12376
 
11904
12377
  hash = XXH3_64bits_digest(ctx->xxh_state);
11905
12378
  _fingerprintNode(ctx, node->targetList, node, "targetList", depth + 1);
11906
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12379
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->targetList) == 1 && linitial(node->targetList) == NIL)) {
11907
12380
  XXH3_copyState(ctx->xxh_state, prev);
11908
12381
  if (ctx->write_tokens)
11909
12382
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11929,6 +12402,134 @@ _fingerprintOnConflictClause(FingerprintContext *ctx, const OnConflictClause *no
11929
12402
 
11930
12403
  }
11931
12404
 
12405
+ static void
12406
+ _fingerprintCTESearchClause(FingerprintContext *ctx, const CTESearchClause *node, const void *parent, const char *field_name, unsigned int depth)
12407
+ {
12408
+ // Intentionally ignoring node->location for fingerprinting
12409
+
12410
+ if (node->search_breadth_first) {
12411
+ _fingerprintString(ctx, "search_breadth_first");
12412
+ _fingerprintString(ctx, "true");
12413
+ }
12414
+
12415
+ if (node->search_col_list != NULL && node->search_col_list->length > 0) {
12416
+ XXH3_state_t* prev = XXH3_createState();
12417
+ XXH64_hash_t hash;
12418
+
12419
+ XXH3_copyState(prev, ctx->xxh_state);
12420
+ _fingerprintString(ctx, "search_col_list");
12421
+
12422
+ hash = XXH3_64bits_digest(ctx->xxh_state);
12423
+ _fingerprintNode(ctx, node->search_col_list, node, "search_col_list", depth + 1);
12424
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->search_col_list) == 1 && linitial(node->search_col_list) == NIL)) {
12425
+ XXH3_copyState(ctx->xxh_state, prev);
12426
+ if (ctx->write_tokens)
12427
+ dlist_delete(dlist_tail_node(&ctx->tokens));
12428
+ }
12429
+ XXH3_freeState(prev);
12430
+ }
12431
+ if (node->search_seq_column != NULL) {
12432
+ _fingerprintString(ctx, "search_seq_column");
12433
+ _fingerprintString(ctx, node->search_seq_column);
12434
+ }
12435
+
12436
+ }
12437
+
12438
+ static void
12439
+ _fingerprintCTECycleClause(FingerprintContext *ctx, const CTECycleClause *node, const void *parent, const char *field_name, unsigned int depth)
12440
+ {
12441
+ if (node->cycle_col_list != NULL && node->cycle_col_list->length > 0) {
12442
+ XXH3_state_t* prev = XXH3_createState();
12443
+ XXH64_hash_t hash;
12444
+
12445
+ XXH3_copyState(prev, ctx->xxh_state);
12446
+ _fingerprintString(ctx, "cycle_col_list");
12447
+
12448
+ hash = XXH3_64bits_digest(ctx->xxh_state);
12449
+ _fingerprintNode(ctx, node->cycle_col_list, node, "cycle_col_list", depth + 1);
12450
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->cycle_col_list) == 1 && linitial(node->cycle_col_list) == NIL)) {
12451
+ XXH3_copyState(ctx->xxh_state, prev);
12452
+ if (ctx->write_tokens)
12453
+ dlist_delete(dlist_tail_node(&ctx->tokens));
12454
+ }
12455
+ XXH3_freeState(prev);
12456
+ }
12457
+ if (node->cycle_mark_collation != 0) {
12458
+ char buffer[50];
12459
+ sprintf(buffer, "%d", node->cycle_mark_collation);
12460
+ _fingerprintString(ctx, "cycle_mark_collation");
12461
+ _fingerprintString(ctx, buffer);
12462
+ }
12463
+
12464
+ if (node->cycle_mark_column != NULL) {
12465
+ _fingerprintString(ctx, "cycle_mark_column");
12466
+ _fingerprintString(ctx, node->cycle_mark_column);
12467
+ }
12468
+
12469
+ if (node->cycle_mark_default != NULL) {
12470
+ XXH3_state_t* prev = XXH3_createState();
12471
+ XXH64_hash_t hash;
12472
+
12473
+ XXH3_copyState(prev, ctx->xxh_state);
12474
+ _fingerprintString(ctx, "cycle_mark_default");
12475
+
12476
+ hash = XXH3_64bits_digest(ctx->xxh_state);
12477
+ _fingerprintNode(ctx, node->cycle_mark_default, node, "cycle_mark_default", depth + 1);
12478
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12479
+ XXH3_copyState(ctx->xxh_state, prev);
12480
+ if (ctx->write_tokens)
12481
+ dlist_delete(dlist_tail_node(&ctx->tokens));
12482
+ }
12483
+ XXH3_freeState(prev);
12484
+ }
12485
+
12486
+ if (node->cycle_mark_neop != 0) {
12487
+ char buffer[50];
12488
+ sprintf(buffer, "%d", node->cycle_mark_neop);
12489
+ _fingerprintString(ctx, "cycle_mark_neop");
12490
+ _fingerprintString(ctx, buffer);
12491
+ }
12492
+
12493
+ if (node->cycle_mark_type != 0) {
12494
+ char buffer[50];
12495
+ sprintf(buffer, "%d", node->cycle_mark_type);
12496
+ _fingerprintString(ctx, "cycle_mark_type");
12497
+ _fingerprintString(ctx, buffer);
12498
+ }
12499
+
12500
+ if (node->cycle_mark_typmod != 0) {
12501
+ char buffer[50];
12502
+ sprintf(buffer, "%d", node->cycle_mark_typmod);
12503
+ _fingerprintString(ctx, "cycle_mark_typmod");
12504
+ _fingerprintString(ctx, buffer);
12505
+ }
12506
+
12507
+ if (node->cycle_mark_value != NULL) {
12508
+ XXH3_state_t* prev = XXH3_createState();
12509
+ XXH64_hash_t hash;
12510
+
12511
+ XXH3_copyState(prev, ctx->xxh_state);
12512
+ _fingerprintString(ctx, "cycle_mark_value");
12513
+
12514
+ hash = XXH3_64bits_digest(ctx->xxh_state);
12515
+ _fingerprintNode(ctx, node->cycle_mark_value, node, "cycle_mark_value", depth + 1);
12516
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12517
+ XXH3_copyState(ctx->xxh_state, prev);
12518
+ if (ctx->write_tokens)
12519
+ dlist_delete(dlist_tail_node(&ctx->tokens));
12520
+ }
12521
+ XXH3_freeState(prev);
12522
+ }
12523
+
12524
+ if (node->cycle_path_column != NULL) {
12525
+ _fingerprintString(ctx, "cycle_path_column");
12526
+ _fingerprintString(ctx, node->cycle_path_column);
12527
+ }
12528
+
12529
+ // Intentionally ignoring node->location for fingerprinting
12530
+
12531
+ }
12532
+
11932
12533
  static void
11933
12534
  _fingerprintCommonTableExpr(FingerprintContext *ctx, const CommonTableExpr *node, const void *parent, const char *field_name, unsigned int depth)
11934
12535
  {
@@ -11941,7 +12542,7 @@ _fingerprintCommonTableExpr(FingerprintContext *ctx, const CommonTableExpr *node
11941
12542
 
11942
12543
  hash = XXH3_64bits_digest(ctx->xxh_state);
11943
12544
  _fingerprintNode(ctx, node->aliascolnames, node, "aliascolnames", depth + 1);
11944
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12545
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->aliascolnames) == 1 && linitial(node->aliascolnames) == NIL)) {
11945
12546
  XXH3_copyState(ctx->xxh_state, prev);
11946
12547
  if (ctx->write_tokens)
11947
12548
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11957,7 +12558,7 @@ _fingerprintCommonTableExpr(FingerprintContext *ctx, const CommonTableExpr *node
11957
12558
 
11958
12559
  hash = XXH3_64bits_digest(ctx->xxh_state);
11959
12560
  _fingerprintNode(ctx, node->ctecolcollations, node, "ctecolcollations", depth + 1);
11960
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12561
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->ctecolcollations) == 1 && linitial(node->ctecolcollations) == NIL)) {
11961
12562
  XXH3_copyState(ctx->xxh_state, prev);
11962
12563
  if (ctx->write_tokens)
11963
12564
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11973,7 +12574,7 @@ _fingerprintCommonTableExpr(FingerprintContext *ctx, const CommonTableExpr *node
11973
12574
 
11974
12575
  hash = XXH3_64bits_digest(ctx->xxh_state);
11975
12576
  _fingerprintNode(ctx, node->ctecolnames, node, "ctecolnames", depth + 1);
11976
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12577
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->ctecolnames) == 1 && linitial(node->ctecolnames) == NIL)) {
11977
12578
  XXH3_copyState(ctx->xxh_state, prev);
11978
12579
  if (ctx->write_tokens)
11979
12580
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -11989,7 +12590,7 @@ _fingerprintCommonTableExpr(FingerprintContext *ctx, const CommonTableExpr *node
11989
12590
 
11990
12591
  hash = XXH3_64bits_digest(ctx->xxh_state);
11991
12592
  _fingerprintNode(ctx, node->ctecoltypes, node, "ctecoltypes", depth + 1);
11992
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12593
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->ctecoltypes) == 1 && linitial(node->ctecoltypes) == NIL)) {
11993
12594
  XXH3_copyState(ctx->xxh_state, prev);
11994
12595
  if (ctx->write_tokens)
11995
12596
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -12005,7 +12606,7 @@ _fingerprintCommonTableExpr(FingerprintContext *ctx, const CommonTableExpr *node
12005
12606
 
12006
12607
  hash = XXH3_64bits_digest(ctx->xxh_state);
12007
12608
  _fingerprintNode(ctx, node->ctecoltypmods, node, "ctecoltypmods", depth + 1);
12008
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12609
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->ctecoltypmods) == 1 && linitial(node->ctecoltypmods) == NIL)) {
12009
12610
  XXH3_copyState(ctx->xxh_state, prev);
12010
12611
  if (ctx->write_tokens)
12011
12612
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -12051,8 +12652,111 @@ _fingerprintCommonTableExpr(FingerprintContext *ctx, const CommonTableExpr *node
12051
12652
  _fingerprintString(ctx, buffer);
12052
12653
  }
12053
12654
 
12655
+ if (node->cycle_clause != NULL) {
12656
+ XXH3_state_t* prev = XXH3_createState();
12657
+ XXH64_hash_t hash;
12658
+
12659
+ XXH3_copyState(prev, ctx->xxh_state);
12660
+ _fingerprintString(ctx, "cycle_clause");
12661
+
12662
+ hash = XXH3_64bits_digest(ctx->xxh_state);
12663
+ _fingerprintCTECycleClause(ctx, node->cycle_clause, node, "cycle_clause", depth + 1);
12664
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12665
+ XXH3_copyState(ctx->xxh_state, prev);
12666
+ if (ctx->write_tokens)
12667
+ dlist_delete(dlist_tail_node(&ctx->tokens));
12668
+ }
12669
+ XXH3_freeState(prev);
12670
+ }
12671
+
12054
12672
  // Intentionally ignoring node->location for fingerprinting
12055
12673
 
12674
+ if (node->search_clause != NULL) {
12675
+ XXH3_state_t* prev = XXH3_createState();
12676
+ XXH64_hash_t hash;
12677
+
12678
+ XXH3_copyState(prev, ctx->xxh_state);
12679
+ _fingerprintString(ctx, "search_clause");
12680
+
12681
+ hash = XXH3_64bits_digest(ctx->xxh_state);
12682
+ _fingerprintCTESearchClause(ctx, node->search_clause, node, "search_clause", depth + 1);
12683
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12684
+ XXH3_copyState(ctx->xxh_state, prev);
12685
+ if (ctx->write_tokens)
12686
+ dlist_delete(dlist_tail_node(&ctx->tokens));
12687
+ }
12688
+ XXH3_freeState(prev);
12689
+ }
12690
+
12691
+ }
12692
+
12693
+ static void
12694
+ _fingerprintMergeWhenClause(FingerprintContext *ctx, const MergeWhenClause *node, const void *parent, const char *field_name, unsigned int depth)
12695
+ {
12696
+ if (true) {
12697
+ _fingerprintString(ctx, "commandType");
12698
+ _fingerprintString(ctx, _enumToStringCmdType(node->commandType));
12699
+ }
12700
+
12701
+ if (node->condition != NULL) {
12702
+ XXH3_state_t* prev = XXH3_createState();
12703
+ XXH64_hash_t hash;
12704
+
12705
+ XXH3_copyState(prev, ctx->xxh_state);
12706
+ _fingerprintString(ctx, "condition");
12707
+
12708
+ hash = XXH3_64bits_digest(ctx->xxh_state);
12709
+ _fingerprintNode(ctx, node->condition, node, "condition", depth + 1);
12710
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12711
+ XXH3_copyState(ctx->xxh_state, prev);
12712
+ if (ctx->write_tokens)
12713
+ dlist_delete(dlist_tail_node(&ctx->tokens));
12714
+ }
12715
+ XXH3_freeState(prev);
12716
+ }
12717
+
12718
+ if (node->matched) {
12719
+ _fingerprintString(ctx, "matched");
12720
+ _fingerprintString(ctx, "true");
12721
+ }
12722
+
12723
+ if (true) {
12724
+ _fingerprintString(ctx, "override");
12725
+ _fingerprintString(ctx, _enumToStringOverridingKind(node->override));
12726
+ }
12727
+
12728
+ if (node->targetList != NULL && node->targetList->length > 0) {
12729
+ XXH3_state_t* prev = XXH3_createState();
12730
+ XXH64_hash_t hash;
12731
+
12732
+ XXH3_copyState(prev, ctx->xxh_state);
12733
+ _fingerprintString(ctx, "targetList");
12734
+
12735
+ hash = XXH3_64bits_digest(ctx->xxh_state);
12736
+ _fingerprintNode(ctx, node->targetList, node, "targetList", depth + 1);
12737
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->targetList) == 1 && linitial(node->targetList) == NIL)) {
12738
+ XXH3_copyState(ctx->xxh_state, prev);
12739
+ if (ctx->write_tokens)
12740
+ dlist_delete(dlist_tail_node(&ctx->tokens));
12741
+ }
12742
+ XXH3_freeState(prev);
12743
+ }
12744
+ if (node->values != NULL && node->values->length > 0) {
12745
+ XXH3_state_t* prev = XXH3_createState();
12746
+ XXH64_hash_t hash;
12747
+
12748
+ XXH3_copyState(prev, ctx->xxh_state);
12749
+ _fingerprintString(ctx, "values");
12750
+
12751
+ hash = XXH3_64bits_digest(ctx->xxh_state);
12752
+ _fingerprintNode(ctx, node->values, node, "values", depth + 1);
12753
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->values) == 1 && linitial(node->values) == NIL)) {
12754
+ XXH3_copyState(ctx->xxh_state, prev);
12755
+ if (ctx->write_tokens)
12756
+ dlist_delete(dlist_tail_node(&ctx->tokens));
12757
+ }
12758
+ XXH3_freeState(prev);
12759
+ }
12056
12760
  }
12057
12761
 
12058
12762
  static void
@@ -12104,7 +12808,7 @@ _fingerprintPartitionElem(FingerprintContext *ctx, const PartitionElem *node, co
12104
12808
 
12105
12809
  hash = XXH3_64bits_digest(ctx->xxh_state);
12106
12810
  _fingerprintNode(ctx, node->collation, node, "collation", depth + 1);
12107
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12811
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->collation) == 1 && linitial(node->collation) == NIL)) {
12108
12812
  XXH3_copyState(ctx->xxh_state, prev);
12109
12813
  if (ctx->write_tokens)
12110
12814
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -12144,7 +12848,7 @@ _fingerprintPartitionElem(FingerprintContext *ctx, const PartitionElem *node, co
12144
12848
 
12145
12849
  hash = XXH3_64bits_digest(ctx->xxh_state);
12146
12850
  _fingerprintNode(ctx, node->opclass, node, "opclass", depth + 1);
12147
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12851
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->opclass) == 1 && linitial(node->opclass) == NIL)) {
12148
12852
  XXH3_copyState(ctx->xxh_state, prev);
12149
12853
  if (ctx->write_tokens)
12150
12854
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -12167,7 +12871,7 @@ _fingerprintPartitionSpec(FingerprintContext *ctx, const PartitionSpec *node, co
12167
12871
 
12168
12872
  hash = XXH3_64bits_digest(ctx->xxh_state);
12169
12873
  _fingerprintNode(ctx, node->partParams, node, "partParams", depth + 1);
12170
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12874
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->partParams) == 1 && linitial(node->partParams) == NIL)) {
12171
12875
  XXH3_copyState(ctx->xxh_state, prev);
12172
12876
  if (ctx->write_tokens)
12173
12877
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -12198,7 +12902,7 @@ _fingerprintPartitionBoundSpec(FingerprintContext *ctx, const PartitionBoundSpec
12198
12902
 
12199
12903
  hash = XXH3_64bits_digest(ctx->xxh_state);
12200
12904
  _fingerprintNode(ctx, node->listdatums, node, "listdatums", depth + 1);
12201
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12905
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->listdatums) == 1 && linitial(node->listdatums) == NIL)) {
12202
12906
  XXH3_copyState(ctx->xxh_state, prev);
12203
12907
  if (ctx->write_tokens)
12204
12908
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -12216,7 +12920,7 @@ _fingerprintPartitionBoundSpec(FingerprintContext *ctx, const PartitionBoundSpec
12216
12920
 
12217
12921
  hash = XXH3_64bits_digest(ctx->xxh_state);
12218
12922
  _fingerprintNode(ctx, node->lowerdatums, node, "lowerdatums", depth + 1);
12219
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12923
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->lowerdatums) == 1 && linitial(node->lowerdatums) == NIL)) {
12220
12924
  XXH3_copyState(ctx->xxh_state, prev);
12221
12925
  if (ctx->write_tokens)
12222
12926
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -12252,7 +12956,7 @@ _fingerprintPartitionBoundSpec(FingerprintContext *ctx, const PartitionBoundSpec
12252
12956
 
12253
12957
  hash = XXH3_64bits_digest(ctx->xxh_state);
12254
12958
  _fingerprintNode(ctx, node->upperdatums, node, "upperdatums", depth + 1);
12255
- if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12959
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->upperdatums) == 1 && linitial(node->upperdatums) == NIL)) {
12256
12960
  XXH3_copyState(ctx->xxh_state, prev);
12257
12961
  if (ctx->write_tokens)
12258
12962
  dlist_delete(dlist_tail_node(&ctx->tokens));
@@ -12310,6 +13014,11 @@ _fingerprintPartitionCmd(FingerprintContext *ctx, const PartitionCmd *node, cons
12310
13014
  XXH3_freeState(prev);
12311
13015
  }
12312
13016
 
13017
+ if (node->concurrent) {
13018
+ _fingerprintString(ctx, "concurrent");
13019
+ _fingerprintString(ctx, "true");
13020
+ }
13021
+
12313
13022
  if (node->name != NULL) {
12314
13023
  XXH3_state_t* prev = XXH3_createState();
12315
13024
  XXH64_hash_t hash;
@@ -12365,6 +13074,39 @@ _fingerprintVacuumRelation(FingerprintContext *ctx, const VacuumRelation *node,
12365
13074
 
12366
13075
  hash = XXH3_64bits_digest(ctx->xxh_state);
12367
13076
  _fingerprintNode(ctx, node->va_cols, node, "va_cols", depth + 1);
13077
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->va_cols) == 1 && linitial(node->va_cols) == NIL)) {
13078
+ XXH3_copyState(ctx->xxh_state, prev);
13079
+ if (ctx->write_tokens)
13080
+ dlist_delete(dlist_tail_node(&ctx->tokens));
13081
+ }
13082
+ XXH3_freeState(prev);
13083
+ }
13084
+ }
13085
+
13086
+ static void
13087
+ _fingerprintPublicationObjSpec(FingerprintContext *ctx, const PublicationObjSpec *node, const void *parent, const char *field_name, unsigned int depth)
13088
+ {
13089
+ // Intentionally ignoring node->location for fingerprinting
13090
+
13091
+ if (node->name != NULL) {
13092
+ _fingerprintString(ctx, "name");
13093
+ _fingerprintString(ctx, node->name);
13094
+ }
13095
+
13096
+ if (true) {
13097
+ _fingerprintString(ctx, "pubobjtype");
13098
+ _fingerprintString(ctx, _enumToStringPublicationObjSpecType(node->pubobjtype));
13099
+ }
13100
+
13101
+ if (node->pubtable != NULL) {
13102
+ XXH3_state_t* prev = XXH3_createState();
13103
+ XXH64_hash_t hash;
13104
+
13105
+ XXH3_copyState(prev, ctx->xxh_state);
13106
+ _fingerprintString(ctx, "pubtable");
13107
+
13108
+ hash = XXH3_64bits_digest(ctx->xxh_state);
13109
+ _fingerprintPublicationTable(ctx, node->pubtable, node, "pubtable", depth + 1);
12368
13110
  if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
12369
13111
  XXH3_copyState(ctx->xxh_state, prev);
12370
13112
  if (ctx->write_tokens)
@@ -12372,6 +13114,62 @@ _fingerprintVacuumRelation(FingerprintContext *ctx, const VacuumRelation *node,
12372
13114
  }
12373
13115
  XXH3_freeState(prev);
12374
13116
  }
13117
+
13118
+ }
13119
+
13120
+ static void
13121
+ _fingerprintPublicationTable(FingerprintContext *ctx, const PublicationTable *node, const void *parent, const char *field_name, unsigned int depth)
13122
+ {
13123
+ if (node->columns != NULL && node->columns->length > 0) {
13124
+ XXH3_state_t* prev = XXH3_createState();
13125
+ XXH64_hash_t hash;
13126
+
13127
+ XXH3_copyState(prev, ctx->xxh_state);
13128
+ _fingerprintString(ctx, "columns");
13129
+
13130
+ hash = XXH3_64bits_digest(ctx->xxh_state);
13131
+ _fingerprintNode(ctx, node->columns, node, "columns", depth + 1);
13132
+ if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->columns) == 1 && linitial(node->columns) == NIL)) {
13133
+ XXH3_copyState(ctx->xxh_state, prev);
13134
+ if (ctx->write_tokens)
13135
+ dlist_delete(dlist_tail_node(&ctx->tokens));
13136
+ }
13137
+ XXH3_freeState(prev);
13138
+ }
13139
+ if (node->relation != NULL) {
13140
+ XXH3_state_t* prev = XXH3_createState();
13141
+ XXH64_hash_t hash;
13142
+
13143
+ XXH3_copyState(prev, ctx->xxh_state);
13144
+ _fingerprintString(ctx, "relation");
13145
+
13146
+ hash = XXH3_64bits_digest(ctx->xxh_state);
13147
+ _fingerprintRangeVar(ctx, node->relation, node, "relation", depth + 1);
13148
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
13149
+ XXH3_copyState(ctx->xxh_state, prev);
13150
+ if (ctx->write_tokens)
13151
+ dlist_delete(dlist_tail_node(&ctx->tokens));
13152
+ }
13153
+ XXH3_freeState(prev);
13154
+ }
13155
+
13156
+ if (node->whereClause != NULL) {
13157
+ XXH3_state_t* prev = XXH3_createState();
13158
+ XXH64_hash_t hash;
13159
+
13160
+ XXH3_copyState(prev, ctx->xxh_state);
13161
+ _fingerprintString(ctx, "whereClause");
13162
+
13163
+ hash = XXH3_64bits_digest(ctx->xxh_state);
13164
+ _fingerprintNode(ctx, node->whereClause, node, "whereClause", depth + 1);
13165
+ if (hash == XXH3_64bits_digest(ctx->xxh_state)) {
13166
+ XXH3_copyState(ctx->xxh_state, prev);
13167
+ if (ctx->write_tokens)
13168
+ dlist_delete(dlist_tail_node(&ctx->tokens));
13169
+ }
13170
+ XXH3_freeState(prev);
13171
+ }
13172
+
12375
13173
  }
12376
13174
 
12377
13175
  static void