pg_query 4.2.1 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (901) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +61 -0
  3. data/README.md +7 -9
  4. data/Rakefile +5 -6
  5. data/ext/pg_query/ext_symbols_freebsd.sym +1 -0
  6. data/ext/pg_query/ext_symbols_freebsd_with_ruby_abi_version.sym +2 -0
  7. data/ext/pg_query/ext_symbols_openbsd.sym +1 -0
  8. data/ext/pg_query/ext_symbols_openbsd_with_ruby_abi_version.sym +2 -0
  9. data/ext/pg_query/ext_symbols_with_ruby_abi_version.sym +2 -0
  10. data/ext/pg_query/extconf.rb +33 -9
  11. data/ext/pg_query/include/pg_query.h +28 -3
  12. data/ext/pg_query/include/pg_query_enum_defs.c +599 -167
  13. data/ext/pg_query/include/pg_query_fingerprint_conds.c +640 -520
  14. data/ext/pg_query/include/pg_query_fingerprint_defs.c +6400 -4633
  15. data/ext/pg_query/include/pg_query_outfuncs_conds.c +433 -343
  16. data/ext/pg_query/include/pg_query_outfuncs_defs.c +1472 -1152
  17. data/ext/pg_query/include/pg_query_readfuncs_conds.c +154 -124
  18. data/ext/pg_query/include/pg_query_readfuncs_defs.c +1886 -1506
  19. data/ext/pg_query/include/postgres/access/amapi.h +303 -0
  20. data/ext/pg_query/include/postgres/access/attmap.h +54 -0
  21. data/ext/pg_query/include/postgres/access/attnum.h +64 -0
  22. data/ext/pg_query/include/postgres/access/brin_internal.h +116 -0
  23. data/ext/pg_query/include/postgres/access/brin_tuple.h +112 -0
  24. data/ext/pg_query/include/postgres/access/clog.h +62 -0
  25. data/ext/pg_query/include/postgres/access/commit_ts.h +73 -0
  26. data/ext/pg_query/include/postgres/access/detoast.h +82 -0
  27. data/ext/pg_query/include/postgres/access/genam.h +246 -0
  28. data/ext/pg_query/include/postgres/access/gin.h +91 -0
  29. data/ext/pg_query/include/postgres/access/htup.h +89 -0
  30. data/ext/pg_query/include/postgres/access/htup_details.h +811 -0
  31. data/ext/pg_query/include/postgres/access/itup.h +170 -0
  32. data/ext/pg_query/include/postgres/access/parallel.h +81 -0
  33. data/ext/pg_query/include/postgres/access/printtup.h +35 -0
  34. data/ext/pg_query/include/postgres/access/relation.h +28 -0
  35. data/ext/pg_query/include/postgres/access/relscan.h +191 -0
  36. data/ext/pg_query/include/postgres/access/rmgrlist.h +49 -0
  37. data/ext/pg_query/include/postgres/access/sdir.h +67 -0
  38. data/ext/pg_query/include/postgres/access/skey.h +151 -0
  39. data/ext/pg_query/include/postgres/access/slru.h +218 -0
  40. data/ext/pg_query/include/postgres/access/stratnum.h +85 -0
  41. data/ext/pg_query/include/postgres/access/sysattr.h +29 -0
  42. data/ext/pg_query/include/postgres/access/table.h +28 -0
  43. data/ext/pg_query/include/postgres/access/tableam.h +2110 -0
  44. data/ext/pg_query/include/postgres/access/tidstore.h +50 -0
  45. data/ext/pg_query/include/postgres/access/toast_compression.h +73 -0
  46. data/ext/pg_query/include/postgres/access/transam.h +418 -0
  47. data/ext/pg_query/include/postgres/access/tsmapi.h +82 -0
  48. data/ext/pg_query/include/postgres/access/tupconvert.h +54 -0
  49. data/ext/pg_query/include/postgres/access/tupdesc.h +154 -0
  50. data/ext/pg_query/include/postgres/access/tupmacs.h +207 -0
  51. data/ext/pg_query/include/postgres/access/twophase.h +65 -0
  52. data/ext/pg_query/include/postgres/access/xact.h +530 -0
  53. data/ext/pg_query/include/postgres/access/xlog.h +310 -0
  54. data/ext/pg_query/include/postgres/access/xlog_internal.h +405 -0
  55. data/ext/pg_query/include/postgres/access/xlogbackup.h +43 -0
  56. data/ext/pg_query/include/postgres/access/xlogdefs.h +82 -0
  57. data/ext/pg_query/include/postgres/access/xlogprefetcher.h +55 -0
  58. data/ext/pg_query/include/postgres/access/xlogreader.h +444 -0
  59. data/ext/pg_query/include/postgres/access/xlogrecord.h +248 -0
  60. data/ext/pg_query/include/postgres/access/xlogrecovery.h +158 -0
  61. data/ext/pg_query/include/postgres/archive/archive_module.h +67 -0
  62. data/ext/pg_query/include/postgres/c.h +1374 -0
  63. data/ext/pg_query/include/postgres/catalog/catalog.h +47 -0
  64. data/ext/pg_query/include/postgres/catalog/catversion.h +62 -0
  65. data/ext/pg_query/include/postgres/catalog/dependency.h +228 -0
  66. data/ext/pg_query/include/postgres/catalog/genbki.h +149 -0
  67. data/ext/pg_query/include/postgres/catalog/index.h +218 -0
  68. data/ext/pg_query/include/postgres/catalog/indexing.h +54 -0
  69. data/ext/pg_query/include/postgres/catalog/namespace.h +189 -0
  70. data/ext/pg_query/include/postgres/catalog/objectaccess.h +267 -0
  71. data/ext/pg_query/include/postgres/catalog/objectaddress.h +93 -0
  72. data/ext/pg_query/include/postgres/catalog/pg_aggregate.h +182 -0
  73. data/ext/pg_query/include/postgres/catalog/pg_aggregate_d.h +78 -0
  74. data/ext/pg_query/include/postgres/catalog/pg_am.h +66 -0
  75. data/ext/pg_query/include/postgres/catalog/pg_am_d.h +47 -0
  76. data/ext/pg_query/include/postgres/catalog/pg_attribute.h +240 -0
  77. data/ext/pg_query/include/postgres/catalog/pg_attribute_d.h +62 -0
  78. data/ext/pg_query/include/postgres/catalog/pg_authid.h +66 -0
  79. data/ext/pg_query/include/postgres/catalog/pg_authid_d.h +60 -0
  80. data/ext/pg_query/include/postgres/catalog/pg_class.h +235 -0
  81. data/ext/pg_query/include/postgres/catalog/pg_class_d.h +134 -0
  82. data/ext/pg_query/include/postgres/catalog/pg_collation.h +106 -0
  83. data/ext/pg_query/include/postgres/catalog/pg_collation_d.h +66 -0
  84. data/ext/pg_query/include/postgres/catalog/pg_constraint.h +278 -0
  85. data/ext/pg_query/include/postgres/catalog/pg_constraint_d.h +74 -0
  86. data/ext/pg_query/include/postgres/catalog/pg_control.h +260 -0
  87. data/ext/pg_query/include/postgres/catalog/pg_conversion.h +79 -0
  88. data/ext/pg_query/include/postgres/catalog/pg_conversion_d.h +38 -0
  89. data/ext/pg_query/include/postgres/catalog/pg_database.h +129 -0
  90. data/ext/pg_query/include/postgres/catalog/pg_database_d.h +53 -0
  91. data/ext/pg_query/include/postgres/catalog/pg_depend.h +77 -0
  92. data/ext/pg_query/include/postgres/catalog/pg_depend_d.h +36 -0
  93. data/ext/pg_query/include/postgres/catalog/pg_event_trigger.h +60 -0
  94. data/ext/pg_query/include/postgres/catalog/pg_event_trigger_d.h +36 -0
  95. data/ext/pg_query/include/postgres/catalog/pg_index.h +92 -0
  96. data/ext/pg_query/include/postgres/catalog/pg_index_d.h +59 -0
  97. data/ext/pg_query/include/postgres/catalog/pg_language.h +75 -0
  98. data/ext/pg_query/include/postgres/catalog/pg_language_d.h +41 -0
  99. data/ext/pg_query/include/postgres/catalog/pg_namespace.h +67 -0
  100. data/ext/pg_query/include/postgres/catalog/pg_namespace_d.h +36 -0
  101. data/ext/pg_query/include/postgres/catalog/pg_opclass.h +91 -0
  102. data/ext/pg_query/include/postgres/catalog/pg_opclass_d.h +51 -0
  103. data/ext/pg_query/include/postgres/catalog/pg_operator.h +124 -0
  104. data/ext/pg_query/include/postgres/catalog/pg_operator_d.h +142 -0
  105. data/ext/pg_query/include/postgres/catalog/pg_opfamily.h +67 -0
  106. data/ext/pg_query/include/postgres/catalog/pg_opfamily_d.h +51 -0
  107. data/ext/pg_query/include/postgres/catalog/pg_partitioned_table.h +76 -0
  108. data/ext/pg_query/include/postgres/catalog/pg_partitioned_table_d.h +36 -0
  109. data/ext/pg_query/include/postgres/catalog/pg_proc.h +223 -0
  110. data/ext/pg_query/include/postgres/catalog/pg_proc_d.h +101 -0
  111. data/ext/pg_query/include/postgres/catalog/pg_publication.h +161 -0
  112. data/ext/pg_query/include/postgres/catalog/pg_publication_d.h +38 -0
  113. data/ext/pg_query/include/postgres/catalog/pg_replication_origin.h +65 -0
  114. data/ext/pg_query/include/postgres/catalog/pg_replication_origin_d.h +33 -0
  115. data/ext/pg_query/include/postgres/catalog/pg_statistic.h +288 -0
  116. data/ext/pg_query/include/postgres/catalog/pg_statistic_d.h +199 -0
  117. data/ext/pg_query/include/postgres/catalog/pg_statistic_ext.h +91 -0
  118. data/ext/pg_query/include/postgres/catalog/pg_statistic_ext_d.h +45 -0
  119. data/ext/pg_query/include/postgres/catalog/pg_transform.h +51 -0
  120. data/ext/pg_query/include/postgres/catalog/pg_transform_d.h +34 -0
  121. data/ext/pg_query/include/postgres/catalog/pg_trigger.h +153 -0
  122. data/ext/pg_query/include/postgres/catalog/pg_trigger_d.h +109 -0
  123. data/ext/pg_query/include/postgres/catalog/pg_ts_config.h +56 -0
  124. data/ext/pg_query/include/postgres/catalog/pg_ts_config_d.h +34 -0
  125. data/ext/pg_query/include/postgres/catalog/pg_ts_dict.h +62 -0
  126. data/ext/pg_query/include/postgres/catalog/pg_ts_dict_d.h +35 -0
  127. data/ext/pg_query/include/postgres/catalog/pg_ts_parser.h +63 -0
  128. data/ext/pg_query/include/postgres/catalog/pg_ts_parser_d.h +37 -0
  129. data/ext/pg_query/include/postgres/catalog/pg_ts_template.h +54 -0
  130. data/ext/pg_query/include/postgres/catalog/pg_ts_template_d.h +34 -0
  131. data/ext/pg_query/include/postgres/catalog/pg_type.h +407 -0
  132. data/ext/pg_query/include/postgres/catalog/pg_type_d.h +324 -0
  133. data/ext/pg_query/include/postgres/catalog/storage.h +50 -0
  134. data/ext/pg_query/include/postgres/catalog/syscache_ids.h +104 -0
  135. data/ext/pg_query/include/postgres/commands/async.h +49 -0
  136. data/ext/pg_query/include/postgres/commands/dbcommands.h +37 -0
  137. data/ext/pg_query/include/postgres/commands/defrem.h +161 -0
  138. data/ext/pg_query/include/postgres/commands/event_trigger.h +97 -0
  139. data/ext/pg_query/include/postgres/commands/explain.h +145 -0
  140. data/ext/pg_query/include/postgres/commands/prepare.h +61 -0
  141. data/ext/pg_query/include/postgres/commands/tablespace.h +69 -0
  142. data/ext/pg_query/include/postgres/commands/trigger.h +288 -0
  143. data/ext/pg_query/include/postgres/commands/user.h +43 -0
  144. data/ext/pg_query/include/postgres/commands/vacuum.h +388 -0
  145. data/ext/pg_query/include/postgres/common/cryptohash.h +39 -0
  146. data/ext/pg_query/include/postgres/common/file_perm.h +56 -0
  147. data/ext/pg_query/include/postgres/common/file_utils.h +65 -0
  148. data/ext/pg_query/include/postgres/common/hashfn.h +119 -0
  149. data/ext/pg_query/include/postgres/common/hashfn_unstable.h +407 -0
  150. data/ext/pg_query/include/postgres/common/int.h +512 -0
  151. data/ext/pg_query/include/postgres/common/keywords.h +29 -0
  152. data/ext/pg_query/include/postgres/common/kwlookup.h +44 -0
  153. data/ext/pg_query/include/postgres/common/pg_prng.h +62 -0
  154. data/ext/pg_query/include/postgres/common/relpath.h +97 -0
  155. data/ext/pg_query/include/postgres/common/scram-common.h +70 -0
  156. data/ext/pg_query/include/postgres/common/sha2.h +32 -0
  157. data/ext/pg_query/include/postgres/common/string.h +44 -0
  158. data/ext/pg_query/include/postgres/common/unicode_east_asian_fw_table.h +124 -0
  159. data/ext/pg_query/include/postgres/common/unicode_nonspacing_table.h +326 -0
  160. data/ext/pg_query/include/postgres/copyfuncs.funcs.c +5261 -0
  161. data/ext/pg_query/include/postgres/copyfuncs.switch.c +989 -0
  162. data/ext/pg_query/include/postgres/datatype/timestamp.h +269 -0
  163. data/ext/pg_query/include/postgres/equalfuncs.funcs.c +3310 -0
  164. data/ext/pg_query/include/postgres/equalfuncs.switch.c +836 -0
  165. data/ext/pg_query/include/postgres/executor/execdesc.h +70 -0
  166. data/ext/pg_query/include/postgres/executor/executor.h +681 -0
  167. data/ext/pg_query/include/postgres/executor/functions.h +56 -0
  168. data/ext/pg_query/include/postgres/executor/instrument.h +120 -0
  169. data/ext/pg_query/include/postgres/executor/spi.h +207 -0
  170. data/ext/pg_query/include/postgres/executor/tablefunc.h +67 -0
  171. data/ext/pg_query/include/postgres/executor/tuptable.h +523 -0
  172. data/ext/pg_query/include/postgres/fmgr.h +800 -0
  173. data/ext/pg_query/include/postgres/foreign/fdwapi.h +294 -0
  174. data/ext/pg_query/include/postgres/funcapi.h +360 -0
  175. data/ext/pg_query/include/postgres/gram.h +1168 -0
  176. data/ext/pg_query/include/postgres/gramparse.h +75 -0
  177. data/ext/pg_query/include/postgres/jit/jit.h +106 -0
  178. data/ext/pg_query/include/postgres/kwlist_d.h +1164 -0
  179. data/ext/pg_query/include/postgres/lib/dshash.h +130 -0
  180. data/ext/pg_query/include/postgres/lib/ilist.h +1159 -0
  181. data/ext/pg_query/include/postgres/lib/pairingheap.h +102 -0
  182. data/ext/pg_query/include/postgres/lib/simplehash.h +1206 -0
  183. data/ext/pg_query/include/postgres/lib/sort_template.h +445 -0
  184. data/ext/pg_query/include/postgres/lib/stringinfo.h +243 -0
  185. data/ext/pg_query/include/postgres/libpq/auth.h +37 -0
  186. data/ext/pg_query/include/postgres/libpq/crypt.h +47 -0
  187. data/ext/pg_query/include/postgres/libpq/hba.h +186 -0
  188. data/ext/pg_query/include/postgres/libpq/libpq-be.h +361 -0
  189. data/ext/pg_query/include/postgres/libpq/libpq.h +143 -0
  190. data/ext/pg_query/include/postgres/libpq/pqcomm.h +169 -0
  191. data/ext/pg_query/include/postgres/libpq/pqformat.h +209 -0
  192. data/ext/pg_query/include/postgres/libpq/pqsignal.h +54 -0
  193. data/ext/pg_query/include/postgres/libpq/protocol.h +89 -0
  194. data/ext/pg_query/include/postgres/libpq/sasl.h +136 -0
  195. data/ext/pg_query/include/postgres/libpq/scram.h +37 -0
  196. data/ext/pg_query/include/postgres/mb/pg_wchar.h +793 -0
  197. data/ext/pg_query/include/postgres/mb/stringinfo_mb.h +24 -0
  198. data/ext/pg_query/include/postgres/miscadmin.h +527 -0
  199. data/ext/pg_query/include/postgres/nodes/bitmapset.h +140 -0
  200. data/ext/pg_query/include/postgres/nodes/execnodes.h +2855 -0
  201. data/ext/pg_query/include/postgres/nodes/extensible.h +164 -0
  202. data/ext/pg_query/include/postgres/nodes/lockoptions.h +61 -0
  203. data/ext/pg_query/include/postgres/nodes/makefuncs.h +127 -0
  204. data/ext/pg_query/include/postgres/nodes/memnodes.h +152 -0
  205. data/ext/pg_query/include/postgres/nodes/miscnodes.h +56 -0
  206. data/ext/pg_query/include/postgres/nodes/nodeFuncs.h +222 -0
  207. data/ext/pg_query/include/postgres/nodes/nodes.h +435 -0
  208. data/ext/pg_query/include/postgres/nodes/nodetags.h +491 -0
  209. data/ext/pg_query/include/postgres/nodes/params.h +170 -0
  210. data/ext/pg_query/include/postgres/nodes/parsenodes.h +4233 -0
  211. data/ext/pg_query/include/postgres/nodes/pathnodes.h +3438 -0
  212. data/ext/pg_query/include/postgres/nodes/pg_list.h +686 -0
  213. data/ext/pg_query/include/postgres/nodes/plannodes.h +1593 -0
  214. data/ext/pg_query/include/postgres/nodes/primnodes.h +2339 -0
  215. data/ext/pg_query/include/postgres/nodes/print.h +34 -0
  216. data/ext/pg_query/include/postgres/nodes/queryjumble.h +86 -0
  217. data/ext/pg_query/include/postgres/nodes/replnodes.h +132 -0
  218. data/ext/pg_query/include/postgres/nodes/supportnodes.h +346 -0
  219. data/ext/pg_query/include/postgres/nodes/tidbitmap.h +75 -0
  220. data/ext/pg_query/include/postgres/nodes/value.h +90 -0
  221. data/ext/pg_query/include/postgres/optimizer/cost.h +216 -0
  222. data/ext/pg_query/include/postgres/optimizer/geqo.h +90 -0
  223. data/ext/pg_query/include/postgres/optimizer/geqo_gene.h +45 -0
  224. data/ext/pg_query/include/postgres/optimizer/optimizer.h +205 -0
  225. data/ext/pg_query/include/postgres/optimizer/paths.h +271 -0
  226. data/ext/pg_query/include/postgres/optimizer/planmain.h +123 -0
  227. data/ext/pg_query/include/postgres/parser/analyze.h +66 -0
  228. data/ext/pg_query/include/postgres/parser/kwlist.h +518 -0
  229. data/ext/pg_query/include/postgres/parser/parse_agg.h +65 -0
  230. data/ext/pg_query/include/postgres/parser/parse_coerce.h +105 -0
  231. data/ext/pg_query/include/postgres/parser/parse_expr.h +25 -0
  232. data/ext/pg_query/include/postgres/parser/parse_func.h +74 -0
  233. data/ext/pg_query/include/postgres/parser/parse_node.h +358 -0
  234. data/ext/pg_query/include/postgres/parser/parse_oper.h +68 -0
  235. data/ext/pg_query/include/postgres/parser/parse_relation.h +129 -0
  236. data/ext/pg_query/include/postgres/parser/parse_type.h +61 -0
  237. data/ext/pg_query/include/postgres/parser/parser.h +68 -0
  238. data/ext/pg_query/include/postgres/parser/parsetree.h +61 -0
  239. data/ext/pg_query/include/postgres/parser/scanner.h +152 -0
  240. data/ext/pg_query/include/postgres/parser/scansup.h +27 -0
  241. data/ext/pg_query/include/postgres/partitioning/partdefs.h +26 -0
  242. data/ext/pg_query/include/postgres/pg_config.h +985 -0
  243. data/ext/pg_query/include/postgres/pg_config_manual.h +385 -0
  244. data/ext/pg_query/include/postgres/pg_config_os.h +8 -0
  245. data/ext/pg_query/include/postgres/pg_getopt.h +56 -0
  246. data/ext/pg_query/include/postgres/pg_trace.h +17 -0
  247. data/ext/pg_query/include/postgres/pgstat.h +780 -0
  248. data/ext/pg_query/include/postgres/pgtime.h +94 -0
  249. data/ext/pg_query/include/postgres/pl_gram.h +385 -0
  250. data/ext/pg_query/include/postgres/pl_reserved_kwlist.h +52 -0
  251. data/ext/pg_query/include/postgres/pl_reserved_kwlist_d.h +114 -0
  252. data/ext/pg_query/include/postgres/pl_unreserved_kwlist.h +112 -0
  253. data/ext/pg_query/include/postgres/pl_unreserved_kwlist_d.h +246 -0
  254. data/ext/pg_query/include/postgres/plerrcodes.h +998 -0
  255. data/ext/pg_query/include/postgres/plpgsql.h +1342 -0
  256. data/ext/pg_query/include/postgres/port/atomics/arch-arm.h +32 -0
  257. data/ext/pg_query/include/postgres/port/atomics/arch-hppa.h +17 -0
  258. data/ext/pg_query/include/postgres/port/atomics/arch-ppc.h +256 -0
  259. data/ext/pg_query/include/postgres/port/atomics/arch-x86.h +254 -0
  260. data/ext/pg_query/include/postgres/port/atomics/fallback.h +170 -0
  261. data/ext/pg_query/include/postgres/port/atomics/generic-gcc.h +323 -0
  262. data/ext/pg_query/include/postgres/port/atomics/generic-msvc.h +119 -0
  263. data/ext/pg_query/include/postgres/port/atomics/generic-sunpro.h +121 -0
  264. data/ext/pg_query/include/postgres/port/atomics/generic.h +437 -0
  265. data/ext/pg_query/include/postgres/port/atomics.h +606 -0
  266. data/ext/pg_query/include/postgres/port/pg_bitutils.h +421 -0
  267. data/ext/pg_query/include/postgres/port/pg_bswap.h +161 -0
  268. data/ext/pg_query/include/postgres/port/pg_crc32c.h +110 -0
  269. data/ext/pg_query/include/postgres/port/pg_iovec.h +117 -0
  270. data/ext/pg_query/include/postgres/port/simd.h +422 -0
  271. data/ext/pg_query/include/postgres/port/win32/arpa/inet.h +3 -0
  272. data/ext/pg_query/include/postgres/port/win32/dlfcn.h +1 -0
  273. data/ext/pg_query/include/postgres/port/win32/grp.h +1 -0
  274. data/ext/pg_query/include/postgres/port/win32/netdb.h +7 -0
  275. data/ext/pg_query/include/postgres/port/win32/netinet/in.h +3 -0
  276. data/ext/pg_query/include/postgres/port/win32/netinet/tcp.h +7 -0
  277. data/ext/pg_query/include/postgres/port/win32/pwd.h +3 -0
  278. data/ext/pg_query/include/postgres/port/win32/sys/resource.h +20 -0
  279. data/ext/pg_query/include/postgres/port/win32/sys/select.h +3 -0
  280. data/ext/pg_query/include/postgres/port/win32/sys/socket.h +34 -0
  281. data/ext/pg_query/include/postgres/port/win32/sys/un.h +17 -0
  282. data/ext/pg_query/include/postgres/port/win32/sys/wait.h +3 -0
  283. data/ext/pg_query/include/postgres/port/win32.h +59 -0
  284. data/ext/pg_query/include/postgres/port/win32_msvc/dirent.h +34 -0
  285. data/ext/pg_query/include/postgres/port/win32_msvc/sys/file.h +1 -0
  286. data/ext/pg_query/include/postgres/port/win32_msvc/sys/param.h +1 -0
  287. data/ext/pg_query/include/postgres/port/win32_msvc/sys/time.h +1 -0
  288. data/ext/pg_query/include/postgres/port/win32_msvc/unistd.h +9 -0
  289. data/ext/pg_query/include/postgres/port/win32_msvc/utime.h +3 -0
  290. data/ext/pg_query/include/postgres/port/win32_port.h +582 -0
  291. data/ext/pg_query/include/postgres/port.h +555 -0
  292. data/ext/pg_query/include/postgres/portability/instr_time.h +197 -0
  293. data/ext/pg_query/include/postgres/postgres.h +579 -0
  294. data/ext/pg_query/include/postgres/postgres_ext.h +73 -0
  295. data/ext/pg_query/include/postgres/postmaster/autovacuum.h +69 -0
  296. data/ext/pg_query/include/postgres/postmaster/bgworker.h +164 -0
  297. data/ext/pg_query/include/postgres/postmaster/bgworker_internals.h +60 -0
  298. data/ext/pg_query/include/postgres/postmaster/bgwriter.h +45 -0
  299. data/ext/pg_query/include/postgres/postmaster/interrupt.h +32 -0
  300. data/ext/pg_query/include/postgres/postmaster/pgarch.h +36 -0
  301. data/ext/pg_query/include/postgres/postmaster/postmaster.h +101 -0
  302. data/ext/pg_query/include/postgres/postmaster/startup.h +41 -0
  303. data/ext/pg_query/include/postgres/postmaster/syslogger.h +101 -0
  304. data/ext/pg_query/include/postgres/postmaster/walsummarizer.h +35 -0
  305. data/ext/pg_query/include/postgres/postmaster/walwriter.h +23 -0
  306. data/ext/pg_query/include/postgres/regex/regex.h +272 -0
  307. data/ext/pg_query/include/postgres/replication/logicallauncher.h +34 -0
  308. data/ext/pg_query/include/postgres/replication/logicalproto.h +274 -0
  309. data/ext/pg_query/include/postgres/replication/logicalworker.h +33 -0
  310. data/ext/pg_query/include/postgres/replication/origin.h +73 -0
  311. data/ext/pg_query/include/postgres/replication/reorderbuffer.h +734 -0
  312. data/ext/pg_query/include/postgres/replication/slot.h +289 -0
  313. data/ext/pg_query/include/postgres/replication/slotsync.h +38 -0
  314. data/ext/pg_query/include/postgres/replication/syncrep.h +109 -0
  315. data/ext/pg_query/include/postgres/replication/walreceiver.h +504 -0
  316. data/ext/pg_query/include/postgres/replication/walsender.h +76 -0
  317. data/ext/pg_query/include/postgres/rewrite/prs2lock.h +46 -0
  318. data/ext/pg_query/include/postgres/rewrite/rewriteHandler.h +41 -0
  319. data/ext/pg_query/include/postgres/rewrite/rewriteManip.h +96 -0
  320. data/ext/pg_query/include/postgres/rewrite/rewriteSupport.h +26 -0
  321. data/ext/pg_query/include/postgres/storage/block.h +108 -0
  322. data/ext/pg_query/include/postgres/storage/buf.h +46 -0
  323. data/ext/pg_query/include/postgres/storage/bufmgr.h +411 -0
  324. data/ext/pg_query/include/postgres/storage/bufpage.h +510 -0
  325. data/ext/pg_query/include/postgres/storage/condition_variable.h +73 -0
  326. data/ext/pg_query/include/postgres/storage/dsm.h +61 -0
  327. data/ext/pg_query/include/postgres/storage/dsm_impl.h +79 -0
  328. data/ext/pg_query/include/postgres/storage/fd.h +219 -0
  329. data/ext/pg_query/include/postgres/storage/fileset.h +40 -0
  330. data/ext/pg_query/include/postgres/storage/ipc.h +87 -0
  331. data/ext/pg_query/include/postgres/storage/item.h +19 -0
  332. data/ext/pg_query/include/postgres/storage/itemid.h +184 -0
  333. data/ext/pg_query/include/postgres/storage/itemptr.h +245 -0
  334. data/ext/pg_query/include/postgres/storage/large_object.h +100 -0
  335. data/ext/pg_query/include/postgres/storage/latch.h +196 -0
  336. data/ext/pg_query/include/postgres/storage/lmgr.h +126 -0
  337. data/ext/pg_query/include/postgres/storage/lock.h +624 -0
  338. data/ext/pg_query/include/postgres/storage/lockdefs.h +61 -0
  339. data/ext/pg_query/include/postgres/storage/lwlock.h +228 -0
  340. data/ext/pg_query/include/postgres/storage/lwlocknames.h +47 -0
  341. data/ext/pg_query/include/postgres/storage/off.h +57 -0
  342. data/ext/pg_query/include/postgres/storage/pg_sema.h +61 -0
  343. data/ext/pg_query/include/postgres/storage/pg_shmem.h +93 -0
  344. data/ext/pg_query/include/postgres/storage/pmsignal.h +105 -0
  345. data/ext/pg_query/include/postgres/storage/predicate.h +83 -0
  346. data/ext/pg_query/include/postgres/storage/proc.h +488 -0
  347. data/ext/pg_query/include/postgres/storage/procarray.h +103 -0
  348. data/ext/pg_query/include/postgres/storage/proclist_types.h +53 -0
  349. data/ext/pg_query/include/postgres/storage/procnumber.h +43 -0
  350. data/ext/pg_query/include/postgres/storage/procsignal.h +75 -0
  351. data/ext/pg_query/include/postgres/storage/read_stream.h +65 -0
  352. data/ext/pg_query/include/postgres/storage/relfilelocator.h +100 -0
  353. data/ext/pg_query/include/postgres/storage/s_lock.h +847 -0
  354. data/ext/pg_query/include/postgres/storage/sharedfileset.h +37 -0
  355. data/ext/pg_query/include/postgres/storage/shm_mq.h +86 -0
  356. data/ext/pg_query/include/postgres/storage/shm_toc.h +58 -0
  357. data/ext/pg_query/include/postgres/storage/shmem.h +59 -0
  358. data/ext/pg_query/include/postgres/storage/sinval.h +153 -0
  359. data/ext/pg_query/include/postgres/storage/smgr.h +130 -0
  360. data/ext/pg_query/include/postgres/storage/spin.h +77 -0
  361. data/ext/pg_query/include/postgres/storage/standby.h +109 -0
  362. data/ext/pg_query/include/postgres/storage/standbydefs.h +74 -0
  363. data/ext/pg_query/include/postgres/storage/sync.h +66 -0
  364. data/ext/pg_query/include/postgres/tcop/cmdtag.h +62 -0
  365. data/ext/pg_query/include/postgres/tcop/cmdtaglist.h +219 -0
  366. data/ext/pg_query/include/postgres/tcop/deparse_utility.h +108 -0
  367. data/ext/pg_query/include/postgres/tcop/dest.h +148 -0
  368. data/ext/pg_query/include/postgres/tcop/fastpath.h +20 -0
  369. data/ext/pg_query/include/postgres/tcop/pquery.h +51 -0
  370. data/ext/pg_query/include/postgres/tcop/tcopprot.h +98 -0
  371. data/ext/pg_query/include/postgres/tcop/utility.h +112 -0
  372. data/ext/pg_query/include/postgres/tsearch/ts_cache.h +96 -0
  373. data/ext/pg_query/include/postgres/utils/acl.h +290 -0
  374. data/ext/pg_query/include/postgres/utils/aclchk_internal.h +45 -0
  375. data/ext/pg_query/include/postgres/utils/array.h +481 -0
  376. data/ext/pg_query/include/postgres/utils/ascii.h +84 -0
  377. data/ext/pg_query/include/postgres/utils/backend_progress.h +46 -0
  378. data/ext/pg_query/include/postgres/utils/backend_status.h +340 -0
  379. data/ext/pg_query/include/postgres/utils/builtins.h +139 -0
  380. data/ext/pg_query/include/postgres/utils/bytea.h +28 -0
  381. data/ext/pg_query/include/postgres/utils/catcache.h +231 -0
  382. data/ext/pg_query/include/postgres/utils/date.h +118 -0
  383. data/ext/pg_query/include/postgres/utils/datetime.h +367 -0
  384. data/ext/pg_query/include/postgres/utils/datum.h +76 -0
  385. data/ext/pg_query/include/postgres/utils/dsa.h +166 -0
  386. data/ext/pg_query/include/postgres/utils/elog.h +540 -0
  387. data/ext/pg_query/include/postgres/utils/errcodes.h +352 -0
  388. data/ext/pg_query/include/postgres/utils/expandeddatum.h +170 -0
  389. data/ext/pg_query/include/postgres/utils/expandedrecord.h +241 -0
  390. data/ext/pg_query/include/postgres/utils/float.h +357 -0
  391. data/ext/pg_query/include/postgres/utils/fmgroids.h +3347 -0
  392. data/ext/pg_query/include/postgres/utils/fmgrprotos.h +2904 -0
  393. data/ext/pg_query/include/postgres/utils/fmgrtab.h +49 -0
  394. data/ext/pg_query/include/postgres/utils/guc.h +456 -0
  395. data/ext/pg_query/include/postgres/utils/guc_hooks.h +184 -0
  396. data/ext/pg_query/include/postgres/utils/guc_tables.h +323 -0
  397. data/ext/pg_query/include/postgres/utils/hsearch.h +153 -0
  398. data/ext/pg_query/include/postgres/utils/injection_point.h +44 -0
  399. data/ext/pg_query/include/postgres/utils/inval.h +68 -0
  400. data/ext/pg_query/include/postgres/utils/logtape.h +77 -0
  401. data/ext/pg_query/include/postgres/utils/lsyscache.h +215 -0
  402. data/ext/pg_query/include/postgres/utils/memdebug.h +82 -0
  403. data/ext/pg_query/include/postgres/utils/memutils.h +193 -0
  404. data/ext/pg_query/include/postgres/utils/memutils_internal.h +176 -0
  405. data/ext/pg_query/include/postgres/utils/memutils_memorychunk.h +253 -0
  406. data/ext/pg_query/include/postgres/utils/numeric.h +110 -0
  407. data/ext/pg_query/include/postgres/utils/palloc.h +151 -0
  408. data/ext/pg_query/include/postgres/utils/partcache.h +103 -0
  409. data/ext/pg_query/include/postgres/utils/pg_locale.h +136 -0
  410. data/ext/pg_query/include/postgres/utils/pgstat_internal.h +827 -0
  411. data/ext/pg_query/include/postgres/utils/plancache.h +238 -0
  412. data/ext/pg_query/include/postgres/utils/portal.h +252 -0
  413. data/ext/pg_query/include/postgres/utils/probes.h +114 -0
  414. data/ext/pg_query/include/postgres/utils/ps_status.h +47 -0
  415. data/ext/pg_query/include/postgres/utils/queryenvironment.h +74 -0
  416. data/ext/pg_query/include/postgres/utils/regproc.h +39 -0
  417. data/ext/pg_query/include/postgres/utils/rel.h +711 -0
  418. data/ext/pg_query/include/postgres/utils/relcache.h +155 -0
  419. data/ext/pg_query/include/postgres/utils/reltrigger.h +81 -0
  420. data/ext/pg_query/include/postgres/utils/resowner.h +167 -0
  421. data/ext/pg_query/include/postgres/utils/ruleutils.h +52 -0
  422. data/ext/pg_query/include/postgres/utils/sharedtuplestore.h +61 -0
  423. data/ext/pg_query/include/postgres/utils/snapmgr.h +130 -0
  424. data/ext/pg_query/include/postgres/utils/snapshot.h +219 -0
  425. data/ext/pg_query/include/postgres/utils/sortsupport.h +391 -0
  426. data/ext/pg_query/include/postgres/utils/syscache.h +136 -0
  427. data/ext/pg_query/include/postgres/utils/timeout.h +96 -0
  428. data/ext/pg_query/include/postgres/utils/timestamp.h +147 -0
  429. data/ext/pg_query/include/postgres/utils/tuplesort.h +472 -0
  430. data/ext/pg_query/include/postgres/utils/tuplestore.h +88 -0
  431. data/ext/pg_query/include/postgres/utils/typcache.h +210 -0
  432. data/ext/pg_query/include/postgres/utils/varlena.h +53 -0
  433. data/ext/pg_query/include/postgres/utils/wait_event.h +108 -0
  434. data/ext/pg_query/include/postgres/utils/wait_event_types.h +218 -0
  435. data/ext/pg_query/include/postgres/utils/xml.h +94 -0
  436. data/ext/pg_query/include/postgres/varatt.h +358 -0
  437. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +7723 -6368
  438. data/ext/pg_query/include/protobuf/pg_query.pb.h +120022 -87031
  439. data/ext/pg_query/pg_query.c +10 -1
  440. data/ext/pg_query/pg_query.pb-c.c +22595 -17738
  441. data/ext/pg_query/pg_query_deparse.c +1 -10635
  442. data/ext/pg_query/pg_query_fingerprint.c +12 -8
  443. data/ext/pg_query/pg_query_fingerprint.h +1 -1
  444. data/ext/pg_query/pg_query_internal.h +1 -1
  445. data/ext/pg_query/pg_query_json_plpgsql.c +1 -0
  446. data/ext/pg_query/pg_query_normalize.c +43 -2
  447. data/ext/pg_query/pg_query_outfuncs_json.c +9 -1
  448. data/ext/pg_query/pg_query_outfuncs_protobuf.c +3 -2
  449. data/ext/pg_query/pg_query_parse.c +47 -5
  450. data/ext/pg_query/pg_query_parse_plpgsql.c +19 -18
  451. data/ext/pg_query/pg_query_readfuncs_protobuf.c +3 -2
  452. data/ext/pg_query/pg_query_ruby.c +5 -0
  453. data/ext/pg_query/pg_query_scan.c +2 -2
  454. data/ext/pg_query/pg_query_split.c +3 -3
  455. data/ext/pg_query/postgres_deparse.c +11496 -0
  456. data/ext/pg_query/postgres_deparse.h +9 -0
  457. data/ext/pg_query/src_backend_catalog_namespace.c +243 -63
  458. data/ext/pg_query/src_backend_catalog_pg_proc.c +1 -3
  459. data/ext/pg_query/src_backend_commands_define.c +2 -3
  460. data/ext/pg_query/src_backend_nodes_bitmapset.c +140 -156
  461. data/ext/pg_query/src_backend_nodes_copyfuncs.c +96 -6202
  462. data/ext/pg_query/src_backend_nodes_equalfuncs.c +95 -4068
  463. data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
  464. data/ext/pg_query/src_backend_nodes_list.c +16 -8
  465. data/ext/pg_query/src_backend_nodes_makefuncs.c +134 -1
  466. data/ext/pg_query/src_backend_nodes_nodeFuncs.c +391 -133
  467. data/ext/pg_query/src_backend_nodes_value.c +1 -1
  468. data/ext/pg_query/src_backend_parser_gram.c +43710 -39953
  469. data/ext/pg_query/src_backend_parser_parser.c +34 -8
  470. data/ext/pg_query/src_backend_parser_scan.c +6971 -3373
  471. data/ext/pg_query/src_backend_parser_scansup.c +2 -1
  472. data/ext/pg_query/src_backend_storage_ipc_ipc.c +1 -1
  473. data/ext/pg_query/src_backend_tcop_postgres.c +99 -96
  474. data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +2 -2
  475. data/ext/pg_query/src_backend_utils_adt_datum.c +2 -2
  476. data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
  477. data/ext/pg_query/src_backend_utils_adt_format_type.c +1 -1
  478. data/ext/pg_query/src_backend_utils_adt_numutils.c +488 -0
  479. data/ext/pg_query/src_backend_utils_adt_ruleutils.c +177 -30
  480. data/ext/pg_query/src_backend_utils_error_assert.c +4 -7
  481. data/ext/pg_query/src_backend_utils_error_elog.c +397 -270
  482. data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +36 -2
  483. data/ext/pg_query/src_backend_utils_init_globals.c +20 -5
  484. data/ext/pg_query/src_backend_utils_mb_mbutils.c +31 -84
  485. data/ext/pg_query/src_backend_utils_misc_guc_tables.c +502 -0
  486. data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +166 -0
  487. data/ext/pg_query/src_backend_utils_mmgr_aset.c +704 -497
  488. data/ext/pg_query/src_backend_utils_mmgr_bump.c +728 -0
  489. data/ext/pg_query/src_backend_utils_mmgr_generation.c +1115 -0
  490. data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +637 -233
  491. data/ext/pg_query/src_backend_utils_mmgr_slab.c +1079 -0
  492. data/ext/pg_query/src_common_encnames.c +46 -44
  493. data/ext/pg_query/src_common_hashfn.c +1 -1
  494. data/ext/pg_query/src_common_keywords.c +1 -1
  495. data/ext/pg_query/src_common_kwlist_d.h +586 -517
  496. data/ext/pg_query/src_common_kwlookup.c +1 -1
  497. data/ext/pg_query/src_common_psprintf.c +3 -3
  498. data/ext/pg_query/src_common_stringinfo.c +21 -4
  499. data/ext/pg_query/src_common_wchar.c +100 -116
  500. data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +99 -5
  501. data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -1
  502. data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +829 -763
  503. data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
  504. data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +1 -1
  505. data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +19 -1
  506. data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +48 -46
  507. data/ext/pg_query/src_port_pg_bitutils.c +251 -32
  508. data/ext/pg_query/src_port_pgstrcasecmp.c +57 -1
  509. data/ext/pg_query/src_port_snprintf.c +20 -27
  510. data/ext/pg_query/src_port_strerror.c +1 -3
  511. data/ext/pg_query/src_port_strlcpy.c +79 -0
  512. data/lib/pg_query/fingerprint.rb +5 -8
  513. data/lib/pg_query/node.rb +16 -11
  514. data/lib/pg_query/param_refs.rb +2 -2
  515. data/lib/pg_query/parse.rb +6 -8
  516. data/lib/pg_query/parse_error.rb +1 -0
  517. data/lib/pg_query/pg_query_pb.rb +173 -3196
  518. data/lib/pg_query/scan.rb +1 -0
  519. data/lib/pg_query/treewalker.rb +52 -11
  520. data/lib/pg_query/truncate.rb +18 -20
  521. data/lib/pg_query/version.rb +1 -1
  522. metadata +443 -442
  523. data/ext/pg_query/guc-file.c +0 -0
  524. data/ext/pg_query/include/access/amapi.h +0 -290
  525. data/ext/pg_query/include/access/attmap.h +0 -52
  526. data/ext/pg_query/include/access/attnum.h +0 -64
  527. data/ext/pg_query/include/access/clog.h +0 -63
  528. data/ext/pg_query/include/access/commit_ts.h +0 -74
  529. data/ext/pg_query/include/access/detoast.h +0 -82
  530. data/ext/pg_query/include/access/genam.h +0 -231
  531. data/ext/pg_query/include/access/gin.h +0 -78
  532. data/ext/pg_query/include/access/htup.h +0 -89
  533. data/ext/pg_query/include/access/htup_details.h +0 -807
  534. data/ext/pg_query/include/access/itup.h +0 -167
  535. data/ext/pg_query/include/access/parallel.h +0 -82
  536. data/ext/pg_query/include/access/printtup.h +0 -35
  537. data/ext/pg_query/include/access/relation.h +0 -28
  538. data/ext/pg_query/include/access/relscan.h +0 -191
  539. data/ext/pg_query/include/access/rmgrlist.h +0 -49
  540. data/ext/pg_query/include/access/sdir.h +0 -58
  541. data/ext/pg_query/include/access/skey.h +0 -151
  542. data/ext/pg_query/include/access/stratnum.h +0 -85
  543. data/ext/pg_query/include/access/sysattr.h +0 -29
  544. data/ext/pg_query/include/access/table.h +0 -28
  545. data/ext/pg_query/include/access/tableam.h +0 -2077
  546. data/ext/pg_query/include/access/toast_compression.h +0 -73
  547. data/ext/pg_query/include/access/transam.h +0 -375
  548. data/ext/pg_query/include/access/tupconvert.h +0 -51
  549. data/ext/pg_query/include/access/tupdesc.h +0 -154
  550. data/ext/pg_query/include/access/tupmacs.h +0 -247
  551. data/ext/pg_query/include/access/twophase.h +0 -65
  552. data/ext/pg_query/include/access/xact.h +0 -523
  553. data/ext/pg_query/include/access/xlog.h +0 -303
  554. data/ext/pg_query/include/access/xlog_internal.h +0 -366
  555. data/ext/pg_query/include/access/xlogdefs.h +0 -101
  556. data/ext/pg_query/include/access/xlogprefetcher.h +0 -55
  557. data/ext/pg_query/include/access/xlogreader.h +0 -443
  558. data/ext/pg_query/include/access/xlogrecord.h +0 -236
  559. data/ext/pg_query/include/access/xlogrecovery.h +0 -157
  560. data/ext/pg_query/include/c.h +0 -1391
  561. data/ext/pg_query/include/catalog/catalog.h +0 -44
  562. data/ext/pg_query/include/catalog/catversion.h +0 -58
  563. data/ext/pg_query/include/catalog/dependency.h +0 -269
  564. data/ext/pg_query/include/catalog/genbki.h +0 -142
  565. data/ext/pg_query/include/catalog/index.h +0 -214
  566. data/ext/pg_query/include/catalog/indexing.h +0 -54
  567. data/ext/pg_query/include/catalog/namespace.h +0 -190
  568. data/ext/pg_query/include/catalog/objectaccess.h +0 -265
  569. data/ext/pg_query/include/catalog/objectaddress.h +0 -89
  570. data/ext/pg_query/include/catalog/pg_aggregate.h +0 -180
  571. data/ext/pg_query/include/catalog/pg_aggregate_d.h +0 -78
  572. data/ext/pg_query/include/catalog/pg_am.h +0 -63
  573. data/ext/pg_query/include/catalog/pg_am_d.h +0 -47
  574. data/ext/pg_query/include/catalog/pg_attribute.h +0 -221
  575. data/ext/pg_query/include/catalog/pg_attribute_d.h +0 -62
  576. data/ext/pg_query/include/catalog/pg_authid.h +0 -63
  577. data/ext/pg_query/include/catalog/pg_authid_d.h +0 -57
  578. data/ext/pg_query/include/catalog/pg_class.h +0 -230
  579. data/ext/pg_query/include/catalog/pg_class_d.h +0 -132
  580. data/ext/pg_query/include/catalog/pg_collation.h +0 -98
  581. data/ext/pg_query/include/catalog/pg_collation_d.h +0 -62
  582. data/ext/pg_query/include/catalog/pg_constraint.h +0 -273
  583. data/ext/pg_query/include/catalog/pg_constraint_d.h +0 -73
  584. data/ext/pg_query/include/catalog/pg_control.h +0 -250
  585. data/ext/pg_query/include/catalog/pg_conversion.h +0 -75
  586. data/ext/pg_query/include/catalog/pg_conversion_d.h +0 -38
  587. data/ext/pg_query/include/catalog/pg_depend.h +0 -77
  588. data/ext/pg_query/include/catalog/pg_depend_d.h +0 -36
  589. data/ext/pg_query/include/catalog/pg_event_trigger.h +0 -57
  590. data/ext/pg_query/include/catalog/pg_event_trigger_d.h +0 -36
  591. data/ext/pg_query/include/catalog/pg_index.h +0 -90
  592. data/ext/pg_query/include/catalog/pg_index_d.h +0 -59
  593. data/ext/pg_query/include/catalog/pg_language.h +0 -72
  594. data/ext/pg_query/include/catalog/pg_language_d.h +0 -41
  595. data/ext/pg_query/include/catalog/pg_namespace.h +0 -64
  596. data/ext/pg_query/include/catalog/pg_namespace_d.h +0 -36
  597. data/ext/pg_query/include/catalog/pg_opclass.h +0 -88
  598. data/ext/pg_query/include/catalog/pg_opclass_d.h +0 -51
  599. data/ext/pg_query/include/catalog/pg_operator.h +0 -107
  600. data/ext/pg_query/include/catalog/pg_operator_d.h +0 -142
  601. data/ext/pg_query/include/catalog/pg_opfamily.h +0 -63
  602. data/ext/pg_query/include/catalog/pg_opfamily_d.h +0 -49
  603. data/ext/pg_query/include/catalog/pg_parameter_acl.h +0 -60
  604. data/ext/pg_query/include/catalog/pg_parameter_acl_d.h +0 -34
  605. data/ext/pg_query/include/catalog/pg_partitioned_table.h +0 -74
  606. data/ext/pg_query/include/catalog/pg_partitioned_table_d.h +0 -36
  607. data/ext/pg_query/include/catalog/pg_proc.h +0 -220
  608. data/ext/pg_query/include/catalog/pg_proc_d.h +0 -101
  609. data/ext/pg_query/include/catalog/pg_publication.h +0 -161
  610. data/ext/pg_query/include/catalog/pg_publication_d.h +0 -38
  611. data/ext/pg_query/include/catalog/pg_replication_origin.h +0 -62
  612. data/ext/pg_query/include/catalog/pg_replication_origin_d.h +0 -33
  613. data/ext/pg_query/include/catalog/pg_statistic.h +0 -282
  614. data/ext/pg_query/include/catalog/pg_statistic_d.h +0 -195
  615. data/ext/pg_query/include/catalog/pg_statistic_ext.h +0 -88
  616. data/ext/pg_query/include/catalog/pg_statistic_ext_d.h +0 -45
  617. data/ext/pg_query/include/catalog/pg_transform.h +0 -48
  618. data/ext/pg_query/include/catalog/pg_transform_d.h +0 -34
  619. data/ext/pg_query/include/catalog/pg_trigger.h +0 -153
  620. data/ext/pg_query/include/catalog/pg_trigger_d.h +0 -109
  621. data/ext/pg_query/include/catalog/pg_ts_config.h +0 -53
  622. data/ext/pg_query/include/catalog/pg_ts_config_d.h +0 -34
  623. data/ext/pg_query/include/catalog/pg_ts_dict.h +0 -59
  624. data/ext/pg_query/include/catalog/pg_ts_dict_d.h +0 -35
  625. data/ext/pg_query/include/catalog/pg_ts_parser.h +0 -60
  626. data/ext/pg_query/include/catalog/pg_ts_parser_d.h +0 -37
  627. data/ext/pg_query/include/catalog/pg_ts_template.h +0 -51
  628. data/ext/pg_query/include/catalog/pg_ts_template_d.h +0 -34
  629. data/ext/pg_query/include/catalog/pg_type.h +0 -404
  630. data/ext/pg_query/include/catalog/pg_type_d.h +0 -324
  631. data/ext/pg_query/include/catalog/storage.h +0 -50
  632. data/ext/pg_query/include/commands/async.h +0 -53
  633. data/ext/pg_query/include/commands/dbcommands.h +0 -36
  634. data/ext/pg_query/include/commands/defrem.h +0 -160
  635. data/ext/pg_query/include/commands/event_trigger.h +0 -88
  636. data/ext/pg_query/include/commands/explain.h +0 -127
  637. data/ext/pg_query/include/commands/prepare.h +0 -61
  638. data/ext/pg_query/include/commands/tablespace.h +0 -69
  639. data/ext/pg_query/include/commands/trigger.h +0 -287
  640. data/ext/pg_query/include/commands/user.h +0 -37
  641. data/ext/pg_query/include/commands/vacuum.h +0 -340
  642. data/ext/pg_query/include/commands/variable.h +0 -38
  643. data/ext/pg_query/include/common/file_perm.h +0 -56
  644. data/ext/pg_query/include/common/hashfn.h +0 -104
  645. data/ext/pg_query/include/common/ip.h +0 -31
  646. data/ext/pg_query/include/common/keywords.h +0 -29
  647. data/ext/pg_query/include/common/kwlookup.h +0 -44
  648. data/ext/pg_query/include/common/pg_prng.h +0 -60
  649. data/ext/pg_query/include/common/relpath.h +0 -90
  650. data/ext/pg_query/include/common/string.h +0 -42
  651. data/ext/pg_query/include/common/unicode_combining_table.h +0 -308
  652. data/ext/pg_query/include/common/unicode_east_asian_fw_table.h +0 -125
  653. data/ext/pg_query/include/datatype/timestamp.h +0 -236
  654. data/ext/pg_query/include/executor/execdesc.h +0 -70
  655. data/ext/pg_query/include/executor/executor.h +0 -663
  656. data/ext/pg_query/include/executor/functions.h +0 -55
  657. data/ext/pg_query/include/executor/instrument.h +0 -118
  658. data/ext/pg_query/include/executor/spi.h +0 -213
  659. data/ext/pg_query/include/executor/tablefunc.h +0 -67
  660. data/ext/pg_query/include/executor/tuptable.h +0 -487
  661. data/ext/pg_query/include/fmgr.h +0 -781
  662. data/ext/pg_query/include/funcapi.h +0 -360
  663. data/ext/pg_query/include/getaddrinfo.h +0 -162
  664. data/ext/pg_query/include/jit/jit.h +0 -105
  665. data/ext/pg_query/include/kwlist_d.h +0 -1095
  666. data/ext/pg_query/include/lib/dshash.h +0 -112
  667. data/ext/pg_query/include/lib/ilist.h +0 -746
  668. data/ext/pg_query/include/lib/pairingheap.h +0 -102
  669. data/ext/pg_query/include/lib/simplehash.h +0 -1184
  670. data/ext/pg_query/include/lib/sort_template.h +0 -432
  671. data/ext/pg_query/include/lib/stringinfo.h +0 -161
  672. data/ext/pg_query/include/libpq/auth.h +0 -31
  673. data/ext/pg_query/include/libpq/crypt.h +0 -47
  674. data/ext/pg_query/include/libpq/hba.h +0 -179
  675. data/ext/pg_query/include/libpq/libpq-be.h +0 -343
  676. data/ext/pg_query/include/libpq/libpq.h +0 -144
  677. data/ext/pg_query/include/libpq/pqcomm.h +0 -194
  678. data/ext/pg_query/include/libpq/pqformat.h +0 -210
  679. data/ext/pg_query/include/libpq/pqsignal.h +0 -42
  680. data/ext/pg_query/include/mb/pg_wchar.h +0 -755
  681. data/ext/pg_query/include/mb/stringinfo_mb.h +0 -24
  682. data/ext/pg_query/include/miscadmin.h +0 -495
  683. data/ext/pg_query/include/nodes/bitmapset.h +0 -122
  684. data/ext/pg_query/include/nodes/execnodes.h +0 -2715
  685. data/ext/pg_query/include/nodes/extensible.h +0 -162
  686. data/ext/pg_query/include/nodes/lockoptions.h +0 -61
  687. data/ext/pg_query/include/nodes/makefuncs.h +0 -109
  688. data/ext/pg_query/include/nodes/memnodes.h +0 -110
  689. data/ext/pg_query/include/nodes/nodeFuncs.h +0 -162
  690. data/ext/pg_query/include/nodes/nodes.h +0 -861
  691. data/ext/pg_query/include/nodes/params.h +0 -170
  692. data/ext/pg_query/include/nodes/parsenodes.h +0 -3812
  693. data/ext/pg_query/include/nodes/pathnodes.h +0 -2734
  694. data/ext/pg_query/include/nodes/pg_list.h +0 -612
  695. data/ext/pg_query/include/nodes/plannodes.h +0 -1349
  696. data/ext/pg_query/include/nodes/primnodes.h +0 -1593
  697. data/ext/pg_query/include/nodes/print.h +0 -34
  698. data/ext/pg_query/include/nodes/tidbitmap.h +0 -75
  699. data/ext/pg_query/include/nodes/value.h +0 -80
  700. data/ext/pg_query/include/optimizer/cost.h +0 -213
  701. data/ext/pg_query/include/optimizer/geqo.h +0 -90
  702. data/ext/pg_query/include/optimizer/geqo_gene.h +0 -45
  703. data/ext/pg_query/include/optimizer/optimizer.h +0 -202
  704. data/ext/pg_query/include/optimizer/paths.h +0 -257
  705. data/ext/pg_query/include/optimizer/planmain.h +0 -120
  706. data/ext/pg_query/include/parser/analyze.h +0 -63
  707. data/ext/pg_query/include/parser/gram.h +0 -1101
  708. data/ext/pg_query/include/parser/gramparse.h +0 -75
  709. data/ext/pg_query/include/parser/kwlist.h +0 -487
  710. data/ext/pg_query/include/parser/parse_agg.h +0 -63
  711. data/ext/pg_query/include/parser/parse_coerce.h +0 -100
  712. data/ext/pg_query/include/parser/parse_expr.h +0 -25
  713. data/ext/pg_query/include/parser/parse_func.h +0 -74
  714. data/ext/pg_query/include/parser/parse_node.h +0 -339
  715. data/ext/pg_query/include/parser/parse_oper.h +0 -65
  716. data/ext/pg_query/include/parser/parse_relation.h +0 -124
  717. data/ext/pg_query/include/parser/parse_type.h +0 -60
  718. data/ext/pg_query/include/parser/parser.h +0 -68
  719. data/ext/pg_query/include/parser/parsetree.h +0 -61
  720. data/ext/pg_query/include/parser/scanner.h +0 -152
  721. data/ext/pg_query/include/parser/scansup.h +0 -27
  722. data/ext/pg_query/include/partitioning/partdefs.h +0 -26
  723. data/ext/pg_query/include/pg_config.h +0 -1037
  724. data/ext/pg_query/include/pg_config_manual.h +0 -410
  725. data/ext/pg_query/include/pg_config_os.h +0 -8
  726. data/ext/pg_query/include/pg_getopt.h +0 -56
  727. data/ext/pg_query/include/pg_trace.h +0 -17
  728. data/ext/pg_query/include/pgstat.h +0 -699
  729. data/ext/pg_query/include/pgtime.h +0 -94
  730. data/ext/pg_query/include/pl_gram.h +0 -383
  731. data/ext/pg_query/include/pl_reserved_kwlist.h +0 -52
  732. data/ext/pg_query/include/pl_reserved_kwlist_d.h +0 -114
  733. data/ext/pg_query/include/pl_unreserved_kwlist.h +0 -111
  734. data/ext/pg_query/include/pl_unreserved_kwlist_d.h +0 -244
  735. data/ext/pg_query/include/plerrcodes.h +0 -998
  736. data/ext/pg_query/include/plpgsql.h +0 -1345
  737. data/ext/pg_query/include/port/atomics/arch-arm.h +0 -32
  738. data/ext/pg_query/include/port/atomics/arch-ppc.h +0 -254
  739. data/ext/pg_query/include/port/atomics/arch-x86.h +0 -252
  740. data/ext/pg_query/include/port/atomics/fallback.h +0 -170
  741. data/ext/pg_query/include/port/atomics/generic-gcc.h +0 -286
  742. data/ext/pg_query/include/port/atomics/generic.h +0 -401
  743. data/ext/pg_query/include/port/atomics.h +0 -524
  744. data/ext/pg_query/include/port/pg_bitutils.h +0 -302
  745. data/ext/pg_query/include/port/pg_bswap.h +0 -161
  746. data/ext/pg_query/include/port/pg_crc32c.h +0 -101
  747. data/ext/pg_query/include/port.h +0 -553
  748. data/ext/pg_query/include/portability/instr_time.h +0 -256
  749. data/ext/pg_query/include/postgres.h +0 -808
  750. data/ext/pg_query/include/postgres_ext.h +0 -74
  751. data/ext/pg_query/include/postmaster/autovacuum.h +0 -83
  752. data/ext/pg_query/include/postmaster/auxprocess.h +0 -20
  753. data/ext/pg_query/include/postmaster/bgworker.h +0 -162
  754. data/ext/pg_query/include/postmaster/bgworker_internals.h +0 -64
  755. data/ext/pg_query/include/postmaster/bgwriter.h +0 -45
  756. data/ext/pg_query/include/postmaster/fork_process.h +0 -17
  757. data/ext/pg_query/include/postmaster/interrupt.h +0 -32
  758. data/ext/pg_query/include/postmaster/pgarch.h +0 -73
  759. data/ext/pg_query/include/postmaster/postmaster.h +0 -78
  760. data/ext/pg_query/include/postmaster/startup.h +0 -39
  761. data/ext/pg_query/include/postmaster/syslogger.h +0 -103
  762. data/ext/pg_query/include/postmaster/walwriter.h +0 -21
  763. data/ext/pg_query/include/regex/regex.h +0 -186
  764. data/ext/pg_query/include/replication/logicallauncher.h +0 -29
  765. data/ext/pg_query/include/replication/logicalproto.h +0 -254
  766. data/ext/pg_query/include/replication/logicalworker.h +0 -19
  767. data/ext/pg_query/include/replication/origin.h +0 -73
  768. data/ext/pg_query/include/replication/reorderbuffer.h +0 -685
  769. data/ext/pg_query/include/replication/slot.h +0 -230
  770. data/ext/pg_query/include/replication/syncrep.h +0 -115
  771. data/ext/pg_query/include/replication/walreceiver.h +0 -472
  772. data/ext/pg_query/include/replication/walsender.h +0 -74
  773. data/ext/pg_query/include/rewrite/prs2lock.h +0 -46
  774. data/ext/pg_query/include/rewrite/rewriteHandler.h +0 -38
  775. data/ext/pg_query/include/rewrite/rewriteManip.h +0 -87
  776. data/ext/pg_query/include/rewrite/rewriteSupport.h +0 -26
  777. data/ext/pg_query/include/storage/backendid.h +0 -37
  778. data/ext/pg_query/include/storage/block.h +0 -115
  779. data/ext/pg_query/include/storage/buf.h +0 -46
  780. data/ext/pg_query/include/storage/bufmgr.h +0 -297
  781. data/ext/pg_query/include/storage/bufpage.h +0 -457
  782. data/ext/pg_query/include/storage/condition_variable.h +0 -73
  783. data/ext/pg_query/include/storage/dsm.h +0 -64
  784. data/ext/pg_query/include/storage/dsm_impl.h +0 -76
  785. data/ext/pg_query/include/storage/fd.h +0 -198
  786. data/ext/pg_query/include/storage/fileset.h +0 -40
  787. data/ext/pg_query/include/storage/ipc.h +0 -84
  788. data/ext/pg_query/include/storage/item.h +0 -19
  789. data/ext/pg_query/include/storage/itemid.h +0 -184
  790. data/ext/pg_query/include/storage/itemptr.h +0 -208
  791. data/ext/pg_query/include/storage/large_object.h +0 -100
  792. data/ext/pg_query/include/storage/latch.h +0 -186
  793. data/ext/pg_query/include/storage/lmgr.h +0 -115
  794. data/ext/pg_query/include/storage/lock.h +0 -616
  795. data/ext/pg_query/include/storage/lockdefs.h +0 -59
  796. data/ext/pg_query/include/storage/lwlock.h +0 -206
  797. data/ext/pg_query/include/storage/lwlocknames.h +0 -50
  798. data/ext/pg_query/include/storage/off.h +0 -57
  799. data/ext/pg_query/include/storage/pg_sema.h +0 -61
  800. data/ext/pg_query/include/storage/pg_shmem.h +0 -92
  801. data/ext/pg_query/include/storage/pmsignal.h +0 -105
  802. data/ext/pg_query/include/storage/predicate.h +0 -87
  803. data/ext/pg_query/include/storage/proc.h +0 -461
  804. data/ext/pg_query/include/storage/procarray.h +0 -98
  805. data/ext/pg_query/include/storage/proclist_types.h +0 -51
  806. data/ext/pg_query/include/storage/procsignal.h +0 -71
  807. data/ext/pg_query/include/storage/relfilenode.h +0 -99
  808. data/ext/pg_query/include/storage/s_lock.h +0 -1110
  809. data/ext/pg_query/include/storage/sharedfileset.h +0 -37
  810. data/ext/pg_query/include/storage/shm_mq.h +0 -86
  811. data/ext/pg_query/include/storage/shm_toc.h +0 -58
  812. data/ext/pg_query/include/storage/shmem.h +0 -81
  813. data/ext/pg_query/include/storage/sinval.h +0 -153
  814. data/ext/pg_query/include/storage/sinvaladt.h +0 -43
  815. data/ext/pg_query/include/storage/smgr.h +0 -111
  816. data/ext/pg_query/include/storage/spin.h +0 -77
  817. data/ext/pg_query/include/storage/standby.h +0 -98
  818. data/ext/pg_query/include/storage/standbydefs.h +0 -74
  819. data/ext/pg_query/include/storage/sync.h +0 -66
  820. data/ext/pg_query/include/tcop/cmdtag.h +0 -58
  821. data/ext/pg_query/include/tcop/cmdtaglist.h +0 -218
  822. data/ext/pg_query/include/tcop/deparse_utility.h +0 -108
  823. data/ext/pg_query/include/tcop/dest.h +0 -149
  824. data/ext/pg_query/include/tcop/fastpath.h +0 -20
  825. data/ext/pg_query/include/tcop/pquery.h +0 -51
  826. data/ext/pg_query/include/tcop/tcopprot.h +0 -97
  827. data/ext/pg_query/include/tcop/utility.h +0 -112
  828. data/ext/pg_query/include/tsearch/ts_cache.h +0 -98
  829. data/ext/pg_query/include/utils/acl.h +0 -333
  830. data/ext/pg_query/include/utils/aclchk_internal.h +0 -45
  831. data/ext/pg_query/include/utils/array.h +0 -464
  832. data/ext/pg_query/include/utils/backend_progress.h +0 -44
  833. data/ext/pg_query/include/utils/backend_status.h +0 -321
  834. data/ext/pg_query/include/utils/builtins.h +0 -127
  835. data/ext/pg_query/include/utils/bytea.h +0 -28
  836. data/ext/pg_query/include/utils/catcache.h +0 -231
  837. data/ext/pg_query/include/utils/date.h +0 -90
  838. data/ext/pg_query/include/utils/datetime.h +0 -344
  839. data/ext/pg_query/include/utils/datum.h +0 -76
  840. data/ext/pg_query/include/utils/dsa.h +0 -123
  841. data/ext/pg_query/include/utils/dynahash.h +0 -20
  842. data/ext/pg_query/include/utils/elog.h +0 -470
  843. data/ext/pg_query/include/utils/errcodes.h +0 -354
  844. data/ext/pg_query/include/utils/expandeddatum.h +0 -159
  845. data/ext/pg_query/include/utils/expandedrecord.h +0 -231
  846. data/ext/pg_query/include/utils/float.h +0 -356
  847. data/ext/pg_query/include/utils/fmgroids.h +0 -3261
  848. data/ext/pg_query/include/utils/fmgrprotos.h +0 -2829
  849. data/ext/pg_query/include/utils/fmgrtab.h +0 -49
  850. data/ext/pg_query/include/utils/guc.h +0 -469
  851. data/ext/pg_query/include/utils/guc_tables.h +0 -276
  852. data/ext/pg_query/include/utils/hsearch.h +0 -153
  853. data/ext/pg_query/include/utils/inval.h +0 -68
  854. data/ext/pg_query/include/utils/lsyscache.h +0 -208
  855. data/ext/pg_query/include/utils/memdebug.h +0 -82
  856. data/ext/pg_query/include/utils/memutils.h +0 -230
  857. data/ext/pg_query/include/utils/numeric.h +0 -90
  858. data/ext/pg_query/include/utils/palloc.h +0 -158
  859. data/ext/pg_query/include/utils/partcache.h +0 -102
  860. data/ext/pg_query/include/utils/pg_locale.h +0 -127
  861. data/ext/pg_query/include/utils/pg_lsn.h +0 -29
  862. data/ext/pg_query/include/utils/pgstat_internal.h +0 -784
  863. data/ext/pg_query/include/utils/pidfile.h +0 -56
  864. data/ext/pg_query/include/utils/plancache.h +0 -236
  865. data/ext/pg_query/include/utils/portal.h +0 -252
  866. data/ext/pg_query/include/utils/probes.h +0 -114
  867. data/ext/pg_query/include/utils/ps_status.h +0 -25
  868. data/ext/pg_query/include/utils/queryenvironment.h +0 -74
  869. data/ext/pg_query/include/utils/queryjumble.h +0 -88
  870. data/ext/pg_query/include/utils/regproc.h +0 -39
  871. data/ext/pg_query/include/utils/rel.h +0 -695
  872. data/ext/pg_query/include/utils/relcache.h +0 -153
  873. data/ext/pg_query/include/utils/reltrigger.h +0 -81
  874. data/ext/pg_query/include/utils/resowner.h +0 -86
  875. data/ext/pg_query/include/utils/rls.h +0 -50
  876. data/ext/pg_query/include/utils/ruleutils.h +0 -47
  877. data/ext/pg_query/include/utils/sharedtuplestore.h +0 -61
  878. data/ext/pg_query/include/utils/snapmgr.h +0 -179
  879. data/ext/pg_query/include/utils/snapshot.h +0 -219
  880. data/ext/pg_query/include/utils/sortsupport.h +0 -391
  881. data/ext/pg_query/include/utils/syscache.h +0 -224
  882. data/ext/pg_query/include/utils/timeout.h +0 -95
  883. data/ext/pg_query/include/utils/timestamp.h +0 -117
  884. data/ext/pg_query/include/utils/tuplesort.h +0 -291
  885. data/ext/pg_query/include/utils/tuplestore.h +0 -91
  886. data/ext/pg_query/include/utils/typcache.h +0 -209
  887. data/ext/pg_query/include/utils/tzparser.h +0 -39
  888. data/ext/pg_query/include/utils/varlena.h +0 -41
  889. data/ext/pg_query/include/utils/wait_event.h +0 -289
  890. data/ext/pg_query/include/utils/xml.h +0 -84
  891. data/ext/pg_query/src_backend_postmaster_postmaster.c +0 -2201
  892. data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -371
  893. data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1116
  894. data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1993
  895. data/ext/pg_query/src_common_pg_prng.c +0 -152
  896. data/ext/pg_query/src_common_string.c +0 -92
  897. data/ext/pg_query/src_port_pgsleep.c +0 -69
  898. data/ext/pg_query/src_port_strnlen.c +0 -39
  899. /data/ext/pg_query/{pg_query_ruby.sym → ext_symbols.sym} +0 -0
  900. /data/ext/pg_query/include/{access → postgres/access}/rmgr.h +0 -0
  901. /data/ext/pg_query/include/{pg_config_ext.h → postgres/pg_config_ext.h} +0 -0
@@ -1,3812 +0,0 @@
1
- /*-------------------------------------------------------------------------
2
- *
3
- * parsenodes.h
4
- * definitions for parse tree nodes
5
- *
6
- * Many of the node types used in parsetrees include a "location" field.
7
- * This is a byte (not character) offset in the original source text, to be
8
- * used for positioning an error cursor when there is an error related to
9
- * the node. Access to the original source text is needed to make use of
10
- * the location. At the topmost (statement) level, we also provide a
11
- * statement length, likewise measured in bytes, for convenience in
12
- * identifying statement boundaries in multi-statement source strings.
13
- *
14
- *
15
- * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
16
- * Portions Copyright (c) 1994, Regents of the University of California
17
- *
18
- * src/include/nodes/parsenodes.h
19
- *
20
- *-------------------------------------------------------------------------
21
- */
22
- #ifndef PARSENODES_H
23
- #define PARSENODES_H
24
-
25
- #include "nodes/bitmapset.h"
26
- #include "nodes/lockoptions.h"
27
- #include "nodes/primnodes.h"
28
- #include "nodes/value.h"
29
- #include "partitioning/partdefs.h"
30
-
31
-
32
- typedef enum OverridingKind
33
- {
34
- OVERRIDING_NOT_SET = 0,
35
- OVERRIDING_USER_VALUE,
36
- OVERRIDING_SYSTEM_VALUE
37
- } OverridingKind;
38
-
39
- /* Possible sources of a Query */
40
- typedef enum QuerySource
41
- {
42
- QSRC_ORIGINAL, /* original parsetree (explicit query) */
43
- QSRC_PARSER, /* added by parse analysis (now unused) */
44
- QSRC_INSTEAD_RULE, /* added by unconditional INSTEAD rule */
45
- QSRC_QUAL_INSTEAD_RULE, /* added by conditional INSTEAD rule */
46
- QSRC_NON_INSTEAD_RULE /* added by non-INSTEAD rule */
47
- } QuerySource;
48
-
49
- /* Sort ordering options for ORDER BY and CREATE INDEX */
50
- typedef enum SortByDir
51
- {
52
- SORTBY_DEFAULT,
53
- SORTBY_ASC,
54
- SORTBY_DESC,
55
- SORTBY_USING /* not allowed in CREATE INDEX ... */
56
- } SortByDir;
57
-
58
- typedef enum SortByNulls
59
- {
60
- SORTBY_NULLS_DEFAULT,
61
- SORTBY_NULLS_FIRST,
62
- SORTBY_NULLS_LAST
63
- } SortByNulls;
64
-
65
- /* Options for [ ALL | DISTINCT ] */
66
- typedef enum SetQuantifier
67
- {
68
- SET_QUANTIFIER_DEFAULT,
69
- SET_QUANTIFIER_ALL,
70
- SET_QUANTIFIER_DISTINCT
71
- } SetQuantifier;
72
-
73
- /*
74
- * Grantable rights are encoded so that we can OR them together in a bitmask.
75
- * The present representation of AclItem limits us to 16 distinct rights,
76
- * even though AclMode is defined as uint32. See utils/acl.h.
77
- *
78
- * Caution: changing these codes breaks stored ACLs, hence forces initdb.
79
- */
80
- typedef uint32 AclMode; /* a bitmask of privilege bits */
81
-
82
- #define ACL_INSERT (1<<0) /* for relations */
83
- #define ACL_SELECT (1<<1)
84
- #define ACL_UPDATE (1<<2)
85
- #define ACL_DELETE (1<<3)
86
- #define ACL_TRUNCATE (1<<4)
87
- #define ACL_REFERENCES (1<<5)
88
- #define ACL_TRIGGER (1<<6)
89
- #define ACL_EXECUTE (1<<7) /* for functions */
90
- #define ACL_USAGE (1<<8) /* for languages, namespaces, FDWs, and
91
- * servers */
92
- #define ACL_CREATE (1<<9) /* for namespaces and databases */
93
- #define ACL_CREATE_TEMP (1<<10) /* for databases */
94
- #define ACL_CONNECT (1<<11) /* for databases */
95
- #define ACL_SET (1<<12) /* for configuration parameters */
96
- #define ACL_ALTER_SYSTEM (1<<13) /* for configuration parameters */
97
- #define N_ACL_RIGHTS 14 /* 1 plus the last 1<<x */
98
- #define ACL_NO_RIGHTS 0
99
- /* Currently, SELECT ... FOR [KEY] UPDATE/SHARE requires UPDATE privileges */
100
- #define ACL_SELECT_FOR_UPDATE ACL_UPDATE
101
-
102
-
103
- /*****************************************************************************
104
- * Query Tree
105
- *****************************************************************************/
106
-
107
- /*
108
- * Query -
109
- * Parse analysis turns all statements into a Query tree
110
- * for further processing by the rewriter and planner.
111
- *
112
- * Utility statements (i.e. non-optimizable statements) have the
113
- * utilityStmt field set, and the rest of the Query is mostly dummy.
114
- *
115
- * Planning converts a Query tree into a Plan tree headed by a PlannedStmt
116
- * node --- the Query structure is not used by the executor.
117
- */
118
- typedef struct Query
119
- {
120
- NodeTag type;
121
-
122
- CmdType commandType; /* select|insert|update|delete|merge|utility */
123
-
124
- QuerySource querySource; /* where did I come from? */
125
-
126
- uint64 queryId; /* query identifier (can be set by plugins) */
127
-
128
- bool canSetTag; /* do I set the command result tag? */
129
-
130
- Node *utilityStmt; /* non-null if commandType == CMD_UTILITY */
131
-
132
- int resultRelation; /* rtable index of target relation for
133
- * INSERT/UPDATE/DELETE/MERGE; 0 for SELECT */
134
-
135
- bool hasAggs; /* has aggregates in tlist or havingQual */
136
- bool hasWindowFuncs; /* has window functions in tlist */
137
- bool hasTargetSRFs; /* has set-returning functions in tlist */
138
- bool hasSubLinks; /* has subquery SubLink */
139
- bool hasDistinctOn; /* distinctClause is from DISTINCT ON */
140
- bool hasRecursive; /* WITH RECURSIVE was specified */
141
- bool hasModifyingCTE; /* has INSERT/UPDATE/DELETE in WITH */
142
- bool hasForUpdate; /* FOR [KEY] UPDATE/SHARE was specified */
143
- bool hasRowSecurity; /* rewriter has applied some RLS policy */
144
-
145
- bool isReturn; /* is a RETURN statement */
146
-
147
- List *cteList; /* WITH list (of CommonTableExpr's) */
148
-
149
- List *rtable; /* list of range table entries */
150
- FromExpr *jointree; /* table join tree (FROM and WHERE clauses);
151
- * also USING clause for MERGE */
152
-
153
- List *mergeActionList; /* list of actions for MERGE (only) */
154
- bool mergeUseOuterJoin; /* whether to use outer join */
155
-
156
- List *targetList; /* target list (of TargetEntry) */
157
-
158
- OverridingKind override; /* OVERRIDING clause */
159
-
160
- OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */
161
-
162
- List *returningList; /* return-values list (of TargetEntry) */
163
-
164
- List *groupClause; /* a list of SortGroupClause's */
165
- bool groupDistinct; /* is the group by clause distinct? */
166
-
167
- List *groupingSets; /* a list of GroupingSet's if present */
168
-
169
- Node *havingQual; /* qualifications applied to groups */
170
-
171
- List *windowClause; /* a list of WindowClause's */
172
-
173
- List *distinctClause; /* a list of SortGroupClause's */
174
-
175
- List *sortClause; /* a list of SortGroupClause's */
176
-
177
- Node *limitOffset; /* # of result tuples to skip (int8 expr) */
178
- Node *limitCount; /* # of result tuples to return (int8 expr) */
179
- LimitOption limitOption; /* limit type */
180
-
181
- List *rowMarks; /* a list of RowMarkClause's */
182
-
183
- Node *setOperations; /* set-operation tree if this is top level of
184
- * a UNION/INTERSECT/EXCEPT query */
185
-
186
- List *constraintDeps; /* a list of pg_constraint OIDs that the query
187
- * depends on to be semantically valid */
188
-
189
- List *withCheckOptions; /* a list of WithCheckOption's (added
190
- * during rewrite) */
191
-
192
- /*
193
- * The following two fields identify the portion of the source text string
194
- * containing this query. They are typically only populated in top-level
195
- * Queries, not in sub-queries. When not set, they might both be zero, or
196
- * both be -1 meaning "unknown".
197
- */
198
- int stmt_location; /* start location, or -1 if unknown */
199
- int stmt_len; /* length in bytes; 0 means "rest of string" */
200
- } Query;
201
-
202
-
203
- /****************************************************************************
204
- * Supporting data structures for Parse Trees
205
- *
206
- * Most of these node types appear in raw parsetrees output by the grammar,
207
- * and get transformed to something else by the analyzer. A few of them
208
- * are used as-is in transformed querytrees.
209
- ****************************************************************************/
210
-
211
- /*
212
- * TypeName - specifies a type in definitions
213
- *
214
- * For TypeName structures generated internally, it is often easier to
215
- * specify the type by OID than by name. If "names" is NIL then the
216
- * actual type OID is given by typeOid, otherwise typeOid is unused.
217
- * Similarly, if "typmods" is NIL then the actual typmod is expected to
218
- * be prespecified in typemod, otherwise typemod is unused.
219
- *
220
- * If pct_type is true, then names is actually a field name and we look up
221
- * the type of that field. Otherwise (the normal case), names is a type
222
- * name possibly qualified with schema and database name.
223
- */
224
- typedef struct TypeName
225
- {
226
- NodeTag type;
227
- List *names; /* qualified name (list of String nodes) */
228
- Oid typeOid; /* type identified by OID */
229
- bool setof; /* is a set? */
230
- bool pct_type; /* %TYPE specified? */
231
- List *typmods; /* type modifier expression(s) */
232
- int32 typemod; /* prespecified type modifier */
233
- List *arrayBounds; /* array bounds */
234
- int location; /* token location, or -1 if unknown */
235
- } TypeName;
236
-
237
- /*
238
- * ColumnRef - specifies a reference to a column, or possibly a whole tuple
239
- *
240
- * The "fields" list must be nonempty. It can contain String nodes
241
- * (representing names) and A_Star nodes (representing occurrence of a '*').
242
- * Currently, A_Star must appear only as the last list element --- the grammar
243
- * is responsible for enforcing this!
244
- *
245
- * Note: any container subscripting or selection of fields from composite columns
246
- * is represented by an A_Indirection node above the ColumnRef. However,
247
- * for simplicity in the normal case, initial field selection from a table
248
- * name is represented within ColumnRef and not by adding A_Indirection.
249
- */
250
- typedef struct ColumnRef
251
- {
252
- NodeTag type;
253
- List *fields; /* field names (String nodes) or A_Star */
254
- int location; /* token location, or -1 if unknown */
255
- } ColumnRef;
256
-
257
- /*
258
- * ParamRef - specifies a $n parameter reference
259
- */
260
- typedef struct ParamRef
261
- {
262
- NodeTag type;
263
- int number; /* the number of the parameter */
264
- int location; /* token location, or -1 if unknown */
265
- } ParamRef;
266
-
267
- /*
268
- * A_Expr - infix, prefix, and postfix expressions
269
- */
270
- typedef enum A_Expr_Kind
271
- {
272
- AEXPR_OP, /* normal operator */
273
- AEXPR_OP_ANY, /* scalar op ANY (array) */
274
- AEXPR_OP_ALL, /* scalar op ALL (array) */
275
- AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */
276
- AEXPR_NOT_DISTINCT, /* IS NOT DISTINCT FROM - name must be "=" */
277
- AEXPR_NULLIF, /* NULLIF - name must be "=" */
278
- AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */
279
- AEXPR_LIKE, /* [NOT] LIKE - name must be "~~" or "!~~" */
280
- AEXPR_ILIKE, /* [NOT] ILIKE - name must be "~~*" or "!~~*" */
281
- AEXPR_SIMILAR, /* [NOT] SIMILAR - name must be "~" or "!~" */
282
- AEXPR_BETWEEN, /* name must be "BETWEEN" */
283
- AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */
284
- AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */
285
- AEXPR_NOT_BETWEEN_SYM /* name must be "NOT BETWEEN SYMMETRIC" */
286
- } A_Expr_Kind;
287
-
288
- typedef struct A_Expr
289
- {
290
- NodeTag type;
291
- A_Expr_Kind kind; /* see above */
292
- List *name; /* possibly-qualified name of operator */
293
- Node *lexpr; /* left argument, or NULL if none */
294
- Node *rexpr; /* right argument, or NULL if none */
295
- int location; /* token location, or -1 if unknown */
296
- } A_Expr;
297
-
298
- /*
299
- * A_Const - a literal constant
300
- */
301
- typedef struct A_Const
302
- {
303
- NodeTag type;
304
-
305
- /*
306
- * Value nodes are inline for performance. You can treat 'val' as a node,
307
- * as in IsA(&val, Integer). 'val' is not valid if isnull is true.
308
- */
309
- union ValUnion
310
- {
311
- Node node;
312
- Integer ival;
313
- Float fval;
314
- Boolean boolval;
315
- String sval;
316
- BitString bsval;
317
- } val;
318
- bool isnull; /* SQL NULL constant */
319
- int location; /* token location, or -1 if unknown */
320
- } A_Const;
321
-
322
- /*
323
- * TypeCast - a CAST expression
324
- */
325
- typedef struct TypeCast
326
- {
327
- NodeTag type;
328
- Node *arg; /* the expression being casted */
329
- TypeName *typeName; /* the target type */
330
- int location; /* token location, or -1 if unknown */
331
- } TypeCast;
332
-
333
- /*
334
- * CollateClause - a COLLATE expression
335
- */
336
- typedef struct CollateClause
337
- {
338
- NodeTag type;
339
- Node *arg; /* input expression */
340
- List *collname; /* possibly-qualified collation name */
341
- int location; /* token location, or -1 if unknown */
342
- } CollateClause;
343
-
344
- /*
345
- * RoleSpec - a role name or one of a few special values.
346
- */
347
- typedef enum RoleSpecType
348
- {
349
- ROLESPEC_CSTRING, /* role name is stored as a C string */
350
- ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */
351
- ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
352
- ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
353
- ROLESPEC_PUBLIC /* role name is "public" */
354
- } RoleSpecType;
355
-
356
- typedef struct RoleSpec
357
- {
358
- NodeTag type;
359
- RoleSpecType roletype; /* Type of this rolespec */
360
- char *rolename; /* filled only for ROLESPEC_CSTRING */
361
- int location; /* token location, or -1 if unknown */
362
- } RoleSpec;
363
-
364
- /*
365
- * FuncCall - a function or aggregate invocation
366
- *
367
- * agg_order (if not NIL) indicates we saw 'foo(... ORDER BY ...)', or if
368
- * agg_within_group is true, it was 'foo(...) WITHIN GROUP (ORDER BY ...)'.
369
- * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct
370
- * indicates we saw 'foo(DISTINCT ...)'. In any of these cases, the
371
- * construct *must* be an aggregate call. Otherwise, it might be either an
372
- * aggregate or some other kind of function. However, if FILTER or OVER is
373
- * present it had better be an aggregate or window function.
374
- *
375
- * Normally, you'd initialize this via makeFuncCall() and then only change the
376
- * parts of the struct its defaults don't match afterwards, as needed.
377
- */
378
- typedef struct FuncCall
379
- {
380
- NodeTag type;
381
- List *funcname; /* qualified name of function */
382
- List *args; /* the arguments (list of exprs) */
383
- List *agg_order; /* ORDER BY (list of SortBy) */
384
- Node *agg_filter; /* FILTER clause, if any */
385
- struct WindowDef *over; /* OVER clause, if any */
386
- bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */
387
- bool agg_star; /* argument was really '*' */
388
- bool agg_distinct; /* arguments were labeled DISTINCT */
389
- bool func_variadic; /* last argument was labeled VARIADIC */
390
- CoercionForm funcformat; /* how to display this node */
391
- int location; /* token location, or -1 if unknown */
392
- } FuncCall;
393
-
394
- /*
395
- * A_Star - '*' representing all columns of a table or compound field
396
- *
397
- * This can appear within ColumnRef.fields, A_Indirection.indirection, and
398
- * ResTarget.indirection lists.
399
- */
400
- typedef struct A_Star
401
- {
402
- NodeTag type;
403
- } A_Star;
404
-
405
- /*
406
- * A_Indices - array subscript or slice bounds ([idx] or [lidx:uidx])
407
- *
408
- * In slice case, either or both of lidx and uidx can be NULL (omitted).
409
- * In non-slice case, uidx holds the single subscript and lidx is always NULL.
410
- */
411
- typedef struct A_Indices
412
- {
413
- NodeTag type;
414
- bool is_slice; /* true if slice (i.e., colon present) */
415
- Node *lidx; /* slice lower bound, if any */
416
- Node *uidx; /* subscript, or slice upper bound if any */
417
- } A_Indices;
418
-
419
- /*
420
- * A_Indirection - select a field and/or array element from an expression
421
- *
422
- * The indirection list can contain A_Indices nodes (representing
423
- * subscripting), String nodes (representing field selection --- the
424
- * string value is the name of the field to select), and A_Star nodes
425
- * (representing selection of all fields of a composite type).
426
- * For example, a complex selection operation like
427
- * (foo).field1[42][7].field2
428
- * would be represented with a single A_Indirection node having a 4-element
429
- * indirection list.
430
- *
431
- * Currently, A_Star must appear only as the last list element --- the grammar
432
- * is responsible for enforcing this!
433
- */
434
- typedef struct A_Indirection
435
- {
436
- NodeTag type;
437
- Node *arg; /* the thing being selected from */
438
- List *indirection; /* subscripts and/or field names and/or * */
439
- } A_Indirection;
440
-
441
- /*
442
- * A_ArrayExpr - an ARRAY[] construct
443
- */
444
- typedef struct A_ArrayExpr
445
- {
446
- NodeTag type;
447
- List *elements; /* array element expressions */
448
- int location; /* token location, or -1 if unknown */
449
- } A_ArrayExpr;
450
-
451
- /*
452
- * ResTarget -
453
- * result target (used in target list of pre-transformed parse trees)
454
- *
455
- * In a SELECT target list, 'name' is the column label from an
456
- * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the
457
- * value expression itself. The 'indirection' field is not used.
458
- *
459
- * INSERT uses ResTarget in its target-column-names list. Here, 'name' is
460
- * the name of the destination column, 'indirection' stores any subscripts
461
- * attached to the destination, and 'val' is not used.
462
- *
463
- * In an UPDATE target list, 'name' is the name of the destination column,
464
- * 'indirection' stores any subscripts attached to the destination, and
465
- * 'val' is the expression to assign.
466
- *
467
- * See A_Indirection for more info about what can appear in 'indirection'.
468
- */
469
- typedef struct ResTarget
470
- {
471
- NodeTag type;
472
- char *name; /* column name or NULL */
473
- List *indirection; /* subscripts, field names, and '*', or NIL */
474
- Node *val; /* the value expression to compute or assign */
475
- int location; /* token location, or -1 if unknown */
476
- } ResTarget;
477
-
478
- /*
479
- * MultiAssignRef - element of a row source expression for UPDATE
480
- *
481
- * In an UPDATE target list, when we have SET (a,b,c) = row-valued-expression,
482
- * we generate separate ResTarget items for each of a,b,c. Their "val" trees
483
- * are MultiAssignRef nodes numbered 1..n, linking to a common copy of the
484
- * row-valued-expression (which parse analysis will process only once, when
485
- * handling the MultiAssignRef with colno=1).
486
- */
487
- typedef struct MultiAssignRef
488
- {
489
- NodeTag type;
490
- Node *source; /* the row-valued expression */
491
- int colno; /* column number for this target (1..n) */
492
- int ncolumns; /* number of targets in the construct */
493
- } MultiAssignRef;
494
-
495
- /*
496
- * SortBy - for ORDER BY clause
497
- */
498
- typedef struct SortBy
499
- {
500
- NodeTag type;
501
- Node *node; /* expression to sort on */
502
- SortByDir sortby_dir; /* ASC/DESC/USING/default */
503
- SortByNulls sortby_nulls; /* NULLS FIRST/LAST */
504
- List *useOp; /* name of op to use, if SORTBY_USING */
505
- int location; /* operator location, or -1 if none/unknown */
506
- } SortBy;
507
-
508
- /*
509
- * WindowDef - raw representation of WINDOW and OVER clauses
510
- *
511
- * For entries in a WINDOW list, "name" is the window name being defined.
512
- * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname"
513
- * for the "OVER (window)" syntax, which is subtly different --- the latter
514
- * implies overriding the window frame clause.
515
- */
516
- typedef struct WindowDef
517
- {
518
- NodeTag type;
519
- char *name; /* window's own name */
520
- char *refname; /* referenced window name, if any */
521
- List *partitionClause; /* PARTITION BY expression list */
522
- List *orderClause; /* ORDER BY (list of SortBy) */
523
- int frameOptions; /* frame_clause options, see below */
524
- Node *startOffset; /* expression for starting bound, if any */
525
- Node *endOffset; /* expression for ending bound, if any */
526
- int location; /* parse location, or -1 if none/unknown */
527
- } WindowDef;
528
-
529
- /*
530
- * frameOptions is an OR of these bits. The NONDEFAULT and BETWEEN bits are
531
- * used so that ruleutils.c can tell which properties were specified and
532
- * which were defaulted; the correct behavioral bits must be set either way.
533
- * The START_foo and END_foo options must come in pairs of adjacent bits for
534
- * the convenience of gram.y, even though some of them are useless/invalid.
535
- */
536
- #define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */
537
- #define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */
538
- #define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */
539
- #define FRAMEOPTION_GROUPS 0x00008 /* GROUPS behavior */
540
- #define FRAMEOPTION_BETWEEN 0x00010 /* BETWEEN given? */
541
- #define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00020 /* start is U. P. */
542
- #define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00040 /* (disallowed) */
543
- #define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00080 /* (disallowed) */
544
- #define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00100 /* end is U. F. */
545
- #define FRAMEOPTION_START_CURRENT_ROW 0x00200 /* start is C. R. */
546
- #define FRAMEOPTION_END_CURRENT_ROW 0x00400 /* end is C. R. */
547
- #define FRAMEOPTION_START_OFFSET_PRECEDING 0x00800 /* start is O. P. */
548
- #define FRAMEOPTION_END_OFFSET_PRECEDING 0x01000 /* end is O. P. */
549
- #define FRAMEOPTION_START_OFFSET_FOLLOWING 0x02000 /* start is O. F. */
550
- #define FRAMEOPTION_END_OFFSET_FOLLOWING 0x04000 /* end is O. F. */
551
- #define FRAMEOPTION_EXCLUDE_CURRENT_ROW 0x08000 /* omit C.R. */
552
- #define FRAMEOPTION_EXCLUDE_GROUP 0x10000 /* omit C.R. & peers */
553
- #define FRAMEOPTION_EXCLUDE_TIES 0x20000 /* omit C.R.'s peers */
554
-
555
- #define FRAMEOPTION_START_OFFSET \
556
- (FRAMEOPTION_START_OFFSET_PRECEDING | FRAMEOPTION_START_OFFSET_FOLLOWING)
557
- #define FRAMEOPTION_END_OFFSET \
558
- (FRAMEOPTION_END_OFFSET_PRECEDING | FRAMEOPTION_END_OFFSET_FOLLOWING)
559
- #define FRAMEOPTION_EXCLUSION \
560
- (FRAMEOPTION_EXCLUDE_CURRENT_ROW | FRAMEOPTION_EXCLUDE_GROUP | \
561
- FRAMEOPTION_EXCLUDE_TIES)
562
-
563
- #define FRAMEOPTION_DEFAULTS \
564
- (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \
565
- FRAMEOPTION_END_CURRENT_ROW)
566
-
567
- /*
568
- * RangeSubselect - subquery appearing in a FROM clause
569
- */
570
- typedef struct RangeSubselect
571
- {
572
- NodeTag type;
573
- bool lateral; /* does it have LATERAL prefix? */
574
- Node *subquery; /* the untransformed sub-select clause */
575
- Alias *alias; /* table alias & optional column aliases */
576
- } RangeSubselect;
577
-
578
- /*
579
- * RangeFunction - function call appearing in a FROM clause
580
- *
581
- * functions is a List because we use this to represent the construct
582
- * ROWS FROM(func1(...), func2(...), ...). Each element of this list is a
583
- * two-element sublist, the first element being the untransformed function
584
- * call tree, and the second element being a possibly-empty list of ColumnDef
585
- * nodes representing any columndef list attached to that function within the
586
- * ROWS FROM() syntax.
587
- *
588
- * alias and coldeflist represent any alias and/or columndef list attached
589
- * at the top level. (We disallow coldeflist appearing both here and
590
- * per-function, but that's checked in parse analysis, not by the grammar.)
591
- */
592
- typedef struct RangeFunction
593
- {
594
- NodeTag type;
595
- bool lateral; /* does it have LATERAL prefix? */
596
- bool ordinality; /* does it have WITH ORDINALITY suffix? */
597
- bool is_rowsfrom; /* is result of ROWS FROM() syntax? */
598
- List *functions; /* per-function information, see above */
599
- Alias *alias; /* table alias & optional column aliases */
600
- List *coldeflist; /* list of ColumnDef nodes to describe result
601
- * of function returning RECORD */
602
- } RangeFunction;
603
-
604
- /*
605
- * RangeTableFunc - raw form of "table functions" such as XMLTABLE
606
- */
607
- typedef struct RangeTableFunc
608
- {
609
- NodeTag type;
610
- bool lateral; /* does it have LATERAL prefix? */
611
- Node *docexpr; /* document expression */
612
- Node *rowexpr; /* row generator expression */
613
- List *namespaces; /* list of namespaces as ResTarget */
614
- List *columns; /* list of RangeTableFuncCol */
615
- Alias *alias; /* table alias & optional column aliases */
616
- int location; /* token location, or -1 if unknown */
617
- } RangeTableFunc;
618
-
619
- /*
620
- * RangeTableFuncCol - one column in a RangeTableFunc->columns
621
- *
622
- * If for_ordinality is true (FOR ORDINALITY), then the column is an int4
623
- * column and the rest of the fields are ignored.
624
- */
625
- typedef struct RangeTableFuncCol
626
- {
627
- NodeTag type;
628
- char *colname; /* name of generated column */
629
- TypeName *typeName; /* type of generated column */
630
- bool for_ordinality; /* does it have FOR ORDINALITY? */
631
- bool is_not_null; /* does it have NOT NULL? */
632
- Node *colexpr; /* column filter expression */
633
- Node *coldefexpr; /* column default value expression */
634
- int location; /* token location, or -1 if unknown */
635
- } RangeTableFuncCol;
636
-
637
- /*
638
- * RangeTableSample - TABLESAMPLE appearing in a raw FROM clause
639
- *
640
- * This node, appearing only in raw parse trees, represents
641
- * <relation> TABLESAMPLE <method> (<params>) REPEATABLE (<num>)
642
- * Currently, the <relation> can only be a RangeVar, but we might in future
643
- * allow RangeSubselect and other options. Note that the RangeTableSample
644
- * is wrapped around the node representing the <relation>, rather than being
645
- * a subfield of it.
646
- */
647
- typedef struct RangeTableSample
648
- {
649
- NodeTag type;
650
- Node *relation; /* relation to be sampled */
651
- List *method; /* sampling method name (possibly qualified) */
652
- List *args; /* argument(s) for sampling method */
653
- Node *repeatable; /* REPEATABLE expression, or NULL if none */
654
- int location; /* method name location, or -1 if unknown */
655
- } RangeTableSample;
656
-
657
- /*
658
- * ColumnDef - column definition (used in various creates)
659
- *
660
- * If the column has a default value, we may have the value expression
661
- * in either "raw" form (an untransformed parse tree) or "cooked" form
662
- * (a post-parse-analysis, executable expression tree), depending on
663
- * how this ColumnDef node was created (by parsing, or by inheritance
664
- * from an existing relation). We should never have both in the same node!
665
- *
666
- * Similarly, we may have a COLLATE specification in either raw form
667
- * (represented as a CollateClause with arg==NULL) or cooked form
668
- * (the collation's OID).
669
- *
670
- * The constraints list may contain a CONSTR_DEFAULT item in a raw
671
- * parsetree produced by gram.y, but transformCreateStmt will remove
672
- * the item and set raw_default instead. CONSTR_DEFAULT items
673
- * should not appear in any subsequent processing.
674
- */
675
- typedef struct ColumnDef
676
- {
677
- NodeTag type;
678
- char *colname; /* name of column */
679
- TypeName *typeName; /* type of column */
680
- char *compression; /* compression method for column */
681
- int inhcount; /* number of times column is inherited */
682
- bool is_local; /* column has local (non-inherited) def'n */
683
- bool is_not_null; /* NOT NULL constraint specified? */
684
- bool is_from_type; /* column definition came from table type */
685
- char storage; /* attstorage setting, or 0 for default */
686
- Node *raw_default; /* default value (untransformed parse tree) */
687
- Node *cooked_default; /* default value (transformed expr tree) */
688
- char identity; /* attidentity setting */
689
- RangeVar *identitySequence; /* to store identity sequence name for
690
- * ALTER TABLE ... ADD COLUMN */
691
- char generated; /* attgenerated setting */
692
- CollateClause *collClause; /* untransformed COLLATE spec, if any */
693
- Oid collOid; /* collation OID (InvalidOid if not set) */
694
- List *constraints; /* other constraints on column */
695
- List *fdwoptions; /* per-column FDW options */
696
- int location; /* parse location, or -1 if none/unknown */
697
- } ColumnDef;
698
-
699
- /*
700
- * TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause
701
- */
702
- typedef struct TableLikeClause
703
- {
704
- NodeTag type;
705
- RangeVar *relation;
706
- bits32 options; /* OR of TableLikeOption flags */
707
- Oid relationOid; /* If table has been looked up, its OID */
708
- } TableLikeClause;
709
-
710
- typedef enum TableLikeOption
711
- {
712
- CREATE_TABLE_LIKE_COMMENTS = 1 << 0,
713
- CREATE_TABLE_LIKE_COMPRESSION = 1 << 1,
714
- CREATE_TABLE_LIKE_CONSTRAINTS = 1 << 2,
715
- CREATE_TABLE_LIKE_DEFAULTS = 1 << 3,
716
- CREATE_TABLE_LIKE_GENERATED = 1 << 4,
717
- CREATE_TABLE_LIKE_IDENTITY = 1 << 5,
718
- CREATE_TABLE_LIKE_INDEXES = 1 << 6,
719
- CREATE_TABLE_LIKE_STATISTICS = 1 << 7,
720
- CREATE_TABLE_LIKE_STORAGE = 1 << 8,
721
- CREATE_TABLE_LIKE_ALL = PG_INT32_MAX
722
- } TableLikeOption;
723
-
724
- /*
725
- * IndexElem - index parameters (used in CREATE INDEX, and in ON CONFLICT)
726
- *
727
- * For a plain index attribute, 'name' is the name of the table column to
728
- * index, and 'expr' is NULL. For an index expression, 'name' is NULL and
729
- * 'expr' is the expression tree.
730
- */
731
- typedef struct IndexElem
732
- {
733
- NodeTag type;
734
- char *name; /* name of attribute to index, or NULL */
735
- Node *expr; /* expression to index, or NULL */
736
- char *indexcolname; /* name for index column; NULL = default */
737
- List *collation; /* name of collation; NIL = default */
738
- List *opclass; /* name of desired opclass; NIL = default */
739
- List *opclassopts; /* opclass-specific options, or NIL */
740
- SortByDir ordering; /* ASC/DESC/default */
741
- SortByNulls nulls_ordering; /* FIRST/LAST/default */
742
- } IndexElem;
743
-
744
- /*
745
- * DefElem - a generic "name = value" option definition
746
- *
747
- * In some contexts the name can be qualified. Also, certain SQL commands
748
- * allow a SET/ADD/DROP action to be attached to option settings, so it's
749
- * convenient to carry a field for that too. (Note: currently, it is our
750
- * practice that the grammar allows namespace and action only in statements
751
- * where they are relevant; C code can just ignore those fields in other
752
- * statements.)
753
- */
754
- typedef enum DefElemAction
755
- {
756
- DEFELEM_UNSPEC, /* no action given */
757
- DEFELEM_SET,
758
- DEFELEM_ADD,
759
- DEFELEM_DROP
760
- } DefElemAction;
761
-
762
- typedef struct DefElem
763
- {
764
- NodeTag type;
765
- char *defnamespace; /* NULL if unqualified name */
766
- char *defname;
767
- Node *arg; /* typically Integer, Float, String, or
768
- * TypeName */
769
- DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */
770
- int location; /* token location, or -1 if unknown */
771
- } DefElem;
772
-
773
- /*
774
- * LockingClause - raw representation of FOR [NO KEY] UPDATE/[KEY] SHARE
775
- * options
776
- *
777
- * Note: lockedRels == NIL means "all relations in query". Otherwise it
778
- * is a list of RangeVar nodes. (We use RangeVar mainly because it carries
779
- * a location field --- currently, parse analysis insists on unqualified
780
- * names in LockingClause.)
781
- */
782
- typedef struct LockingClause
783
- {
784
- NodeTag type;
785
- List *lockedRels; /* FOR [KEY] UPDATE/SHARE relations */
786
- LockClauseStrength strength;
787
- LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
788
- } LockingClause;
789
-
790
- /*
791
- * XMLSERIALIZE (in raw parse tree only)
792
- */
793
- typedef struct XmlSerialize
794
- {
795
- NodeTag type;
796
- XmlOptionType xmloption; /* DOCUMENT or CONTENT */
797
- Node *expr;
798
- TypeName *typeName;
799
- int location; /* token location, or -1 if unknown */
800
- } XmlSerialize;
801
-
802
- /* Partitioning related definitions */
803
-
804
- /*
805
- * PartitionElem - parse-time representation of a single partition key
806
- *
807
- * expr can be either a raw expression tree or a parse-analyzed expression.
808
- * We don't store these on-disk, though.
809
- */
810
- typedef struct PartitionElem
811
- {
812
- NodeTag type;
813
- char *name; /* name of column to partition on, or NULL */
814
- Node *expr; /* expression to partition on, or NULL */
815
- List *collation; /* name of collation; NIL = default */
816
- List *opclass; /* name of desired opclass; NIL = default */
817
- int location; /* token location, or -1 if unknown */
818
- } PartitionElem;
819
-
820
- /*
821
- * PartitionSpec - parse-time representation of a partition key specification
822
- *
823
- * This represents the key space we will be partitioning on.
824
- */
825
- typedef struct PartitionSpec
826
- {
827
- NodeTag type;
828
- char *strategy; /* partitioning strategy ('hash', 'list' or
829
- * 'range') */
830
- List *partParams; /* List of PartitionElems */
831
- int location; /* token location, or -1 if unknown */
832
- } PartitionSpec;
833
-
834
- /* Internal codes for partitioning strategies */
835
- #define PARTITION_STRATEGY_HASH 'h'
836
- #define PARTITION_STRATEGY_LIST 'l'
837
- #define PARTITION_STRATEGY_RANGE 'r'
838
-
839
- /*
840
- * PartitionBoundSpec - a partition bound specification
841
- *
842
- * This represents the portion of the partition key space assigned to a
843
- * particular partition. These are stored on disk in pg_class.relpartbound.
844
- */
845
- struct PartitionBoundSpec
846
- {
847
- NodeTag type;
848
-
849
- char strategy; /* see PARTITION_STRATEGY codes above */
850
- bool is_default; /* is it a default partition bound? */
851
-
852
- /* Partitioning info for HASH strategy: */
853
- int modulus;
854
- int remainder;
855
-
856
- /* Partitioning info for LIST strategy: */
857
- List *listdatums; /* List of Consts (or A_Consts in raw tree) */
858
-
859
- /* Partitioning info for RANGE strategy: */
860
- List *lowerdatums; /* List of PartitionRangeDatums */
861
- List *upperdatums; /* List of PartitionRangeDatums */
862
-
863
- int location; /* token location, or -1 if unknown */
864
- };
865
-
866
- /*
867
- * PartitionRangeDatum - one of the values in a range partition bound
868
- *
869
- * This can be MINVALUE, MAXVALUE or a specific bounded value.
870
- */
871
- typedef enum PartitionRangeDatumKind
872
- {
873
- PARTITION_RANGE_DATUM_MINVALUE = -1, /* less than any other value */
874
- PARTITION_RANGE_DATUM_VALUE = 0, /* a specific (bounded) value */
875
- PARTITION_RANGE_DATUM_MAXVALUE = 1 /* greater than any other value */
876
- } PartitionRangeDatumKind;
877
-
878
- typedef struct PartitionRangeDatum
879
- {
880
- NodeTag type;
881
-
882
- PartitionRangeDatumKind kind;
883
- Node *value; /* Const (or A_Const in raw tree), if kind is
884
- * PARTITION_RANGE_DATUM_VALUE, else NULL */
885
-
886
- int location; /* token location, or -1 if unknown */
887
- } PartitionRangeDatum;
888
-
889
- /*
890
- * PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION commands
891
- */
892
- typedef struct PartitionCmd
893
- {
894
- NodeTag type;
895
- RangeVar *name; /* name of partition to attach/detach */
896
- PartitionBoundSpec *bound; /* FOR VALUES, if attaching */
897
- bool concurrent;
898
- } PartitionCmd;
899
-
900
- /****************************************************************************
901
- * Nodes for a Query tree
902
- ****************************************************************************/
903
-
904
- /*--------------------
905
- * RangeTblEntry -
906
- * A range table is a List of RangeTblEntry nodes.
907
- *
908
- * A range table entry may represent a plain relation, a sub-select in
909
- * FROM, or the result of a JOIN clause. (Only explicit JOIN syntax
910
- * produces an RTE, not the implicit join resulting from multiple FROM
911
- * items. This is because we only need the RTE to deal with SQL features
912
- * like outer joins and join-output-column aliasing.) Other special
913
- * RTE types also exist, as indicated by RTEKind.
914
- *
915
- * Note that we consider RTE_RELATION to cover anything that has a pg_class
916
- * entry. relkind distinguishes the sub-cases.
917
- *
918
- * alias is an Alias node representing the AS alias-clause attached to the
919
- * FROM expression, or NULL if no clause.
920
- *
921
- * eref is the table reference name and column reference names (either
922
- * real or aliases). Note that system columns (OID etc) are not included
923
- * in the column list.
924
- * eref->aliasname is required to be present, and should generally be used
925
- * to identify the RTE for error messages etc.
926
- *
927
- * In RELATION RTEs, the colnames in both alias and eref are indexed by
928
- * physical attribute number; this means there must be colname entries for
929
- * dropped columns. When building an RTE we insert empty strings ("") for
930
- * dropped columns. Note however that a stored rule may have nonempty
931
- * colnames for columns dropped since the rule was created (and for that
932
- * matter the colnames might be out of date due to column renamings).
933
- * The same comments apply to FUNCTION RTEs when a function's return type
934
- * is a named composite type.
935
- *
936
- * In JOIN RTEs, the colnames in both alias and eref are one-to-one with
937
- * joinaliasvars entries. A JOIN RTE will omit columns of its inputs when
938
- * those columns are known to be dropped at parse time. Again, however,
939
- * a stored rule might contain entries for columns dropped since the rule
940
- * was created. (This is only possible for columns not actually referenced
941
- * in the rule.) When loading a stored rule, we replace the joinaliasvars
942
- * items for any such columns with null pointers. (We can't simply delete
943
- * them from the joinaliasvars list, because that would affect the attnums
944
- * of Vars referencing the rest of the list.)
945
- *
946
- * inh is true for relation references that should be expanded to include
947
- * inheritance children, if the rel has any. This *must* be false for
948
- * RTEs other than RTE_RELATION entries.
949
- *
950
- * inFromCl marks those range variables that are listed in the FROM clause.
951
- * It's false for RTEs that are added to a query behind the scenes, such
952
- * as the NEW and OLD variables for a rule, or the subqueries of a UNION.
953
- * This flag is not used during parsing (except in transformLockingClause,
954
- * q.v.); the parser now uses a separate "namespace" data structure to
955
- * control visibility. But it is needed by ruleutils.c to determine
956
- * whether RTEs should be shown in decompiled queries.
957
- *
958
- * requiredPerms and checkAsUser specify run-time access permissions
959
- * checks to be performed at query startup. The user must have *all*
960
- * of the permissions that are OR'd together in requiredPerms (zero
961
- * indicates no permissions checking). If checkAsUser is not zero,
962
- * then do the permissions checks using the access rights of that user,
963
- * not the current effective user ID. (This allows rules to act as
964
- * setuid gateways.) Permissions checks only apply to RELATION RTEs.
965
- *
966
- * For SELECT/INSERT/UPDATE permissions, if the user doesn't have
967
- * table-wide permissions then it is sufficient to have the permissions
968
- * on all columns identified in selectedCols (for SELECT) and/or
969
- * insertedCols and/or updatedCols (INSERT with ON CONFLICT DO UPDATE may
970
- * have all 3). selectedCols, insertedCols and updatedCols are bitmapsets,
971
- * which cannot have negative integer members, so we subtract
972
- * FirstLowInvalidHeapAttributeNumber from column numbers before storing
973
- * them in these fields. A whole-row Var reference is represented by
974
- * setting the bit for InvalidAttrNumber.
975
- *
976
- * updatedCols is also used in some other places, for example, to determine
977
- * which triggers to fire and in FDWs to know which changed columns they
978
- * need to ship off.
979
- *
980
- * Generated columns that are caused to be updated by an update to a base
981
- * column are listed in extraUpdatedCols. This is not considered for
982
- * permission checking, but it is useful in those places that want to know
983
- * the full set of columns being updated as opposed to only the ones the
984
- * user explicitly mentioned in the query. (There is currently no need for
985
- * an extraInsertedCols, but it could exist.) Note that extraUpdatedCols
986
- * is populated during query rewrite, NOT in the parser, since generated
987
- * columns could be added after a rule has been parsed and stored.
988
- *
989
- * securityQuals is a list of security barrier quals (boolean expressions),
990
- * to be tested in the listed order before returning a row from the
991
- * relation. It is always NIL in parser output. Entries are added by the
992
- * rewriter to implement security-barrier views and/or row-level security.
993
- * Note that the planner turns each boolean expression into an implicitly
994
- * AND'ed sublist, as is its usual habit with qualification expressions.
995
- *--------------------
996
- */
997
- typedef enum RTEKind
998
- {
999
- RTE_RELATION, /* ordinary relation reference */
1000
- RTE_SUBQUERY, /* subquery in FROM */
1001
- RTE_JOIN, /* join */
1002
- RTE_FUNCTION, /* function in FROM */
1003
- RTE_TABLEFUNC, /* TableFunc(.., column list) */
1004
- RTE_VALUES, /* VALUES (<exprlist>), (<exprlist>), ... */
1005
- RTE_CTE, /* common table expr (WITH list element) */
1006
- RTE_NAMEDTUPLESTORE, /* tuplestore, e.g. for AFTER triggers */
1007
- RTE_RESULT /* RTE represents an empty FROM clause; such
1008
- * RTEs are added by the planner, they're not
1009
- * present during parsing or rewriting */
1010
- } RTEKind;
1011
-
1012
- typedef struct RangeTblEntry
1013
- {
1014
- NodeTag type;
1015
-
1016
- RTEKind rtekind; /* see above */
1017
-
1018
- /*
1019
- * XXX the fields applicable to only some rte kinds should be merged into
1020
- * a union. I didn't do this yet because the diffs would impact a lot of
1021
- * code that is being actively worked on. FIXME someday.
1022
- */
1023
-
1024
- /*
1025
- * Fields valid for a plain relation RTE (else zero):
1026
- *
1027
- * As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate
1028
- * that the tuple format of the tuplestore is the same as the referenced
1029
- * relation. This allows plans referencing AFTER trigger transition
1030
- * tables to be invalidated if the underlying table is altered.
1031
- *
1032
- * rellockmode is really LOCKMODE, but it's declared int to avoid having
1033
- * to include lock-related headers here. It must be RowExclusiveLock if
1034
- * the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if
1035
- * the RTE is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock.
1036
- *
1037
- * Note: in some cases, rule expansion may result in RTEs that are marked
1038
- * with RowExclusiveLock even though they are not the target of the
1039
- * current query; this happens if a DO ALSO rule simply scans the original
1040
- * target table. We leave such RTEs with their original lockmode so as to
1041
- * avoid getting an additional, lesser lock.
1042
- */
1043
- Oid relid; /* OID of the relation */
1044
- char relkind; /* relation kind (see pg_class.relkind) */
1045
- int rellockmode; /* lock level that query requires on the rel */
1046
- struct TableSampleClause *tablesample; /* sampling info, or NULL */
1047
-
1048
- /*
1049
- * Fields valid for a subquery RTE (else NULL):
1050
- */
1051
- Query *subquery; /* the sub-query */
1052
- bool security_barrier; /* is from security_barrier view? */
1053
-
1054
- /*
1055
- * Fields valid for a join RTE (else NULL/zero):
1056
- *
1057
- * joinaliasvars is a list of (usually) Vars corresponding to the columns
1058
- * of the join result. An alias Var referencing column K of the join
1059
- * result can be replaced by the K'th element of joinaliasvars --- but to
1060
- * simplify the task of reverse-listing aliases correctly, we do not do
1061
- * that until planning time. In detail: an element of joinaliasvars can
1062
- * be a Var of one of the join's input relations, or such a Var with an
1063
- * implicit coercion to the join's output column type, or a COALESCE
1064
- * expression containing the two input column Vars (possibly coerced).
1065
- * Elements beyond the first joinmergedcols entries are always just Vars,
1066
- * and are never referenced from elsewhere in the query (that is, join
1067
- * alias Vars are generated only for merged columns). We keep these
1068
- * entries only because they're needed in expandRTE() and similar code.
1069
- *
1070
- * Within a Query loaded from a stored rule, it is possible for non-merged
1071
- * joinaliasvars items to be null pointers, which are placeholders for
1072
- * (necessarily unreferenced) columns dropped since the rule was made.
1073
- * Also, once planning begins, joinaliasvars items can be almost anything,
1074
- * as a result of subquery-flattening substitutions.
1075
- *
1076
- * joinleftcols is an integer list of physical column numbers of the left
1077
- * join input rel that are included in the join; likewise joinrighttcols
1078
- * for the right join input rel. (Which rels those are can be determined
1079
- * from the associated JoinExpr.) If the join is USING/NATURAL, then the
1080
- * first joinmergedcols entries in each list identify the merged columns.
1081
- * The merged columns come first in the join output, then remaining
1082
- * columns of the left input, then remaining columns of the right.
1083
- *
1084
- * Note that input columns could have been dropped after creation of a
1085
- * stored rule, if they are not referenced in the query (in particular,
1086
- * merged columns could not be dropped); this is not accounted for in
1087
- * joinleftcols/joinrighttcols.
1088
- */
1089
- JoinType jointype; /* type of join */
1090
- int joinmergedcols; /* number of merged (JOIN USING) columns */
1091
- List *joinaliasvars; /* list of alias-var expansions */
1092
- List *joinleftcols; /* left-side input column numbers */
1093
- List *joinrightcols; /* right-side input column numbers */
1094
-
1095
- /*
1096
- * join_using_alias is an alias clause attached directly to JOIN/USING. It
1097
- * is different from the alias field (below) in that it does not hide the
1098
- * range variables of the tables being joined.
1099
- */
1100
- Alias *join_using_alias;
1101
-
1102
- /*
1103
- * Fields valid for a function RTE (else NIL/zero):
1104
- *
1105
- * When funcordinality is true, the eref->colnames list includes an alias
1106
- * for the ordinality column. The ordinality column is otherwise
1107
- * implicit, and must be accounted for "by hand" in places such as
1108
- * expandRTE().
1109
- */
1110
- List *functions; /* list of RangeTblFunction nodes */
1111
- bool funcordinality; /* is this called WITH ORDINALITY? */
1112
-
1113
- /*
1114
- * Fields valid for a TableFunc RTE (else NULL):
1115
- */
1116
- TableFunc *tablefunc;
1117
-
1118
- /*
1119
- * Fields valid for a values RTE (else NIL):
1120
- */
1121
- List *values_lists; /* list of expression lists */
1122
-
1123
- /*
1124
- * Fields valid for a CTE RTE (else NULL/zero):
1125
- */
1126
- char *ctename; /* name of the WITH list item */
1127
- Index ctelevelsup; /* number of query levels up */
1128
- bool self_reference; /* is this a recursive self-reference? */
1129
-
1130
- /*
1131
- * Fields valid for CTE, VALUES, ENR, and TableFunc RTEs (else NIL):
1132
- *
1133
- * We need these for CTE RTEs so that the types of self-referential
1134
- * columns are well-defined. For VALUES RTEs, storing these explicitly
1135
- * saves having to re-determine the info by scanning the values_lists. For
1136
- * ENRs, we store the types explicitly here (we could get the information
1137
- * from the catalogs if 'relid' was supplied, but we'd still need these
1138
- * for TupleDesc-based ENRs, so we might as well always store the type
1139
- * info here). For TableFuncs, these fields are redundant with data in
1140
- * the TableFunc node, but keeping them here allows some code sharing with
1141
- * the other cases.
1142
- *
1143
- * For ENRs only, we have to consider the possibility of dropped columns.
1144
- * A dropped column is included in these lists, but it will have zeroes in
1145
- * all three lists (as well as an empty-string entry in eref). Testing
1146
- * for zero coltype is the standard way to detect a dropped column.
1147
- */
1148
- List *coltypes; /* OID list of column type OIDs */
1149
- List *coltypmods; /* integer list of column typmods */
1150
- List *colcollations; /* OID list of column collation OIDs */
1151
-
1152
- /*
1153
- * Fields valid for ENR RTEs (else NULL/zero):
1154
- */
1155
- char *enrname; /* name of ephemeral named relation */
1156
- Cardinality enrtuples; /* estimated or actual from caller */
1157
-
1158
- /*
1159
- * Fields valid in all RTEs:
1160
- */
1161
- Alias *alias; /* user-written alias clause, if any */
1162
- Alias *eref; /* expanded reference names */
1163
- bool lateral; /* subquery, function, or values is LATERAL? */
1164
- bool inh; /* inheritance requested? */
1165
- bool inFromCl; /* present in FROM clause? */
1166
- AclMode requiredPerms; /* bitmask of required access permissions */
1167
- Oid checkAsUser; /* if valid, check access as this role */
1168
- Bitmapset *selectedCols; /* columns needing SELECT permission */
1169
- Bitmapset *insertedCols; /* columns needing INSERT permission */
1170
- Bitmapset *updatedCols; /* columns needing UPDATE permission */
1171
- Bitmapset *extraUpdatedCols; /* generated columns being updated */
1172
- List *securityQuals; /* security barrier quals to apply, if any */
1173
- } RangeTblEntry;
1174
-
1175
- /*
1176
- * RangeTblFunction -
1177
- * RangeTblEntry subsidiary data for one function in a FUNCTION RTE.
1178
- *
1179
- * If the function had a column definition list (required for an
1180
- * otherwise-unspecified RECORD result), funccolnames lists the names given
1181
- * in the definition list, funccoltypes lists their declared column types,
1182
- * funccoltypmods lists their typmods, funccolcollations their collations.
1183
- * Otherwise, those fields are NIL.
1184
- *
1185
- * Notice we don't attempt to store info about the results of functions
1186
- * returning named composite types, because those can change from time to
1187
- * time. We do however remember how many columns we thought the type had
1188
- * (including dropped columns!), so that we can successfully ignore any
1189
- * columns added after the query was parsed.
1190
- */
1191
- typedef struct RangeTblFunction
1192
- {
1193
- NodeTag type;
1194
-
1195
- Node *funcexpr; /* expression tree for func call */
1196
- int funccolcount; /* number of columns it contributes to RTE */
1197
- /* These fields record the contents of a column definition list, if any: */
1198
- List *funccolnames; /* column names (list of String) */
1199
- List *funccoltypes; /* OID list of column type OIDs */
1200
- List *funccoltypmods; /* integer list of column typmods */
1201
- List *funccolcollations; /* OID list of column collation OIDs */
1202
- /* This is set during planning for use by the executor: */
1203
- Bitmapset *funcparams; /* PARAM_EXEC Param IDs affecting this func */
1204
- } RangeTblFunction;
1205
-
1206
- /*
1207
- * TableSampleClause - TABLESAMPLE appearing in a transformed FROM clause
1208
- *
1209
- * Unlike RangeTableSample, this is a subnode of the relevant RangeTblEntry.
1210
- */
1211
- typedef struct TableSampleClause
1212
- {
1213
- NodeTag type;
1214
- Oid tsmhandler; /* OID of the tablesample handler function */
1215
- List *args; /* tablesample argument expression(s) */
1216
- Expr *repeatable; /* REPEATABLE expression, or NULL if none */
1217
- } TableSampleClause;
1218
-
1219
- /*
1220
- * WithCheckOption -
1221
- * representation of WITH CHECK OPTION checks to be applied to new tuples
1222
- * when inserting/updating an auto-updatable view, or RLS WITH CHECK
1223
- * policies to be applied when inserting/updating a relation with RLS.
1224
- */
1225
- typedef enum WCOKind
1226
- {
1227
- WCO_VIEW_CHECK, /* WCO on an auto-updatable view */
1228
- WCO_RLS_INSERT_CHECK, /* RLS INSERT WITH CHECK policy */
1229
- WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */
1230
- WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO UPDATE USING policy */
1231
- WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */
1232
- WCO_RLS_MERGE_DELETE_CHECK /* RLS MERGE DELETE USING policy */
1233
- } WCOKind;
1234
-
1235
- typedef struct WithCheckOption
1236
- {
1237
- NodeTag type;
1238
- WCOKind kind; /* kind of WCO */
1239
- char *relname; /* name of relation that specified the WCO */
1240
- char *polname; /* name of RLS policy being checked */
1241
- Node *qual; /* constraint qual to check */
1242
- bool cascaded; /* true for a cascaded WCO on a view */
1243
- } WithCheckOption;
1244
-
1245
- /*
1246
- * SortGroupClause -
1247
- * representation of ORDER BY, GROUP BY, PARTITION BY,
1248
- * DISTINCT, DISTINCT ON items
1249
- *
1250
- * You might think that ORDER BY is only interested in defining ordering,
1251
- * and GROUP/DISTINCT are only interested in defining equality. However,
1252
- * one way to implement grouping is to sort and then apply a "uniq"-like
1253
- * filter. So it's also interesting to keep track of possible sort operators
1254
- * for GROUP/DISTINCT, and in particular to try to sort for the grouping
1255
- * in a way that will also yield a requested ORDER BY ordering. So we need
1256
- * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates
1257
- * the decision to give them the same representation.
1258
- *
1259
- * tleSortGroupRef must match ressortgroupref of exactly one entry of the
1260
- * query's targetlist; that is the expression to be sorted or grouped by.
1261
- * eqop is the OID of the equality operator.
1262
- * sortop is the OID of the ordering operator (a "<" or ">" operator),
1263
- * or InvalidOid if not available.
1264
- * nulls_first means about what you'd expect. If sortop is InvalidOid
1265
- * then nulls_first is meaningless and should be set to false.
1266
- * hashable is true if eqop is hashable (note this condition also depends
1267
- * on the datatype of the input expression).
1268
- *
1269
- * In an ORDER BY item, all fields must be valid. (The eqop isn't essential
1270
- * here, but it's cheap to get it along with the sortop, and requiring it
1271
- * to be valid eases comparisons to grouping items.) Note that this isn't
1272
- * actually enough information to determine an ordering: if the sortop is
1273
- * collation-sensitive, a collation OID is needed too. We don't store the
1274
- * collation in SortGroupClause because it's not available at the time the
1275
- * parser builds the SortGroupClause; instead, consult the exposed collation
1276
- * of the referenced targetlist expression to find out what it is.
1277
- *
1278
- * In a grouping item, eqop must be valid. If the eqop is a btree equality
1279
- * operator, then sortop should be set to a compatible ordering operator.
1280
- * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that
1281
- * the query presents for the same tlist item. If there is none, we just
1282
- * use the default ordering op for the datatype.
1283
- *
1284
- * If the tlist item's type has a hash opclass but no btree opclass, then
1285
- * we will set eqop to the hash equality operator, sortop to InvalidOid,
1286
- * and nulls_first to false. A grouping item of this kind can only be
1287
- * implemented by hashing, and of course it'll never match an ORDER BY item.
1288
- *
1289
- * The hashable flag is provided since we generally have the requisite
1290
- * information readily available when the SortGroupClause is constructed,
1291
- * and it's relatively expensive to get it again later. Note there is no
1292
- * need for a "sortable" flag since OidIsValid(sortop) serves the purpose.
1293
- *
1294
- * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses.
1295
- * In SELECT DISTINCT, the distinctClause list is as long or longer than the
1296
- * sortClause list, while in SELECT DISTINCT ON it's typically shorter.
1297
- * The two lists must match up to the end of the shorter one --- the parser
1298
- * rearranges the distinctClause if necessary to make this true. (This
1299
- * restriction ensures that only one sort step is needed to both satisfy the
1300
- * ORDER BY and set up for the Unique step. This is semantically necessary
1301
- * for DISTINCT ON, and presents no real drawback for DISTINCT.)
1302
- */
1303
- typedef struct SortGroupClause
1304
- {
1305
- NodeTag type;
1306
- Index tleSortGroupRef; /* reference into targetlist */
1307
- Oid eqop; /* the equality operator ('=' op) */
1308
- Oid sortop; /* the ordering operator ('<' op), or 0 */
1309
- bool nulls_first; /* do NULLs come before normal values? */
1310
- bool hashable; /* can eqop be implemented by hashing? */
1311
- } SortGroupClause;
1312
-
1313
- /*
1314
- * GroupingSet -
1315
- * representation of CUBE, ROLLUP and GROUPING SETS clauses
1316
- *
1317
- * In a Query with grouping sets, the groupClause contains a flat list of
1318
- * SortGroupClause nodes for each distinct expression used. The actual
1319
- * structure of the GROUP BY clause is given by the groupingSets tree.
1320
- *
1321
- * In the raw parser output, GroupingSet nodes (of all types except SIMPLE
1322
- * which is not used) are potentially mixed in with the expressions in the
1323
- * groupClause of the SelectStmt. (An expression can't contain a GroupingSet,
1324
- * but a list may mix GroupingSet and expression nodes.) At this stage, the
1325
- * content of each node is a list of expressions, some of which may be RowExprs
1326
- * which represent sublists rather than actual row constructors, and nested
1327
- * GroupingSet nodes where legal in the grammar. The structure directly
1328
- * reflects the query syntax.
1329
- *
1330
- * In parse analysis, the transformed expressions are used to build the tlist
1331
- * and groupClause list (of SortGroupClause nodes), and the groupingSets tree
1332
- * is eventually reduced to a fixed format:
1333
- *
1334
- * EMPTY nodes represent (), and obviously have no content
1335
- *
1336
- * SIMPLE nodes represent a list of one or more expressions to be treated as an
1337
- * atom by the enclosing structure; the content is an integer list of
1338
- * ressortgroupref values (see SortGroupClause)
1339
- *
1340
- * CUBE and ROLLUP nodes contain a list of one or more SIMPLE nodes.
1341
- *
1342
- * SETS nodes contain a list of EMPTY, SIMPLE, CUBE or ROLLUP nodes, but after
1343
- * parse analysis they cannot contain more SETS nodes; enough of the syntactic
1344
- * transforms of the spec have been applied that we no longer have arbitrarily
1345
- * deep nesting (though we still preserve the use of cube/rollup).
1346
- *
1347
- * Note that if the groupingSets tree contains no SIMPLE nodes (only EMPTY
1348
- * nodes at the leaves), then the groupClause will be empty, but this is still
1349
- * an aggregation query (similar to using aggs or HAVING without GROUP BY).
1350
- *
1351
- * As an example, the following clause:
1352
- *
1353
- * GROUP BY GROUPING SETS ((a,b), CUBE(c,(d,e)))
1354
- *
1355
- * looks like this after raw parsing:
1356
- *
1357
- * SETS( RowExpr(a,b) , CUBE( c, RowExpr(d,e) ) )
1358
- *
1359
- * and parse analysis converts it to:
1360
- *
1361
- * SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) )
1362
- */
1363
- typedef enum GroupingSetKind
1364
- {
1365
- GROUPING_SET_EMPTY,
1366
- GROUPING_SET_SIMPLE,
1367
- GROUPING_SET_ROLLUP,
1368
- GROUPING_SET_CUBE,
1369
- GROUPING_SET_SETS
1370
- } GroupingSetKind;
1371
-
1372
- typedef struct GroupingSet
1373
- {
1374
- NodeTag type;
1375
- GroupingSetKind kind;
1376
- List *content;
1377
- int location;
1378
- } GroupingSet;
1379
-
1380
- /*
1381
- * WindowClause -
1382
- * transformed representation of WINDOW and OVER clauses
1383
- *
1384
- * A parsed Query's windowClause list contains these structs. "name" is set
1385
- * if the clause originally came from WINDOW, and is NULL if it originally
1386
- * was an OVER clause (but note that we collapse out duplicate OVERs).
1387
- * partitionClause and orderClause are lists of SortGroupClause structs.
1388
- * If we have RANGE with offset PRECEDING/FOLLOWING, the semantics of that are
1389
- * specified by startInRangeFunc/inRangeColl/inRangeAsc/inRangeNullsFirst
1390
- * for the start offset, or endInRangeFunc/inRange* for the end offset.
1391
- * winref is an ID number referenced by WindowFunc nodes; it must be unique
1392
- * among the members of a Query's windowClause list.
1393
- * When refname isn't null, the partitionClause is always copied from there;
1394
- * the orderClause might or might not be copied (see copiedOrder); the framing
1395
- * options are never copied, per spec.
1396
- */
1397
- typedef struct WindowClause
1398
- {
1399
- NodeTag type;
1400
- char *name; /* window name (NULL in an OVER clause) */
1401
- char *refname; /* referenced window name, if any */
1402
- List *partitionClause; /* PARTITION BY list */
1403
- List *orderClause; /* ORDER BY list */
1404
- int frameOptions; /* frame_clause options, see WindowDef */
1405
- Node *startOffset; /* expression for starting bound, if any */
1406
- Node *endOffset; /* expression for ending bound, if any */
1407
- List *runCondition; /* qual to help short-circuit execution */
1408
- Oid startInRangeFunc; /* in_range function for startOffset */
1409
- Oid endInRangeFunc; /* in_range function for endOffset */
1410
- Oid inRangeColl; /* collation for in_range tests */
1411
- bool inRangeAsc; /* use ASC sort order for in_range tests? */
1412
- bool inRangeNullsFirst; /* nulls sort first for in_range tests? */
1413
- Index winref; /* ID referenced by window functions */
1414
- bool copiedOrder; /* did we copy orderClause from refname? */
1415
- } WindowClause;
1416
-
1417
- /*
1418
- * RowMarkClause -
1419
- * parser output representation of FOR [KEY] UPDATE/SHARE clauses
1420
- *
1421
- * Query.rowMarks contains a separate RowMarkClause node for each relation
1422
- * identified as a FOR [KEY] UPDATE/SHARE target. If one of these clauses
1423
- * is applied to a subquery, we generate RowMarkClauses for all normal and
1424
- * subquery rels in the subquery, but they are marked pushedDown = true to
1425
- * distinguish them from clauses that were explicitly written at this query
1426
- * level. Also, Query.hasForUpdate tells whether there were explicit FOR
1427
- * UPDATE/SHARE/KEY SHARE clauses in the current query level.
1428
- */
1429
- typedef struct RowMarkClause
1430
- {
1431
- NodeTag type;
1432
- Index rti; /* range table index of target relation */
1433
- LockClauseStrength strength;
1434
- LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
1435
- bool pushedDown; /* pushed down from higher query level? */
1436
- } RowMarkClause;
1437
-
1438
- /*
1439
- * WithClause -
1440
- * representation of WITH clause
1441
- *
1442
- * Note: WithClause does not propagate into the Query representation;
1443
- * but CommonTableExpr does.
1444
- */
1445
- typedef struct WithClause
1446
- {
1447
- NodeTag type;
1448
- List *ctes; /* list of CommonTableExprs */
1449
- bool recursive; /* true = WITH RECURSIVE */
1450
- int location; /* token location, or -1 if unknown */
1451
- } WithClause;
1452
-
1453
- /*
1454
- * InferClause -
1455
- * ON CONFLICT unique index inference clause
1456
- *
1457
- * Note: InferClause does not propagate into the Query representation.
1458
- */
1459
- typedef struct InferClause
1460
- {
1461
- NodeTag type;
1462
- List *indexElems; /* IndexElems to infer unique index */
1463
- Node *whereClause; /* qualification (partial-index predicate) */
1464
- char *conname; /* Constraint name, or NULL if unnamed */
1465
- int location; /* token location, or -1 if unknown */
1466
- } InferClause;
1467
-
1468
- /*
1469
- * OnConflictClause -
1470
- * representation of ON CONFLICT clause
1471
- *
1472
- * Note: OnConflictClause does not propagate into the Query representation.
1473
- */
1474
- typedef struct OnConflictClause
1475
- {
1476
- NodeTag type;
1477
- OnConflictAction action; /* DO NOTHING or UPDATE? */
1478
- InferClause *infer; /* Optional index inference clause */
1479
- List *targetList; /* the target list (of ResTarget) */
1480
- Node *whereClause; /* qualifications */
1481
- int location; /* token location, or -1 if unknown */
1482
- } OnConflictClause;
1483
-
1484
- /*
1485
- * CommonTableExpr -
1486
- * representation of WITH list element
1487
- */
1488
-
1489
- typedef enum CTEMaterialize
1490
- {
1491
- CTEMaterializeDefault, /* no option specified */
1492
- CTEMaterializeAlways, /* MATERIALIZED */
1493
- CTEMaterializeNever /* NOT MATERIALIZED */
1494
- } CTEMaterialize;
1495
-
1496
- typedef struct CTESearchClause
1497
- {
1498
- NodeTag type;
1499
- List *search_col_list;
1500
- bool search_breadth_first;
1501
- char *search_seq_column;
1502
- int location;
1503
- } CTESearchClause;
1504
-
1505
- typedef struct CTECycleClause
1506
- {
1507
- NodeTag type;
1508
- List *cycle_col_list;
1509
- char *cycle_mark_column;
1510
- Node *cycle_mark_value;
1511
- Node *cycle_mark_default;
1512
- char *cycle_path_column;
1513
- int location;
1514
- /* These fields are set during parse analysis: */
1515
- Oid cycle_mark_type; /* common type of _value and _default */
1516
- int cycle_mark_typmod;
1517
- Oid cycle_mark_collation;
1518
- Oid cycle_mark_neop; /* <> operator for type */
1519
- } CTECycleClause;
1520
-
1521
- typedef struct CommonTableExpr
1522
- {
1523
- NodeTag type;
1524
- char *ctename; /* query name (never qualified) */
1525
- List *aliascolnames; /* optional list of column names */
1526
- CTEMaterialize ctematerialized; /* is this an optimization fence? */
1527
- /* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */
1528
- Node *ctequery; /* the CTE's subquery */
1529
- CTESearchClause *search_clause;
1530
- CTECycleClause *cycle_clause;
1531
- int location; /* token location, or -1 if unknown */
1532
- /* These fields are set during parse analysis: */
1533
- bool cterecursive; /* is this CTE actually recursive? */
1534
- int cterefcount; /* number of RTEs referencing this CTE
1535
- * (excluding internal self-references) */
1536
- List *ctecolnames; /* list of output column names */
1537
- List *ctecoltypes; /* OID list of output column type OIDs */
1538
- List *ctecoltypmods; /* integer list of output column typmods */
1539
- List *ctecolcollations; /* OID list of column collation OIDs */
1540
- } CommonTableExpr;
1541
-
1542
- /* Convenience macro to get the output tlist of a CTE's query */
1543
- #define GetCTETargetList(cte) \
1544
- (AssertMacro(IsA((cte)->ctequery, Query)), \
1545
- ((Query *) (cte)->ctequery)->commandType == CMD_SELECT ? \
1546
- ((Query *) (cte)->ctequery)->targetList : \
1547
- ((Query *) (cte)->ctequery)->returningList)
1548
-
1549
- /*
1550
- * MergeWhenClause -
1551
- * raw parser representation of a WHEN clause in a MERGE statement
1552
- *
1553
- * This is transformed into MergeAction by parse analysis
1554
- */
1555
- typedef struct MergeWhenClause
1556
- {
1557
- NodeTag type;
1558
- bool matched; /* true=MATCHED, false=NOT MATCHED */
1559
- CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1560
- OverridingKind override; /* OVERRIDING clause */
1561
- Node *condition; /* WHEN conditions (raw parser) */
1562
- List *targetList; /* INSERT/UPDATE targetlist */
1563
- /* the following members are only used in INSERT actions */
1564
- List *values; /* VALUES to INSERT, or NULL */
1565
- } MergeWhenClause;
1566
-
1567
- /*
1568
- * MergeAction -
1569
- * Transformed representation of a WHEN clause in a MERGE statement
1570
- */
1571
- typedef struct MergeAction
1572
- {
1573
- NodeTag type;
1574
- bool matched; /* true=MATCHED, false=NOT MATCHED */
1575
- CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1576
- OverridingKind override; /* OVERRIDING clause */
1577
- Node *qual; /* transformed WHEN conditions */
1578
- List *targetList; /* the target list (of TargetEntry) */
1579
- List *updateColnos; /* target attribute numbers of an UPDATE */
1580
- } MergeAction;
1581
-
1582
- /*
1583
- * TriggerTransition -
1584
- * representation of transition row or table naming clause
1585
- *
1586
- * Only transition tables are initially supported in the syntax, and only for
1587
- * AFTER triggers, but other permutations are accepted by the parser so we can
1588
- * give a meaningful message from C code.
1589
- */
1590
- typedef struct TriggerTransition
1591
- {
1592
- NodeTag type;
1593
- char *name;
1594
- bool isNew;
1595
- bool isTable;
1596
- } TriggerTransition;
1597
-
1598
- /*****************************************************************************
1599
- * Raw Grammar Output Statements
1600
- *****************************************************************************/
1601
-
1602
- /*
1603
- * RawStmt --- container for any one statement's raw parse tree
1604
- *
1605
- * Parse analysis converts a raw parse tree headed by a RawStmt node into
1606
- * an analyzed statement headed by a Query node. For optimizable statements,
1607
- * the conversion is complex. For utility statements, the parser usually just
1608
- * transfers the raw parse tree (sans RawStmt) into the utilityStmt field of
1609
- * the Query node, and all the useful work happens at execution time.
1610
- *
1611
- * stmt_location/stmt_len identify the portion of the source text string
1612
- * containing this raw statement (useful for multi-statement strings).
1613
- */
1614
- typedef struct RawStmt
1615
- {
1616
- NodeTag type;
1617
- Node *stmt; /* raw parse tree */
1618
- int stmt_location; /* start location, or -1 if unknown */
1619
- int stmt_len; /* length in bytes; 0 means "rest of string" */
1620
- } RawStmt;
1621
-
1622
- /*****************************************************************************
1623
- * Optimizable Statements
1624
- *****************************************************************************/
1625
-
1626
- /* ----------------------
1627
- * Insert Statement
1628
- *
1629
- * The source expression is represented by SelectStmt for both the
1630
- * SELECT and VALUES cases. If selectStmt is NULL, then the query
1631
- * is INSERT ... DEFAULT VALUES.
1632
- * ----------------------
1633
- */
1634
- typedef struct InsertStmt
1635
- {
1636
- NodeTag type;
1637
- RangeVar *relation; /* relation to insert into */
1638
- List *cols; /* optional: names of the target columns */
1639
- Node *selectStmt; /* the source SELECT/VALUES, or NULL */
1640
- OnConflictClause *onConflictClause; /* ON CONFLICT clause */
1641
- List *returningList; /* list of expressions to return */
1642
- WithClause *withClause; /* WITH clause */
1643
- OverridingKind override; /* OVERRIDING clause */
1644
- } InsertStmt;
1645
-
1646
- /* ----------------------
1647
- * Delete Statement
1648
- * ----------------------
1649
- */
1650
- typedef struct DeleteStmt
1651
- {
1652
- NodeTag type;
1653
- RangeVar *relation; /* relation to delete from */
1654
- List *usingClause; /* optional using clause for more tables */
1655
- Node *whereClause; /* qualifications */
1656
- List *returningList; /* list of expressions to return */
1657
- WithClause *withClause; /* WITH clause */
1658
- } DeleteStmt;
1659
-
1660
- /* ----------------------
1661
- * Update Statement
1662
- * ----------------------
1663
- */
1664
- typedef struct UpdateStmt
1665
- {
1666
- NodeTag type;
1667
- RangeVar *relation; /* relation to update */
1668
- List *targetList; /* the target list (of ResTarget) */
1669
- Node *whereClause; /* qualifications */
1670
- List *fromClause; /* optional from clause for more tables */
1671
- List *returningList; /* list of expressions to return */
1672
- WithClause *withClause; /* WITH clause */
1673
- } UpdateStmt;
1674
-
1675
- /* ----------------------
1676
- * Merge Statement
1677
- * ----------------------
1678
- */
1679
- typedef struct MergeStmt
1680
- {
1681
- NodeTag type;
1682
- RangeVar *relation; /* target relation to merge into */
1683
- Node *sourceRelation; /* source relation */
1684
- Node *joinCondition; /* join condition between source and target */
1685
- List *mergeWhenClauses; /* list of MergeWhenClause(es) */
1686
- WithClause *withClause; /* WITH clause */
1687
- } MergeStmt;
1688
-
1689
- /* ----------------------
1690
- * Select Statement
1691
- *
1692
- * A "simple" SELECT is represented in the output of gram.y by a single
1693
- * SelectStmt node; so is a VALUES construct. A query containing set
1694
- * operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt
1695
- * nodes, in which the leaf nodes are component SELECTs and the internal nodes
1696
- * represent UNION, INTERSECT, or EXCEPT operators. Using the same node
1697
- * type for both leaf and internal nodes allows gram.y to stick ORDER BY,
1698
- * LIMIT, etc, clause values into a SELECT statement without worrying
1699
- * whether it is a simple or compound SELECT.
1700
- * ----------------------
1701
- */
1702
- typedef enum SetOperation
1703
- {
1704
- SETOP_NONE = 0,
1705
- SETOP_UNION,
1706
- SETOP_INTERSECT,
1707
- SETOP_EXCEPT
1708
- } SetOperation;
1709
-
1710
- typedef struct SelectStmt
1711
- {
1712
- NodeTag type;
1713
-
1714
- /*
1715
- * These fields are used only in "leaf" SelectStmts.
1716
- */
1717
- List *distinctClause; /* NULL, list of DISTINCT ON exprs, or
1718
- * lcons(NIL,NIL) for all (SELECT DISTINCT) */
1719
- IntoClause *intoClause; /* target for SELECT INTO */
1720
- List *targetList; /* the target list (of ResTarget) */
1721
- List *fromClause; /* the FROM clause */
1722
- Node *whereClause; /* WHERE qualification */
1723
- List *groupClause; /* GROUP BY clauses */
1724
- bool groupDistinct; /* Is this GROUP BY DISTINCT? */
1725
- Node *havingClause; /* HAVING conditional-expression */
1726
- List *windowClause; /* WINDOW window_name AS (...), ... */
1727
-
1728
- /*
1729
- * In a "leaf" node representing a VALUES list, the above fields are all
1730
- * null, and instead this field is set. Note that the elements of the
1731
- * sublists are just expressions, without ResTarget decoration. Also note
1732
- * that a list element can be DEFAULT (represented as a SetToDefault
1733
- * node), regardless of the context of the VALUES list. It's up to parse
1734
- * analysis to reject that where not valid.
1735
- */
1736
- List *valuesLists; /* untransformed list of expression lists */
1737
-
1738
- /*
1739
- * These fields are used in both "leaf" SelectStmts and upper-level
1740
- * SelectStmts.
1741
- */
1742
- List *sortClause; /* sort clause (a list of SortBy's) */
1743
- Node *limitOffset; /* # of result tuples to skip */
1744
- Node *limitCount; /* # of result tuples to return */
1745
- LimitOption limitOption; /* limit type */
1746
- List *lockingClause; /* FOR UPDATE (list of LockingClause's) */
1747
- WithClause *withClause; /* WITH clause */
1748
-
1749
- /*
1750
- * These fields are used only in upper-level SelectStmts.
1751
- */
1752
- SetOperation op; /* type of set op */
1753
- bool all; /* ALL specified? */
1754
- struct SelectStmt *larg; /* left child */
1755
- struct SelectStmt *rarg; /* right child */
1756
- /* Eventually add fields for CORRESPONDING spec here */
1757
- } SelectStmt;
1758
-
1759
-
1760
- /* ----------------------
1761
- * Set Operation node for post-analysis query trees
1762
- *
1763
- * After parse analysis, a SELECT with set operations is represented by a
1764
- * top-level Query node containing the leaf SELECTs as subqueries in its
1765
- * range table. Its setOperations field shows the tree of set operations,
1766
- * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal
1767
- * nodes replaced by SetOperationStmt nodes. Information about the output
1768
- * column types is added, too. (Note that the child nodes do not necessarily
1769
- * produce these types directly, but we've checked that their output types
1770
- * can be coerced to the output column type.) Also, if it's not UNION ALL,
1771
- * information about the types' sort/group semantics is provided in the form
1772
- * of a SortGroupClause list (same representation as, eg, DISTINCT).
1773
- * The resolved common column collations are provided too; but note that if
1774
- * it's not UNION ALL, it's okay for a column to not have a common collation,
1775
- * so a member of the colCollations list could be InvalidOid even though the
1776
- * column has a collatable type.
1777
- * ----------------------
1778
- */
1779
- typedef struct SetOperationStmt
1780
- {
1781
- NodeTag type;
1782
- SetOperation op; /* type of set op */
1783
- bool all; /* ALL specified? */
1784
- Node *larg; /* left child */
1785
- Node *rarg; /* right child */
1786
- /* Eventually add fields for CORRESPONDING spec here */
1787
-
1788
- /* Fields derived during parse analysis: */
1789
- List *colTypes; /* OID list of output column type OIDs */
1790
- List *colTypmods; /* integer list of output column typmods */
1791
- List *colCollations; /* OID list of output column collation OIDs */
1792
- List *groupClauses; /* a list of SortGroupClause's */
1793
- /* groupClauses is NIL if UNION ALL, but must be set otherwise */
1794
- } SetOperationStmt;
1795
-
1796
-
1797
- /*
1798
- * RETURN statement (inside SQL function body)
1799
- */
1800
- typedef struct ReturnStmt
1801
- {
1802
- NodeTag type;
1803
- Node *returnval;
1804
- } ReturnStmt;
1805
-
1806
-
1807
- /* ----------------------
1808
- * PL/pgSQL Assignment Statement
1809
- *
1810
- * Like SelectStmt, this is transformed into a SELECT Query.
1811
- * However, the targetlist of the result looks more like an UPDATE.
1812
- * ----------------------
1813
- */
1814
- typedef struct PLAssignStmt
1815
- {
1816
- NodeTag type;
1817
-
1818
- char *name; /* initial column name */
1819
- List *indirection; /* subscripts and field names, if any */
1820
- int nnames; /* number of names to use in ColumnRef */
1821
- SelectStmt *val; /* the PL/pgSQL expression to assign */
1822
- int location; /* name's token location, or -1 if unknown */
1823
- } PLAssignStmt;
1824
-
1825
-
1826
- /*****************************************************************************
1827
- * Other Statements (no optimizations required)
1828
- *
1829
- * These are not touched by parser/analyze.c except to put them into
1830
- * the utilityStmt field of a Query. This is eventually passed to
1831
- * ProcessUtility (by-passing rewriting and planning). Some of the
1832
- * statements do need attention from parse analysis, and this is
1833
- * done by routines in parser/parse_utilcmd.c after ProcessUtility
1834
- * receives the command for execution.
1835
- * DECLARE CURSOR, EXPLAIN, and CREATE TABLE AS are special cases:
1836
- * they contain optimizable statements, which get processed normally
1837
- * by parser/analyze.c.
1838
- *****************************************************************************/
1839
-
1840
- /*
1841
- * When a command can act on several kinds of objects with only one
1842
- * parse structure required, use these constants to designate the
1843
- * object type. Note that commands typically don't support all the types.
1844
- */
1845
-
1846
- typedef enum ObjectType
1847
- {
1848
- OBJECT_ACCESS_METHOD,
1849
- OBJECT_AGGREGATE,
1850
- OBJECT_AMOP,
1851
- OBJECT_AMPROC,
1852
- OBJECT_ATTRIBUTE, /* type's attribute, when distinct from column */
1853
- OBJECT_CAST,
1854
- OBJECT_COLUMN,
1855
- OBJECT_COLLATION,
1856
- OBJECT_CONVERSION,
1857
- OBJECT_DATABASE,
1858
- OBJECT_DEFAULT,
1859
- OBJECT_DEFACL,
1860
- OBJECT_DOMAIN,
1861
- OBJECT_DOMCONSTRAINT,
1862
- OBJECT_EVENT_TRIGGER,
1863
- OBJECT_EXTENSION,
1864
- OBJECT_FDW,
1865
- OBJECT_FOREIGN_SERVER,
1866
- OBJECT_FOREIGN_TABLE,
1867
- OBJECT_FUNCTION,
1868
- OBJECT_INDEX,
1869
- OBJECT_LANGUAGE,
1870
- OBJECT_LARGEOBJECT,
1871
- OBJECT_MATVIEW,
1872
- OBJECT_OPCLASS,
1873
- OBJECT_OPERATOR,
1874
- OBJECT_OPFAMILY,
1875
- OBJECT_PARAMETER_ACL,
1876
- OBJECT_POLICY,
1877
- OBJECT_PROCEDURE,
1878
- OBJECT_PUBLICATION,
1879
- OBJECT_PUBLICATION_NAMESPACE,
1880
- OBJECT_PUBLICATION_REL,
1881
- OBJECT_ROLE,
1882
- OBJECT_ROUTINE,
1883
- OBJECT_RULE,
1884
- OBJECT_SCHEMA,
1885
- OBJECT_SEQUENCE,
1886
- OBJECT_SUBSCRIPTION,
1887
- OBJECT_STATISTIC_EXT,
1888
- OBJECT_TABCONSTRAINT,
1889
- OBJECT_TABLE,
1890
- OBJECT_TABLESPACE,
1891
- OBJECT_TRANSFORM,
1892
- OBJECT_TRIGGER,
1893
- OBJECT_TSCONFIGURATION,
1894
- OBJECT_TSDICTIONARY,
1895
- OBJECT_TSPARSER,
1896
- OBJECT_TSTEMPLATE,
1897
- OBJECT_TYPE,
1898
- OBJECT_USER_MAPPING,
1899
- OBJECT_VIEW
1900
- } ObjectType;
1901
-
1902
- /* ----------------------
1903
- * Create Schema Statement
1904
- *
1905
- * NOTE: the schemaElts list contains raw parsetrees for component statements
1906
- * of the schema, such as CREATE TABLE, GRANT, etc. These are analyzed and
1907
- * executed after the schema itself is created.
1908
- * ----------------------
1909
- */
1910
- typedef struct CreateSchemaStmt
1911
- {
1912
- NodeTag type;
1913
- char *schemaname; /* the name of the schema to create */
1914
- RoleSpec *authrole; /* the owner of the created schema */
1915
- List *schemaElts; /* schema components (list of parsenodes) */
1916
- bool if_not_exists; /* just do nothing if schema already exists? */
1917
- } CreateSchemaStmt;
1918
-
1919
- typedef enum DropBehavior
1920
- {
1921
- DROP_RESTRICT, /* drop fails if any dependent objects */
1922
- DROP_CASCADE /* remove dependent objects too */
1923
- } DropBehavior;
1924
-
1925
- /* ----------------------
1926
- * Alter Table
1927
- * ----------------------
1928
- */
1929
- typedef struct AlterTableStmt
1930
- {
1931
- NodeTag type;
1932
- RangeVar *relation; /* table to work on */
1933
- List *cmds; /* list of subcommands */
1934
- ObjectType objtype; /* type of object */
1935
- bool missing_ok; /* skip error if table missing */
1936
- } AlterTableStmt;
1937
-
1938
- typedef enum AlterTableType
1939
- {
1940
- AT_AddColumn, /* add column */
1941
- AT_AddColumnRecurse, /* internal to commands/tablecmds.c */
1942
- AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */
1943
- AT_ColumnDefault, /* alter column default */
1944
- AT_CookedColumnDefault, /* add a pre-cooked column default */
1945
- AT_DropNotNull, /* alter column drop not null */
1946
- AT_SetNotNull, /* alter column set not null */
1947
- AT_DropExpression, /* alter column drop expression */
1948
- AT_CheckNotNull, /* check column is already marked not null */
1949
- AT_SetStatistics, /* alter column set statistics */
1950
- AT_SetOptions, /* alter column set ( options ) */
1951
- AT_ResetOptions, /* alter column reset ( options ) */
1952
- AT_SetStorage, /* alter column set storage */
1953
- AT_SetCompression, /* alter column set compression */
1954
- AT_DropColumn, /* drop column */
1955
- AT_DropColumnRecurse, /* internal to commands/tablecmds.c */
1956
- AT_AddIndex, /* add index */
1957
- AT_ReAddIndex, /* internal to commands/tablecmds.c */
1958
- AT_AddConstraint, /* add constraint */
1959
- AT_AddConstraintRecurse, /* internal to commands/tablecmds.c */
1960
- AT_ReAddConstraint, /* internal to commands/tablecmds.c */
1961
- AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */
1962
- AT_AlterConstraint, /* alter constraint */
1963
- AT_ValidateConstraint, /* validate constraint */
1964
- AT_ValidateConstraintRecurse, /* internal to commands/tablecmds.c */
1965
- AT_AddIndexConstraint, /* add constraint using existing index */
1966
- AT_DropConstraint, /* drop constraint */
1967
- AT_DropConstraintRecurse, /* internal to commands/tablecmds.c */
1968
- AT_ReAddComment, /* internal to commands/tablecmds.c */
1969
- AT_AlterColumnType, /* alter column type */
1970
- AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */
1971
- AT_ChangeOwner, /* change owner */
1972
- AT_ClusterOn, /* CLUSTER ON */
1973
- AT_DropCluster, /* SET WITHOUT CLUSTER */
1974
- AT_SetLogged, /* SET LOGGED */
1975
- AT_SetUnLogged, /* SET UNLOGGED */
1976
- AT_DropOids, /* SET WITHOUT OIDS */
1977
- AT_SetAccessMethod, /* SET ACCESS METHOD */
1978
- AT_SetTableSpace, /* SET TABLESPACE */
1979
- AT_SetRelOptions, /* SET (...) -- AM specific parameters */
1980
- AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */
1981
- AT_ReplaceRelOptions, /* replace reloption list in its entirety */
1982
- AT_EnableTrig, /* ENABLE TRIGGER name */
1983
- AT_EnableAlwaysTrig, /* ENABLE ALWAYS TRIGGER name */
1984
- AT_EnableReplicaTrig, /* ENABLE REPLICA TRIGGER name */
1985
- AT_DisableTrig, /* DISABLE TRIGGER name */
1986
- AT_EnableTrigAll, /* ENABLE TRIGGER ALL */
1987
- AT_DisableTrigAll, /* DISABLE TRIGGER ALL */
1988
- AT_EnableTrigUser, /* ENABLE TRIGGER USER */
1989
- AT_DisableTrigUser, /* DISABLE TRIGGER USER */
1990
- AT_EnableRule, /* ENABLE RULE name */
1991
- AT_EnableAlwaysRule, /* ENABLE ALWAYS RULE name */
1992
- AT_EnableReplicaRule, /* ENABLE REPLICA RULE name */
1993
- AT_DisableRule, /* DISABLE RULE name */
1994
- AT_AddInherit, /* INHERIT parent */
1995
- AT_DropInherit, /* NO INHERIT parent */
1996
- AT_AddOf, /* OF <type_name> */
1997
- AT_DropOf, /* NOT OF */
1998
- AT_ReplicaIdentity, /* REPLICA IDENTITY */
1999
- AT_EnableRowSecurity, /* ENABLE ROW SECURITY */
2000
- AT_DisableRowSecurity, /* DISABLE ROW SECURITY */
2001
- AT_ForceRowSecurity, /* FORCE ROW SECURITY */
2002
- AT_NoForceRowSecurity, /* NO FORCE ROW SECURITY */
2003
- AT_GenericOptions, /* OPTIONS (...) */
2004
- AT_AttachPartition, /* ATTACH PARTITION */
2005
- AT_DetachPartition, /* DETACH PARTITION */
2006
- AT_DetachPartitionFinalize, /* DETACH PARTITION FINALIZE */
2007
- AT_AddIdentity, /* ADD IDENTITY */
2008
- AT_SetIdentity, /* SET identity column options */
2009
- AT_DropIdentity, /* DROP IDENTITY */
2010
- AT_ReAddStatistics /* internal to commands/tablecmds.c */
2011
- } AlterTableType;
2012
-
2013
- typedef struct ReplicaIdentityStmt
2014
- {
2015
- NodeTag type;
2016
- char identity_type;
2017
- char *name;
2018
- } ReplicaIdentityStmt;
2019
-
2020
- typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
2021
- {
2022
- NodeTag type;
2023
- AlterTableType subtype; /* Type of table alteration to apply */
2024
- char *name; /* column, constraint, or trigger to act on,
2025
- * or tablespace */
2026
- int16 num; /* attribute number for columns referenced by
2027
- * number */
2028
- RoleSpec *newowner;
2029
- Node *def; /* definition of new column, index,
2030
- * constraint, or parent table */
2031
- DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2032
- bool missing_ok; /* skip error if missing? */
2033
- bool recurse; /* exec-time recursion */
2034
- } AlterTableCmd;
2035
-
2036
-
2037
- /* ----------------------
2038
- * Alter Collation
2039
- * ----------------------
2040
- */
2041
- typedef struct AlterCollationStmt
2042
- {
2043
- NodeTag type;
2044
- List *collname;
2045
- } AlterCollationStmt;
2046
-
2047
-
2048
- /* ----------------------
2049
- * Alter Domain
2050
- *
2051
- * The fields are used in different ways by the different variants of
2052
- * this command.
2053
- * ----------------------
2054
- */
2055
- typedef struct AlterDomainStmt
2056
- {
2057
- NodeTag type;
2058
- char subtype; /*------------
2059
- * T = alter column default
2060
- * N = alter column drop not null
2061
- * O = alter column set not null
2062
- * C = add constraint
2063
- * X = drop constraint
2064
- *------------
2065
- */
2066
- List *typeName; /* domain to work on */
2067
- char *name; /* column or constraint name to act on */
2068
- Node *def; /* definition of default or constraint */
2069
- DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2070
- bool missing_ok; /* skip error if missing? */
2071
- } AlterDomainStmt;
2072
-
2073
-
2074
- /* ----------------------
2075
- * Grant|Revoke Statement
2076
- * ----------------------
2077
- */
2078
- typedef enum GrantTargetType
2079
- {
2080
- ACL_TARGET_OBJECT, /* grant on specific named object(s) */
2081
- ACL_TARGET_ALL_IN_SCHEMA, /* grant on all objects in given schema(s) */
2082
- ACL_TARGET_DEFAULTS /* ALTER DEFAULT PRIVILEGES */
2083
- } GrantTargetType;
2084
-
2085
- typedef struct GrantStmt
2086
- {
2087
- NodeTag type;
2088
- bool is_grant; /* true = GRANT, false = REVOKE */
2089
- GrantTargetType targtype; /* type of the grant target */
2090
- ObjectType objtype; /* kind of object being operated on */
2091
- List *objects; /* list of RangeVar nodes, ObjectWithArgs
2092
- * nodes, or plain names (as String values) */
2093
- List *privileges; /* list of AccessPriv nodes */
2094
- /* privileges == NIL denotes ALL PRIVILEGES */
2095
- List *grantees; /* list of RoleSpec nodes */
2096
- bool grant_option; /* grant or revoke grant option */
2097
- RoleSpec *grantor;
2098
- DropBehavior behavior; /* drop behavior (for REVOKE) */
2099
- } GrantStmt;
2100
-
2101
- /*
2102
- * ObjectWithArgs represents a function/procedure/operator name plus parameter
2103
- * identification.
2104
- *
2105
- * objargs includes only the types of the input parameters of the object.
2106
- * In some contexts, that will be all we have, and it's enough to look up
2107
- * objects according to the traditional Postgres rules (i.e., when only input
2108
- * arguments matter).
2109
- *
2110
- * objfuncargs, if not NIL, carries the full specification of the parameter
2111
- * list, including parameter mode annotations.
2112
- *
2113
- * Some grammar productions can set args_unspecified = true instead of
2114
- * providing parameter info. In this case, lookup will succeed only if
2115
- * the object name is unique. Note that otherwise, NIL parameter lists
2116
- * mean zero arguments.
2117
- */
2118
- typedef struct ObjectWithArgs
2119
- {
2120
- NodeTag type;
2121
- List *objname; /* qualified name of function/operator */
2122
- List *objargs; /* list of Typename nodes (input args only) */
2123
- List *objfuncargs; /* list of FunctionParameter nodes */
2124
- bool args_unspecified; /* argument list was omitted? */
2125
- } ObjectWithArgs;
2126
-
2127
- /*
2128
- * An access privilege, with optional list of column names
2129
- * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list)
2130
- * cols == NIL denotes "all columns"
2131
- * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not
2132
- * an AccessPriv with both fields null.
2133
- */
2134
- typedef struct AccessPriv
2135
- {
2136
- NodeTag type;
2137
- char *priv_name; /* string name of privilege */
2138
- List *cols; /* list of String */
2139
- } AccessPriv;
2140
-
2141
- /* ----------------------
2142
- * Grant/Revoke Role Statement
2143
- *
2144
- * Note: because of the parsing ambiguity with the GRANT <privileges>
2145
- * statement, granted_roles is a list of AccessPriv; the execution code
2146
- * should complain if any column lists appear. grantee_roles is a list
2147
- * of role names, as String values.
2148
- * ----------------------
2149
- */
2150
- typedef struct GrantRoleStmt
2151
- {
2152
- NodeTag type;
2153
- List *granted_roles; /* list of roles to be granted/revoked */
2154
- List *grantee_roles; /* list of member roles to add/delete */
2155
- bool is_grant; /* true = GRANT, false = REVOKE */
2156
- bool admin_opt; /* with admin option */
2157
- RoleSpec *grantor; /* set grantor to other than current role */
2158
- DropBehavior behavior; /* drop behavior (for REVOKE) */
2159
- } GrantRoleStmt;
2160
-
2161
- /* ----------------------
2162
- * Alter Default Privileges Statement
2163
- * ----------------------
2164
- */
2165
- typedef struct AlterDefaultPrivilegesStmt
2166
- {
2167
- NodeTag type;
2168
- List *options; /* list of DefElem */
2169
- GrantStmt *action; /* GRANT/REVOKE action (with objects=NIL) */
2170
- } AlterDefaultPrivilegesStmt;
2171
-
2172
- /* ----------------------
2173
- * Copy Statement
2174
- *
2175
- * We support "COPY relation FROM file", "COPY relation TO file", and
2176
- * "COPY (query) TO file". In any given CopyStmt, exactly one of "relation"
2177
- * and "query" must be non-NULL.
2178
- * ----------------------
2179
- */
2180
- typedef struct CopyStmt
2181
- {
2182
- NodeTag type;
2183
- RangeVar *relation; /* the relation to copy */
2184
- Node *query; /* the query (SELECT or DML statement with
2185
- * RETURNING) to copy, as a raw parse tree */
2186
- List *attlist; /* List of column names (as Strings), or NIL
2187
- * for all columns */
2188
- bool is_from; /* TO or FROM */
2189
- bool is_program; /* is 'filename' a program to popen? */
2190
- char *filename; /* filename, or NULL for STDIN/STDOUT */
2191
- List *options; /* List of DefElem nodes */
2192
- Node *whereClause; /* WHERE condition (or NULL) */
2193
- } CopyStmt;
2194
-
2195
- /* ----------------------
2196
- * SET Statement (includes RESET)
2197
- *
2198
- * "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we
2199
- * preserve the distinction in VariableSetKind for CreateCommandTag().
2200
- * ----------------------
2201
- */
2202
- typedef enum VariableSetKind
2203
- {
2204
- VAR_SET_VALUE, /* SET var = value */
2205
- VAR_SET_DEFAULT, /* SET var TO DEFAULT */
2206
- VAR_SET_CURRENT, /* SET var FROM CURRENT */
2207
- VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
2208
- VAR_RESET, /* RESET var */
2209
- VAR_RESET_ALL /* RESET ALL */
2210
- } VariableSetKind;
2211
-
2212
- typedef struct VariableSetStmt
2213
- {
2214
- NodeTag type;
2215
- VariableSetKind kind;
2216
- char *name; /* variable to be set */
2217
- List *args; /* List of A_Const nodes */
2218
- bool is_local; /* SET LOCAL? */
2219
- } VariableSetStmt;
2220
-
2221
- /* ----------------------
2222
- * Show Statement
2223
- * ----------------------
2224
- */
2225
- typedef struct VariableShowStmt
2226
- {
2227
- NodeTag type;
2228
- char *name;
2229
- } VariableShowStmt;
2230
-
2231
- /* ----------------------
2232
- * Create Table Statement
2233
- *
2234
- * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are
2235
- * intermixed in tableElts, and constraints is NIL. After parse analysis,
2236
- * tableElts contains just ColumnDefs, and constraints contains just
2237
- * Constraint nodes (in fact, only CONSTR_CHECK nodes, in the present
2238
- * implementation).
2239
- * ----------------------
2240
- */
2241
-
2242
- typedef struct CreateStmt
2243
- {
2244
- NodeTag type;
2245
- RangeVar *relation; /* relation to create */
2246
- List *tableElts; /* column definitions (list of ColumnDef) */
2247
- List *inhRelations; /* relations to inherit from (list of
2248
- * RangeVar) */
2249
- PartitionBoundSpec *partbound; /* FOR VALUES clause */
2250
- PartitionSpec *partspec; /* PARTITION BY clause */
2251
- TypeName *ofTypename; /* OF typename */
2252
- List *constraints; /* constraints (list of Constraint nodes) */
2253
- List *options; /* options from WITH clause */
2254
- OnCommitAction oncommit; /* what do we do at COMMIT? */
2255
- char *tablespacename; /* table space to use, or NULL */
2256
- char *accessMethod; /* table access method */
2257
- bool if_not_exists; /* just do nothing if it already exists? */
2258
- } CreateStmt;
2259
-
2260
- /* ----------
2261
- * Definitions for constraints in CreateStmt
2262
- *
2263
- * Note that column defaults are treated as a type of constraint,
2264
- * even though that's a bit odd semantically.
2265
- *
2266
- * For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT)
2267
- * we may have the expression in either "raw" form (an untransformed
2268
- * parse tree) or "cooked" form (the nodeToString representation of
2269
- * an executable expression tree), depending on how this Constraint
2270
- * node was created (by parsing, or by inheritance from an existing
2271
- * relation). We should never have both in the same node!
2272
- *
2273
- * FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype
2274
- * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are
2275
- * stored into pg_constraint.confmatchtype. Changing the code values may
2276
- * require an initdb!
2277
- *
2278
- * If skip_validation is true then we skip checking that the existing rows
2279
- * in the table satisfy the constraint, and just install the catalog entries
2280
- * for the constraint. A new FK constraint is marked as valid iff
2281
- * initially_valid is true. (Usually skip_validation and initially_valid
2282
- * are inverses, but we can set both true if the table is known empty.)
2283
- *
2284
- * Constraint attributes (DEFERRABLE etc) are initially represented as
2285
- * separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes
2286
- * a pass through the constraints list to insert the info into the appropriate
2287
- * Constraint node.
2288
- * ----------
2289
- */
2290
-
2291
- typedef enum ConstrType /* types of constraints */
2292
- {
2293
- CONSTR_NULL, /* not standard SQL, but a lot of people
2294
- * expect it */
2295
- CONSTR_NOTNULL,
2296
- CONSTR_DEFAULT,
2297
- CONSTR_IDENTITY,
2298
- CONSTR_GENERATED,
2299
- CONSTR_CHECK,
2300
- CONSTR_PRIMARY,
2301
- CONSTR_UNIQUE,
2302
- CONSTR_EXCLUSION,
2303
- CONSTR_FOREIGN,
2304
- CONSTR_ATTR_DEFERRABLE, /* attributes for previous constraint node */
2305
- CONSTR_ATTR_NOT_DEFERRABLE,
2306
- CONSTR_ATTR_DEFERRED,
2307
- CONSTR_ATTR_IMMEDIATE
2308
- } ConstrType;
2309
-
2310
- /* Foreign key action codes */
2311
- #define FKCONSTR_ACTION_NOACTION 'a'
2312
- #define FKCONSTR_ACTION_RESTRICT 'r'
2313
- #define FKCONSTR_ACTION_CASCADE 'c'
2314
- #define FKCONSTR_ACTION_SETNULL 'n'
2315
- #define FKCONSTR_ACTION_SETDEFAULT 'd'
2316
-
2317
- /* Foreign key matchtype codes */
2318
- #define FKCONSTR_MATCH_FULL 'f'
2319
- #define FKCONSTR_MATCH_PARTIAL 'p'
2320
- #define FKCONSTR_MATCH_SIMPLE 's'
2321
-
2322
- typedef struct Constraint
2323
- {
2324
- NodeTag type;
2325
- ConstrType contype; /* see above */
2326
-
2327
- /* Fields used for most/all constraint types: */
2328
- char *conname; /* Constraint name, or NULL if unnamed */
2329
- bool deferrable; /* DEFERRABLE? */
2330
- bool initdeferred; /* INITIALLY DEFERRED? */
2331
- int location; /* token location, or -1 if unknown */
2332
-
2333
- /* Fields used for constraints with expressions (CHECK and DEFAULT): */
2334
- bool is_no_inherit; /* is constraint non-inheritable? */
2335
- Node *raw_expr; /* expr, as untransformed parse tree */
2336
- char *cooked_expr; /* expr, as nodeToString representation */
2337
- char generated_when; /* ALWAYS or BY DEFAULT */
2338
-
2339
- /* Fields used for unique constraints (UNIQUE and PRIMARY KEY): */
2340
- bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
2341
- List *keys; /* String nodes naming referenced key
2342
- * column(s) */
2343
- List *including; /* String nodes naming referenced nonkey
2344
- * column(s) */
2345
-
2346
- /* Fields used for EXCLUSION constraints: */
2347
- List *exclusions; /* list of (IndexElem, operator name) pairs */
2348
-
2349
- /* Fields used for index constraints (UNIQUE, PRIMARY KEY, EXCLUSION): */
2350
- List *options; /* options from WITH clause */
2351
- char *indexname; /* existing index to use; otherwise NULL */
2352
- char *indexspace; /* index tablespace; NULL for default */
2353
- bool reset_default_tblspc; /* reset default_tablespace prior to
2354
- * creating the index */
2355
- /* These could be, but currently are not, used for UNIQUE/PKEY: */
2356
- char *access_method; /* index access method; NULL for default */
2357
- Node *where_clause; /* partial index predicate */
2358
-
2359
- /* Fields used for FOREIGN KEY constraints: */
2360
- RangeVar *pktable; /* Primary key table */
2361
- List *fk_attrs; /* Attributes of foreign key */
2362
- List *pk_attrs; /* Corresponding attrs in PK table */
2363
- char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
2364
- char fk_upd_action; /* ON UPDATE action */
2365
- char fk_del_action; /* ON DELETE action */
2366
- List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */
2367
- List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
2368
- Oid old_pktable_oid; /* pg_constraint.confrelid of my former
2369
- * self */
2370
-
2371
- /* Fields used for constraints that allow a NOT VALID specification */
2372
- bool skip_validation; /* skip validation of existing rows? */
2373
- bool initially_valid; /* mark the new constraint as valid? */
2374
- } Constraint;
2375
-
2376
- /* ----------------------
2377
- * Create/Drop Table Space Statements
2378
- * ----------------------
2379
- */
2380
-
2381
- typedef struct CreateTableSpaceStmt
2382
- {
2383
- NodeTag type;
2384
- char *tablespacename;
2385
- RoleSpec *owner;
2386
- char *location;
2387
- List *options;
2388
- } CreateTableSpaceStmt;
2389
-
2390
- typedef struct DropTableSpaceStmt
2391
- {
2392
- NodeTag type;
2393
- char *tablespacename;
2394
- bool missing_ok; /* skip error if missing? */
2395
- } DropTableSpaceStmt;
2396
-
2397
- typedef struct AlterTableSpaceOptionsStmt
2398
- {
2399
- NodeTag type;
2400
- char *tablespacename;
2401
- List *options;
2402
- bool isReset;
2403
- } AlterTableSpaceOptionsStmt;
2404
-
2405
- typedef struct AlterTableMoveAllStmt
2406
- {
2407
- NodeTag type;
2408
- char *orig_tablespacename;
2409
- ObjectType objtype; /* Object type to move */
2410
- List *roles; /* List of roles to move objects of */
2411
- char *new_tablespacename;
2412
- bool nowait;
2413
- } AlterTableMoveAllStmt;
2414
-
2415
- /* ----------------------
2416
- * Create/Alter Extension Statements
2417
- * ----------------------
2418
- */
2419
-
2420
- typedef struct CreateExtensionStmt
2421
- {
2422
- NodeTag type;
2423
- char *extname;
2424
- bool if_not_exists; /* just do nothing if it already exists? */
2425
- List *options; /* List of DefElem nodes */
2426
- } CreateExtensionStmt;
2427
-
2428
- /* Only used for ALTER EXTENSION UPDATE; later might need an action field */
2429
- typedef struct AlterExtensionStmt
2430
- {
2431
- NodeTag type;
2432
- char *extname;
2433
- List *options; /* List of DefElem nodes */
2434
- } AlterExtensionStmt;
2435
-
2436
- typedef struct AlterExtensionContentsStmt
2437
- {
2438
- NodeTag type;
2439
- char *extname; /* Extension's name */
2440
- int action; /* +1 = add object, -1 = drop object */
2441
- ObjectType objtype; /* Object's type */
2442
- Node *object; /* Qualified name of the object */
2443
- } AlterExtensionContentsStmt;
2444
-
2445
- /* ----------------------
2446
- * Create/Alter FOREIGN DATA WRAPPER Statements
2447
- * ----------------------
2448
- */
2449
-
2450
- typedef struct CreateFdwStmt
2451
- {
2452
- NodeTag type;
2453
- char *fdwname; /* foreign-data wrapper name */
2454
- List *func_options; /* HANDLER/VALIDATOR options */
2455
- List *options; /* generic options to FDW */
2456
- } CreateFdwStmt;
2457
-
2458
- typedef struct AlterFdwStmt
2459
- {
2460
- NodeTag type;
2461
- char *fdwname; /* foreign-data wrapper name */
2462
- List *func_options; /* HANDLER/VALIDATOR options */
2463
- List *options; /* generic options to FDW */
2464
- } AlterFdwStmt;
2465
-
2466
- /* ----------------------
2467
- * Create/Alter FOREIGN SERVER Statements
2468
- * ----------------------
2469
- */
2470
-
2471
- typedef struct CreateForeignServerStmt
2472
- {
2473
- NodeTag type;
2474
- char *servername; /* server name */
2475
- char *servertype; /* optional server type */
2476
- char *version; /* optional server version */
2477
- char *fdwname; /* FDW name */
2478
- bool if_not_exists; /* just do nothing if it already exists? */
2479
- List *options; /* generic options to server */
2480
- } CreateForeignServerStmt;
2481
-
2482
- typedef struct AlterForeignServerStmt
2483
- {
2484
- NodeTag type;
2485
- char *servername; /* server name */
2486
- char *version; /* optional server version */
2487
- List *options; /* generic options to server */
2488
- bool has_version; /* version specified */
2489
- } AlterForeignServerStmt;
2490
-
2491
- /* ----------------------
2492
- * Create FOREIGN TABLE Statement
2493
- * ----------------------
2494
- */
2495
-
2496
- typedef struct CreateForeignTableStmt
2497
- {
2498
- CreateStmt base;
2499
- char *servername;
2500
- List *options;
2501
- } CreateForeignTableStmt;
2502
-
2503
- /* ----------------------
2504
- * Create/Drop USER MAPPING Statements
2505
- * ----------------------
2506
- */
2507
-
2508
- typedef struct CreateUserMappingStmt
2509
- {
2510
- NodeTag type;
2511
- RoleSpec *user; /* user role */
2512
- char *servername; /* server name */
2513
- bool if_not_exists; /* just do nothing if it already exists? */
2514
- List *options; /* generic options to server */
2515
- } CreateUserMappingStmt;
2516
-
2517
- typedef struct AlterUserMappingStmt
2518
- {
2519
- NodeTag type;
2520
- RoleSpec *user; /* user role */
2521
- char *servername; /* server name */
2522
- List *options; /* generic options to server */
2523
- } AlterUserMappingStmt;
2524
-
2525
- typedef struct DropUserMappingStmt
2526
- {
2527
- NodeTag type;
2528
- RoleSpec *user; /* user role */
2529
- char *servername; /* server name */
2530
- bool missing_ok; /* ignore missing mappings */
2531
- } DropUserMappingStmt;
2532
-
2533
- /* ----------------------
2534
- * Import Foreign Schema Statement
2535
- * ----------------------
2536
- */
2537
-
2538
- typedef enum ImportForeignSchemaType
2539
- {
2540
- FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */
2541
- FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */
2542
- FDW_IMPORT_SCHEMA_EXCEPT /* exclude listed tables from import */
2543
- } ImportForeignSchemaType;
2544
-
2545
- typedef struct ImportForeignSchemaStmt
2546
- {
2547
- NodeTag type;
2548
- char *server_name; /* FDW server name */
2549
- char *remote_schema; /* remote schema name to query */
2550
- char *local_schema; /* local schema to create objects in */
2551
- ImportForeignSchemaType list_type; /* type of table list */
2552
- List *table_list; /* List of RangeVar */
2553
- List *options; /* list of options to pass to FDW */
2554
- } ImportForeignSchemaStmt;
2555
-
2556
- /*----------------------
2557
- * Create POLICY Statement
2558
- *----------------------
2559
- */
2560
- typedef struct CreatePolicyStmt
2561
- {
2562
- NodeTag type;
2563
- char *policy_name; /* Policy's name */
2564
- RangeVar *table; /* the table name the policy applies to */
2565
- char *cmd_name; /* the command name the policy applies to */
2566
- bool permissive; /* restrictive or permissive policy */
2567
- List *roles; /* the roles associated with the policy */
2568
- Node *qual; /* the policy's condition */
2569
- Node *with_check; /* the policy's WITH CHECK condition. */
2570
- } CreatePolicyStmt;
2571
-
2572
- /*----------------------
2573
- * Alter POLICY Statement
2574
- *----------------------
2575
- */
2576
- typedef struct AlterPolicyStmt
2577
- {
2578
- NodeTag type;
2579
- char *policy_name; /* Policy's name */
2580
- RangeVar *table; /* the table name the policy applies to */
2581
- List *roles; /* the roles associated with the policy */
2582
- Node *qual; /* the policy's condition */
2583
- Node *with_check; /* the policy's WITH CHECK condition. */
2584
- } AlterPolicyStmt;
2585
-
2586
- /*----------------------
2587
- * Create ACCESS METHOD Statement
2588
- *----------------------
2589
- */
2590
- typedef struct CreateAmStmt
2591
- {
2592
- NodeTag type;
2593
- char *amname; /* access method name */
2594
- List *handler_name; /* handler function name */
2595
- char amtype; /* type of access method */
2596
- } CreateAmStmt;
2597
-
2598
- /* ----------------------
2599
- * Create TRIGGER Statement
2600
- * ----------------------
2601
- */
2602
- typedef struct CreateTrigStmt
2603
- {
2604
- NodeTag type;
2605
- bool replace; /* replace trigger if already exists */
2606
- bool isconstraint; /* This is a constraint trigger */
2607
- char *trigname; /* TRIGGER's name */
2608
- RangeVar *relation; /* relation trigger is on */
2609
- List *funcname; /* qual. name of function to call */
2610
- List *args; /* list of String or NIL */
2611
- bool row; /* ROW/STATEMENT */
2612
- /* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
2613
- int16 timing; /* BEFORE, AFTER, or INSTEAD */
2614
- /* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
2615
- int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */
2616
- List *columns; /* column names, or NIL for all columns */
2617
- Node *whenClause; /* qual expression, or NULL if none */
2618
- /* explicitly named transition data */
2619
- List *transitionRels; /* TriggerTransition nodes, or NIL if none */
2620
- /* The remaining fields are only used for constraint triggers */
2621
- bool deferrable; /* [NOT] DEFERRABLE */
2622
- bool initdeferred; /* INITIALLY {DEFERRED|IMMEDIATE} */
2623
- RangeVar *constrrel; /* opposite relation, if RI trigger */
2624
- } CreateTrigStmt;
2625
-
2626
- /* ----------------------
2627
- * Create EVENT TRIGGER Statement
2628
- * ----------------------
2629
- */
2630
- typedef struct CreateEventTrigStmt
2631
- {
2632
- NodeTag type;
2633
- char *trigname; /* TRIGGER's name */
2634
- char *eventname; /* event's identifier */
2635
- List *whenclause; /* list of DefElems indicating filtering */
2636
- List *funcname; /* qual. name of function to call */
2637
- } CreateEventTrigStmt;
2638
-
2639
- /* ----------------------
2640
- * Alter EVENT TRIGGER Statement
2641
- * ----------------------
2642
- */
2643
- typedef struct AlterEventTrigStmt
2644
- {
2645
- NodeTag type;
2646
- char *trigname; /* TRIGGER's name */
2647
- char tgenabled; /* trigger's firing configuration WRT
2648
- * session_replication_role */
2649
- } AlterEventTrigStmt;
2650
-
2651
- /* ----------------------
2652
- * Create LANGUAGE Statements
2653
- * ----------------------
2654
- */
2655
- typedef struct CreatePLangStmt
2656
- {
2657
- NodeTag type;
2658
- bool replace; /* T => replace if already exists */
2659
- char *plname; /* PL name */
2660
- List *plhandler; /* PL call handler function (qual. name) */
2661
- List *plinline; /* optional inline function (qual. name) */
2662
- List *plvalidator; /* optional validator function (qual. name) */
2663
- bool pltrusted; /* PL is trusted */
2664
- } CreatePLangStmt;
2665
-
2666
- /* ----------------------
2667
- * Create/Alter/Drop Role Statements
2668
- *
2669
- * Note: these node types are also used for the backwards-compatible
2670
- * Create/Alter/Drop User/Group statements. In the ALTER and DROP cases
2671
- * there's really no need to distinguish what the original spelling was,
2672
- * but for CREATE we mark the type because the defaults vary.
2673
- * ----------------------
2674
- */
2675
- typedef enum RoleStmtType
2676
- {
2677
- ROLESTMT_ROLE,
2678
- ROLESTMT_USER,
2679
- ROLESTMT_GROUP
2680
- } RoleStmtType;
2681
-
2682
- typedef struct CreateRoleStmt
2683
- {
2684
- NodeTag type;
2685
- RoleStmtType stmt_type; /* ROLE/USER/GROUP */
2686
- char *role; /* role name */
2687
- List *options; /* List of DefElem nodes */
2688
- } CreateRoleStmt;
2689
-
2690
- typedef struct AlterRoleStmt
2691
- {
2692
- NodeTag type;
2693
- RoleSpec *role; /* role */
2694
- List *options; /* List of DefElem nodes */
2695
- int action; /* +1 = add members, -1 = drop members */
2696
- } AlterRoleStmt;
2697
-
2698
- typedef struct AlterRoleSetStmt
2699
- {
2700
- NodeTag type;
2701
- RoleSpec *role; /* role */
2702
- char *database; /* database name, or NULL */
2703
- VariableSetStmt *setstmt; /* SET or RESET subcommand */
2704
- } AlterRoleSetStmt;
2705
-
2706
- typedef struct DropRoleStmt
2707
- {
2708
- NodeTag type;
2709
- List *roles; /* List of roles to remove */
2710
- bool missing_ok; /* skip error if a role is missing? */
2711
- } DropRoleStmt;
2712
-
2713
- /* ----------------------
2714
- * {Create|Alter} SEQUENCE Statement
2715
- * ----------------------
2716
- */
2717
-
2718
- typedef struct CreateSeqStmt
2719
- {
2720
- NodeTag type;
2721
- RangeVar *sequence; /* the sequence to create */
2722
- List *options;
2723
- Oid ownerId; /* ID of owner, or InvalidOid for default */
2724
- bool for_identity;
2725
- bool if_not_exists; /* just do nothing if it already exists? */
2726
- } CreateSeqStmt;
2727
-
2728
- typedef struct AlterSeqStmt
2729
- {
2730
- NodeTag type;
2731
- RangeVar *sequence; /* the sequence to alter */
2732
- List *options;
2733
- bool for_identity;
2734
- bool missing_ok; /* skip error if a role is missing? */
2735
- } AlterSeqStmt;
2736
-
2737
- /* ----------------------
2738
- * Create {Aggregate|Operator|Type} Statement
2739
- * ----------------------
2740
- */
2741
- typedef struct DefineStmt
2742
- {
2743
- NodeTag type;
2744
- ObjectType kind; /* aggregate, operator, type */
2745
- bool oldstyle; /* hack to signal old CREATE AGG syntax */
2746
- List *defnames; /* qualified name (list of String) */
2747
- List *args; /* a list of TypeName (if needed) */
2748
- List *definition; /* a list of DefElem */
2749
- bool if_not_exists; /* just do nothing if it already exists? */
2750
- bool replace; /* replace if already exists? */
2751
- } DefineStmt;
2752
-
2753
- /* ----------------------
2754
- * Create Domain Statement
2755
- * ----------------------
2756
- */
2757
- typedef struct CreateDomainStmt
2758
- {
2759
- NodeTag type;
2760
- List *domainname; /* qualified name (list of String) */
2761
- TypeName *typeName; /* the base type */
2762
- CollateClause *collClause; /* untransformed COLLATE spec, if any */
2763
- List *constraints; /* constraints (list of Constraint nodes) */
2764
- } CreateDomainStmt;
2765
-
2766
- /* ----------------------
2767
- * Create Operator Class Statement
2768
- * ----------------------
2769
- */
2770
- typedef struct CreateOpClassStmt
2771
- {
2772
- NodeTag type;
2773
- List *opclassname; /* qualified name (list of String) */
2774
- List *opfamilyname; /* qualified name (ditto); NIL if omitted */
2775
- char *amname; /* name of index AM opclass is for */
2776
- TypeName *datatype; /* datatype of indexed column */
2777
- List *items; /* List of CreateOpClassItem nodes */
2778
- bool isDefault; /* Should be marked as default for type? */
2779
- } CreateOpClassStmt;
2780
-
2781
- #define OPCLASS_ITEM_OPERATOR 1
2782
- #define OPCLASS_ITEM_FUNCTION 2
2783
- #define OPCLASS_ITEM_STORAGETYPE 3
2784
-
2785
- typedef struct CreateOpClassItem
2786
- {
2787
- NodeTag type;
2788
- int itemtype; /* see codes above */
2789
- ObjectWithArgs *name; /* operator or function name and args */
2790
- int number; /* strategy num or support proc num */
2791
- List *order_family; /* only used for ordering operators */
2792
- List *class_args; /* amproclefttype/amprocrighttype or
2793
- * amoplefttype/amoprighttype */
2794
- /* fields used for a storagetype item: */
2795
- TypeName *storedtype; /* datatype stored in index */
2796
- } CreateOpClassItem;
2797
-
2798
- /* ----------------------
2799
- * Create Operator Family Statement
2800
- * ----------------------
2801
- */
2802
- typedef struct CreateOpFamilyStmt
2803
- {
2804
- NodeTag type;
2805
- List *opfamilyname; /* qualified name (list of String) */
2806
- char *amname; /* name of index AM opfamily is for */
2807
- } CreateOpFamilyStmt;
2808
-
2809
- /* ----------------------
2810
- * Alter Operator Family Statement
2811
- * ----------------------
2812
- */
2813
- typedef struct AlterOpFamilyStmt
2814
- {
2815
- NodeTag type;
2816
- List *opfamilyname; /* qualified name (list of String) */
2817
- char *amname; /* name of index AM opfamily is for */
2818
- bool isDrop; /* ADD or DROP the items? */
2819
- List *items; /* List of CreateOpClassItem nodes */
2820
- } AlterOpFamilyStmt;
2821
-
2822
- /* ----------------------
2823
- * Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement
2824
- * ----------------------
2825
- */
2826
-
2827
- typedef struct DropStmt
2828
- {
2829
- NodeTag type;
2830
- List *objects; /* list of names */
2831
- ObjectType removeType; /* object type */
2832
- DropBehavior behavior; /* RESTRICT or CASCADE behavior */
2833
- bool missing_ok; /* skip error if object is missing? */
2834
- bool concurrent; /* drop index concurrently? */
2835
- } DropStmt;
2836
-
2837
- /* ----------------------
2838
- * Truncate Table Statement
2839
- * ----------------------
2840
- */
2841
- typedef struct TruncateStmt
2842
- {
2843
- NodeTag type;
2844
- List *relations; /* relations (RangeVars) to be truncated */
2845
- bool restart_seqs; /* restart owned sequences? */
2846
- DropBehavior behavior; /* RESTRICT or CASCADE behavior */
2847
- } TruncateStmt;
2848
-
2849
- /* ----------------------
2850
- * Comment On Statement
2851
- * ----------------------
2852
- */
2853
- typedef struct CommentStmt
2854
- {
2855
- NodeTag type;
2856
- ObjectType objtype; /* Object's type */
2857
- Node *object; /* Qualified name of the object */
2858
- char *comment; /* Comment to insert, or NULL to remove */
2859
- } CommentStmt;
2860
-
2861
- /* ----------------------
2862
- * SECURITY LABEL Statement
2863
- * ----------------------
2864
- */
2865
- typedef struct SecLabelStmt
2866
- {
2867
- NodeTag type;
2868
- ObjectType objtype; /* Object's type */
2869
- Node *object; /* Qualified name of the object */
2870
- char *provider; /* Label provider (or NULL) */
2871
- char *label; /* New security label to be assigned */
2872
- } SecLabelStmt;
2873
-
2874
- /* ----------------------
2875
- * Declare Cursor Statement
2876
- *
2877
- * The "query" field is initially a raw parse tree, and is converted to a
2878
- * Query node during parse analysis. Note that rewriting and planning
2879
- * of the query are always postponed until execution.
2880
- * ----------------------
2881
- */
2882
- #define CURSOR_OPT_BINARY 0x0001 /* BINARY */
2883
- #define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */
2884
- #define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */
2885
- #define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */
2886
- #define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */
2887
- #define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */
2888
- /* these planner-control flags do not correspond to any SQL grammar: */
2889
- #define CURSOR_OPT_FAST_PLAN 0x0100 /* prefer fast-start plan */
2890
- #define CURSOR_OPT_GENERIC_PLAN 0x0200 /* force use of generic plan */
2891
- #define CURSOR_OPT_CUSTOM_PLAN 0x0400 /* force use of custom plan */
2892
- #define CURSOR_OPT_PARALLEL_OK 0x0800 /* parallel mode OK */
2893
-
2894
- typedef struct DeclareCursorStmt
2895
- {
2896
- NodeTag type;
2897
- char *portalname; /* name of the portal (cursor) */
2898
- int options; /* bitmask of options (see above) */
2899
- Node *query; /* the query (see comments above) */
2900
- } DeclareCursorStmt;
2901
-
2902
- /* ----------------------
2903
- * Close Portal Statement
2904
- * ----------------------
2905
- */
2906
- typedef struct ClosePortalStmt
2907
- {
2908
- NodeTag type;
2909
- char *portalname; /* name of the portal (cursor) */
2910
- /* NULL means CLOSE ALL */
2911
- } ClosePortalStmt;
2912
-
2913
- /* ----------------------
2914
- * Fetch Statement (also Move)
2915
- * ----------------------
2916
- */
2917
- typedef enum FetchDirection
2918
- {
2919
- /* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */
2920
- FETCH_FORWARD,
2921
- FETCH_BACKWARD,
2922
- /* for these, howMany indicates a position; only one row is fetched */
2923
- FETCH_ABSOLUTE,
2924
- FETCH_RELATIVE
2925
- } FetchDirection;
2926
-
2927
- #define FETCH_ALL LONG_MAX
2928
-
2929
- typedef struct FetchStmt
2930
- {
2931
- NodeTag type;
2932
- FetchDirection direction; /* see above */
2933
- long howMany; /* number of rows, or position argument */
2934
- char *portalname; /* name of portal (cursor) */
2935
- bool ismove; /* true if MOVE */
2936
- } FetchStmt;
2937
-
2938
- /* ----------------------
2939
- * Create Index Statement
2940
- *
2941
- * This represents creation of an index and/or an associated constraint.
2942
- * If isconstraint is true, we should create a pg_constraint entry along
2943
- * with the index. But if indexOid isn't InvalidOid, we are not creating an
2944
- * index, just a UNIQUE/PKEY constraint using an existing index. isconstraint
2945
- * must always be true in this case, and the fields describing the index
2946
- * properties are empty.
2947
- * ----------------------
2948
- */
2949
- typedef struct IndexStmt
2950
- {
2951
- NodeTag type;
2952
- char *idxname; /* name of new index, or NULL for default */
2953
- RangeVar *relation; /* relation to build index on */
2954
- char *accessMethod; /* name of access method (eg. btree) */
2955
- char *tableSpace; /* tablespace, or NULL for default */
2956
- List *indexParams; /* columns to index: a list of IndexElem */
2957
- List *indexIncludingParams; /* additional columns to index: a list
2958
- * of IndexElem */
2959
- List *options; /* WITH clause options: a list of DefElem */
2960
- Node *whereClause; /* qualification (partial-index predicate) */
2961
- List *excludeOpNames; /* exclusion operator names, or NIL if none */
2962
- char *idxcomment; /* comment to apply to index, or NULL */
2963
- Oid indexOid; /* OID of an existing index, if any */
2964
- Oid oldNode; /* relfilenode of existing storage, if any */
2965
- SubTransactionId oldCreateSubid; /* rd_createSubid of oldNode */
2966
- SubTransactionId oldFirstRelfilenodeSubid; /* rd_firstRelfilenodeSubid of
2967
- * oldNode */
2968
- bool unique; /* is index unique? */
2969
- bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
2970
- bool primary; /* is index a primary key? */
2971
- bool isconstraint; /* is it for a pkey/unique constraint? */
2972
- bool deferrable; /* is the constraint DEFERRABLE? */
2973
- bool initdeferred; /* is the constraint INITIALLY DEFERRED? */
2974
- bool transformed; /* true when transformIndexStmt is finished */
2975
- bool concurrent; /* should this be a concurrent index build? */
2976
- bool if_not_exists; /* just do nothing if index already exists? */
2977
- bool reset_default_tblspc; /* reset default_tablespace prior to
2978
- * executing */
2979
- } IndexStmt;
2980
-
2981
- /* ----------------------
2982
- * Create Statistics Statement
2983
- * ----------------------
2984
- */
2985
- typedef struct CreateStatsStmt
2986
- {
2987
- NodeTag type;
2988
- List *defnames; /* qualified name (list of String) */
2989
- List *stat_types; /* stat types (list of String) */
2990
- List *exprs; /* expressions to build statistics on */
2991
- List *relations; /* rels to build stats on (list of RangeVar) */
2992
- char *stxcomment; /* comment to apply to stats, or NULL */
2993
- bool transformed; /* true when transformStatsStmt is finished */
2994
- bool if_not_exists; /* do nothing if stats name already exists */
2995
- } CreateStatsStmt;
2996
-
2997
- /*
2998
- * StatsElem - statistics parameters (used in CREATE STATISTICS)
2999
- *
3000
- * For a plain attribute, 'name' is the name of the referenced table column
3001
- * and 'expr' is NULL. For an expression, 'name' is NULL and 'expr' is the
3002
- * expression tree.
3003
- */
3004
- typedef struct StatsElem
3005
- {
3006
- NodeTag type;
3007
- char *name; /* name of attribute to index, or NULL */
3008
- Node *expr; /* expression to index, or NULL */
3009
- } StatsElem;
3010
-
3011
-
3012
- /* ----------------------
3013
- * Alter Statistics Statement
3014
- * ----------------------
3015
- */
3016
- typedef struct AlterStatsStmt
3017
- {
3018
- NodeTag type;
3019
- List *defnames; /* qualified name (list of String) */
3020
- int stxstattarget; /* statistics target */
3021
- bool missing_ok; /* skip error if statistics object is missing */
3022
- } AlterStatsStmt;
3023
-
3024
- /* ----------------------
3025
- * Create Function Statement
3026
- * ----------------------
3027
- */
3028
- typedef struct CreateFunctionStmt
3029
- {
3030
- NodeTag type;
3031
- bool is_procedure; /* it's really CREATE PROCEDURE */
3032
- bool replace; /* T => replace if already exists */
3033
- List *funcname; /* qualified name of function to create */
3034
- List *parameters; /* a list of FunctionParameter */
3035
- TypeName *returnType; /* the return type */
3036
- List *options; /* a list of DefElem */
3037
- Node *sql_body;
3038
- } CreateFunctionStmt;
3039
-
3040
- typedef enum FunctionParameterMode
3041
- {
3042
- /* the assigned enum values appear in pg_proc, don't change 'em! */
3043
- FUNC_PARAM_IN = 'i', /* input only */
3044
- FUNC_PARAM_OUT = 'o', /* output only */
3045
- FUNC_PARAM_INOUT = 'b', /* both */
3046
- FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */
3047
- FUNC_PARAM_TABLE = 't', /* table function output column */
3048
- /* this is not used in pg_proc: */
3049
- FUNC_PARAM_DEFAULT = 'd' /* default; effectively same as IN */
3050
- } FunctionParameterMode;
3051
-
3052
- typedef struct FunctionParameter
3053
- {
3054
- NodeTag type;
3055
- char *name; /* parameter name, or NULL if not given */
3056
- TypeName *argType; /* TypeName for parameter type */
3057
- FunctionParameterMode mode; /* IN/OUT/etc */
3058
- Node *defexpr; /* raw default expr, or NULL if not given */
3059
- } FunctionParameter;
3060
-
3061
- typedef struct AlterFunctionStmt
3062
- {
3063
- NodeTag type;
3064
- ObjectType objtype;
3065
- ObjectWithArgs *func; /* name and args of function */
3066
- List *actions; /* list of DefElem */
3067
- } AlterFunctionStmt;
3068
-
3069
- /* ----------------------
3070
- * DO Statement
3071
- *
3072
- * DoStmt is the raw parser output, InlineCodeBlock is the execution-time API
3073
- * ----------------------
3074
- */
3075
- typedef struct DoStmt
3076
- {
3077
- NodeTag type;
3078
- List *args; /* List of DefElem nodes */
3079
- } DoStmt;
3080
-
3081
- typedef struct InlineCodeBlock
3082
- {
3083
- NodeTag type;
3084
- char *source_text; /* source text of anonymous code block */
3085
- Oid langOid; /* OID of selected language */
3086
- bool langIsTrusted; /* trusted property of the language */
3087
- bool atomic; /* atomic execution context */
3088
- } InlineCodeBlock;
3089
-
3090
- /* ----------------------
3091
- * CALL statement
3092
- *
3093
- * OUT-mode arguments are removed from the transformed funcexpr. The outargs
3094
- * list contains copies of the expressions for all output arguments, in the
3095
- * order of the procedure's declared arguments. (outargs is never evaluated,
3096
- * but is useful to the caller as a reference for what to assign to.)
3097
- * ----------------------
3098
- */
3099
- typedef struct CallStmt
3100
- {
3101
- NodeTag type;
3102
- FuncCall *funccall; /* from the parser */
3103
- FuncExpr *funcexpr; /* transformed call, with only input args */
3104
- List *outargs; /* transformed output-argument expressions */
3105
- } CallStmt;
3106
-
3107
- typedef struct CallContext
3108
- {
3109
- NodeTag type;
3110
- bool atomic;
3111
- } CallContext;
3112
-
3113
- /* ----------------------
3114
- * Alter Object Rename Statement
3115
- * ----------------------
3116
- */
3117
- typedef struct RenameStmt
3118
- {
3119
- NodeTag type;
3120
- ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */
3121
- ObjectType relationType; /* if column name, associated relation type */
3122
- RangeVar *relation; /* in case it's a table */
3123
- Node *object; /* in case it's some other object */
3124
- char *subname; /* name of contained object (column, rule,
3125
- * trigger, etc) */
3126
- char *newname; /* the new name */
3127
- DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3128
- bool missing_ok; /* skip error if missing? */
3129
- } RenameStmt;
3130
-
3131
- /* ----------------------
3132
- * ALTER object DEPENDS ON EXTENSION extname
3133
- * ----------------------
3134
- */
3135
- typedef struct AlterObjectDependsStmt
3136
- {
3137
- NodeTag type;
3138
- ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
3139
- RangeVar *relation; /* in case a table is involved */
3140
- Node *object; /* name of the object */
3141
- String *extname; /* extension name */
3142
- bool remove; /* set true to remove dep rather than add */
3143
- } AlterObjectDependsStmt;
3144
-
3145
- /* ----------------------
3146
- * ALTER object SET SCHEMA Statement
3147
- * ----------------------
3148
- */
3149
- typedef struct AlterObjectSchemaStmt
3150
- {
3151
- NodeTag type;
3152
- ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3153
- RangeVar *relation; /* in case it's a table */
3154
- Node *object; /* in case it's some other object */
3155
- char *newschema; /* the new schema */
3156
- bool missing_ok; /* skip error if missing? */
3157
- } AlterObjectSchemaStmt;
3158
-
3159
- /* ----------------------
3160
- * Alter Object Owner Statement
3161
- * ----------------------
3162
- */
3163
- typedef struct AlterOwnerStmt
3164
- {
3165
- NodeTag type;
3166
- ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3167
- RangeVar *relation; /* in case it's a table */
3168
- Node *object; /* in case it's some other object */
3169
- RoleSpec *newowner; /* the new owner */
3170
- } AlterOwnerStmt;
3171
-
3172
- /* ----------------------
3173
- * Alter Operator Set ( this-n-that )
3174
- * ----------------------
3175
- */
3176
- typedef struct AlterOperatorStmt
3177
- {
3178
- NodeTag type;
3179
- ObjectWithArgs *opername; /* operator name and argument types */
3180
- List *options; /* List of DefElem nodes */
3181
- } AlterOperatorStmt;
3182
-
3183
- /* ------------------------
3184
- * Alter Type Set ( this-n-that )
3185
- * ------------------------
3186
- */
3187
- typedef struct AlterTypeStmt
3188
- {
3189
- NodeTag type;
3190
- List *typeName; /* type name (possibly qualified) */
3191
- List *options; /* List of DefElem nodes */
3192
- } AlterTypeStmt;
3193
-
3194
- /* ----------------------
3195
- * Create Rule Statement
3196
- * ----------------------
3197
- */
3198
- typedef struct RuleStmt
3199
- {
3200
- NodeTag type;
3201
- RangeVar *relation; /* relation the rule is for */
3202
- char *rulename; /* name of the rule */
3203
- Node *whereClause; /* qualifications */
3204
- CmdType event; /* SELECT, INSERT, etc */
3205
- bool instead; /* is a 'do instead'? */
3206
- List *actions; /* the action statements */
3207
- bool replace; /* OR REPLACE */
3208
- } RuleStmt;
3209
-
3210
- /* ----------------------
3211
- * Notify Statement
3212
- * ----------------------
3213
- */
3214
- typedef struct NotifyStmt
3215
- {
3216
- NodeTag type;
3217
- char *conditionname; /* condition name to notify */
3218
- char *payload; /* the payload string, or NULL if none */
3219
- } NotifyStmt;
3220
-
3221
- /* ----------------------
3222
- * Listen Statement
3223
- * ----------------------
3224
- */
3225
- typedef struct ListenStmt
3226
- {
3227
- NodeTag type;
3228
- char *conditionname; /* condition name to listen on */
3229
- } ListenStmt;
3230
-
3231
- /* ----------------------
3232
- * Unlisten Statement
3233
- * ----------------------
3234
- */
3235
- typedef struct UnlistenStmt
3236
- {
3237
- NodeTag type;
3238
- char *conditionname; /* name to unlisten on, or NULL for all */
3239
- } UnlistenStmt;
3240
-
3241
- /* ----------------------
3242
- * {Begin|Commit|Rollback} Transaction Statement
3243
- * ----------------------
3244
- */
3245
- typedef enum TransactionStmtKind
3246
- {
3247
- TRANS_STMT_BEGIN,
3248
- TRANS_STMT_START, /* semantically identical to BEGIN */
3249
- TRANS_STMT_COMMIT,
3250
- TRANS_STMT_ROLLBACK,
3251
- TRANS_STMT_SAVEPOINT,
3252
- TRANS_STMT_RELEASE,
3253
- TRANS_STMT_ROLLBACK_TO,
3254
- TRANS_STMT_PREPARE,
3255
- TRANS_STMT_COMMIT_PREPARED,
3256
- TRANS_STMT_ROLLBACK_PREPARED
3257
- } TransactionStmtKind;
3258
-
3259
- typedef struct TransactionStmt
3260
- {
3261
- NodeTag type;
3262
- TransactionStmtKind kind; /* see above */
3263
- List *options; /* for BEGIN/START commands */
3264
- char *savepoint_name; /* for savepoint commands */
3265
- char *gid; /* for two-phase-commit related commands */
3266
- bool chain; /* AND CHAIN option */
3267
- } TransactionStmt;
3268
-
3269
- /* ----------------------
3270
- * Create Type Statement, composite types
3271
- * ----------------------
3272
- */
3273
- typedef struct CompositeTypeStmt
3274
- {
3275
- NodeTag type;
3276
- RangeVar *typevar; /* the composite type to be created */
3277
- List *coldeflist; /* list of ColumnDef nodes */
3278
- } CompositeTypeStmt;
3279
-
3280
- /* ----------------------
3281
- * Create Type Statement, enum types
3282
- * ----------------------
3283
- */
3284
- typedef struct CreateEnumStmt
3285
- {
3286
- NodeTag type;
3287
- List *typeName; /* qualified name (list of String) */
3288
- List *vals; /* enum values (list of String) */
3289
- } CreateEnumStmt;
3290
-
3291
- /* ----------------------
3292
- * Create Type Statement, range types
3293
- * ----------------------
3294
- */
3295
- typedef struct CreateRangeStmt
3296
- {
3297
- NodeTag type;
3298
- List *typeName; /* qualified name (list of String) */
3299
- List *params; /* range parameters (list of DefElem) */
3300
- } CreateRangeStmt;
3301
-
3302
- /* ----------------------
3303
- * Alter Type Statement, enum types
3304
- * ----------------------
3305
- */
3306
- typedef struct AlterEnumStmt
3307
- {
3308
- NodeTag type;
3309
- List *typeName; /* qualified name (list of String) */
3310
- char *oldVal; /* old enum value's name, if renaming */
3311
- char *newVal; /* new enum value's name */
3312
- char *newValNeighbor; /* neighboring enum value, if specified */
3313
- bool newValIsAfter; /* place new enum value after neighbor? */
3314
- bool skipIfNewValExists; /* no error if new already exists? */
3315
- } AlterEnumStmt;
3316
-
3317
- /* ----------------------
3318
- * Create View Statement
3319
- * ----------------------
3320
- */
3321
- typedef enum ViewCheckOption
3322
- {
3323
- NO_CHECK_OPTION,
3324
- LOCAL_CHECK_OPTION,
3325
- CASCADED_CHECK_OPTION
3326
- } ViewCheckOption;
3327
-
3328
- typedef struct ViewStmt
3329
- {
3330
- NodeTag type;
3331
- RangeVar *view; /* the view to be created */
3332
- List *aliases; /* target column names */
3333
- Node *query; /* the SELECT query (as a raw parse tree) */
3334
- bool replace; /* replace an existing view? */
3335
- List *options; /* options from WITH clause */
3336
- ViewCheckOption withCheckOption; /* WITH CHECK OPTION */
3337
- } ViewStmt;
3338
-
3339
- /* ----------------------
3340
- * Load Statement
3341
- * ----------------------
3342
- */
3343
- typedef struct LoadStmt
3344
- {
3345
- NodeTag type;
3346
- char *filename; /* file to load */
3347
- } LoadStmt;
3348
-
3349
- /* ----------------------
3350
- * Createdb Statement
3351
- * ----------------------
3352
- */
3353
- typedef struct CreatedbStmt
3354
- {
3355
- NodeTag type;
3356
- char *dbname; /* name of database to create */
3357
- List *options; /* List of DefElem nodes */
3358
- } CreatedbStmt;
3359
-
3360
- /* ----------------------
3361
- * Alter Database
3362
- * ----------------------
3363
- */
3364
- typedef struct AlterDatabaseStmt
3365
- {
3366
- NodeTag type;
3367
- char *dbname; /* name of database to alter */
3368
- List *options; /* List of DefElem nodes */
3369
- } AlterDatabaseStmt;
3370
-
3371
- typedef struct AlterDatabaseRefreshCollStmt
3372
- {
3373
- NodeTag type;
3374
- char *dbname;
3375
- } AlterDatabaseRefreshCollStmt;
3376
-
3377
- typedef struct AlterDatabaseSetStmt
3378
- {
3379
- NodeTag type;
3380
- char *dbname; /* database name */
3381
- VariableSetStmt *setstmt; /* SET or RESET subcommand */
3382
- } AlterDatabaseSetStmt;
3383
-
3384
- /* ----------------------
3385
- * Dropdb Statement
3386
- * ----------------------
3387
- */
3388
- typedef struct DropdbStmt
3389
- {
3390
- NodeTag type;
3391
- char *dbname; /* database to drop */
3392
- bool missing_ok; /* skip error if db is missing? */
3393
- List *options; /* currently only FORCE is supported */
3394
- } DropdbStmt;
3395
-
3396
- /* ----------------------
3397
- * Alter System Statement
3398
- * ----------------------
3399
- */
3400
- typedef struct AlterSystemStmt
3401
- {
3402
- NodeTag type;
3403
- VariableSetStmt *setstmt; /* SET subcommand */
3404
- } AlterSystemStmt;
3405
-
3406
- /* ----------------------
3407
- * Cluster Statement (support pbrown's cluster index implementation)
3408
- * ----------------------
3409
- */
3410
- typedef struct ClusterStmt
3411
- {
3412
- NodeTag type;
3413
- RangeVar *relation; /* relation being indexed, or NULL if all */
3414
- char *indexname; /* original index defined */
3415
- List *params; /* list of DefElem nodes */
3416
- } ClusterStmt;
3417
-
3418
- /* ----------------------
3419
- * Vacuum and Analyze Statements
3420
- *
3421
- * Even though these are nominally two statements, it's convenient to use
3422
- * just one node type for both.
3423
- * ----------------------
3424
- */
3425
- typedef struct VacuumStmt
3426
- {
3427
- NodeTag type;
3428
- List *options; /* list of DefElem nodes */
3429
- List *rels; /* list of VacuumRelation, or NIL for all */
3430
- bool is_vacuumcmd; /* true for VACUUM, false for ANALYZE */
3431
- } VacuumStmt;
3432
-
3433
- /*
3434
- * Info about a single target table of VACUUM/ANALYZE.
3435
- *
3436
- * If the OID field is set, it always identifies the table to process.
3437
- * Then the relation field can be NULL; if it isn't, it's used only to report
3438
- * failure to open/lock the relation.
3439
- */
3440
- typedef struct VacuumRelation
3441
- {
3442
- NodeTag type;
3443
- RangeVar *relation; /* table name to process, or NULL */
3444
- Oid oid; /* table's OID; InvalidOid if not looked up */
3445
- List *va_cols; /* list of column names, or NIL for all */
3446
- } VacuumRelation;
3447
-
3448
- /* ----------------------
3449
- * Explain Statement
3450
- *
3451
- * The "query" field is initially a raw parse tree, and is converted to a
3452
- * Query node during parse analysis. Note that rewriting and planning
3453
- * of the query are always postponed until execution.
3454
- * ----------------------
3455
- */
3456
- typedef struct ExplainStmt
3457
- {
3458
- NodeTag type;
3459
- Node *query; /* the query (see comments above) */
3460
- List *options; /* list of DefElem nodes */
3461
- } ExplainStmt;
3462
-
3463
- /* ----------------------
3464
- * CREATE TABLE AS Statement (a/k/a SELECT INTO)
3465
- *
3466
- * A query written as CREATE TABLE AS will produce this node type natively.
3467
- * A query written as SELECT ... INTO will be transformed to this form during
3468
- * parse analysis.
3469
- * A query written as CREATE MATERIALIZED view will produce this node type,
3470
- * during parse analysis, since it needs all the same data.
3471
- *
3472
- * The "query" field is handled similarly to EXPLAIN, though note that it
3473
- * can be a SELECT or an EXECUTE, but not other DML statements.
3474
- * ----------------------
3475
- */
3476
- typedef struct CreateTableAsStmt
3477
- {
3478
- NodeTag type;
3479
- Node *query; /* the query (see comments above) */
3480
- IntoClause *into; /* destination table */
3481
- ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */
3482
- bool is_select_into; /* it was written as SELECT INTO */
3483
- bool if_not_exists; /* just do nothing if it already exists? */
3484
- } CreateTableAsStmt;
3485
-
3486
- /* ----------------------
3487
- * REFRESH MATERIALIZED VIEW Statement
3488
- * ----------------------
3489
- */
3490
- typedef struct RefreshMatViewStmt
3491
- {
3492
- NodeTag type;
3493
- bool concurrent; /* allow concurrent access? */
3494
- bool skipData; /* true for WITH NO DATA */
3495
- RangeVar *relation; /* relation to insert into */
3496
- } RefreshMatViewStmt;
3497
-
3498
- /* ----------------------
3499
- * Checkpoint Statement
3500
- * ----------------------
3501
- */
3502
- typedef struct CheckPointStmt
3503
- {
3504
- NodeTag type;
3505
- } CheckPointStmt;
3506
-
3507
- /* ----------------------
3508
- * Discard Statement
3509
- * ----------------------
3510
- */
3511
-
3512
- typedef enum DiscardMode
3513
- {
3514
- DISCARD_ALL,
3515
- DISCARD_PLANS,
3516
- DISCARD_SEQUENCES,
3517
- DISCARD_TEMP
3518
- } DiscardMode;
3519
-
3520
- typedef struct DiscardStmt
3521
- {
3522
- NodeTag type;
3523
- DiscardMode target;
3524
- } DiscardStmt;
3525
-
3526
- /* ----------------------
3527
- * LOCK Statement
3528
- * ----------------------
3529
- */
3530
- typedef struct LockStmt
3531
- {
3532
- NodeTag type;
3533
- List *relations; /* relations to lock */
3534
- int mode; /* lock mode */
3535
- bool nowait; /* no wait mode */
3536
- } LockStmt;
3537
-
3538
- /* ----------------------
3539
- * SET CONSTRAINTS Statement
3540
- * ----------------------
3541
- */
3542
- typedef struct ConstraintsSetStmt
3543
- {
3544
- NodeTag type;
3545
- List *constraints; /* List of names as RangeVars */
3546
- bool deferred;
3547
- } ConstraintsSetStmt;
3548
-
3549
- /* ----------------------
3550
- * REINDEX Statement
3551
- * ----------------------
3552
- */
3553
- typedef enum ReindexObjectType
3554
- {
3555
- REINDEX_OBJECT_INDEX, /* index */
3556
- REINDEX_OBJECT_TABLE, /* table or materialized view */
3557
- REINDEX_OBJECT_SCHEMA, /* schema */
3558
- REINDEX_OBJECT_SYSTEM, /* system catalogs */
3559
- REINDEX_OBJECT_DATABASE /* database */
3560
- } ReindexObjectType;
3561
-
3562
- typedef struct ReindexStmt
3563
- {
3564
- NodeTag type;
3565
- ReindexObjectType kind; /* REINDEX_OBJECT_INDEX, REINDEX_OBJECT_TABLE,
3566
- * etc. */
3567
- RangeVar *relation; /* Table or index to reindex */
3568
- const char *name; /* name of database to reindex */
3569
- List *params; /* list of DefElem nodes */
3570
- } ReindexStmt;
3571
-
3572
- /* ----------------------
3573
- * CREATE CONVERSION Statement
3574
- * ----------------------
3575
- */
3576
- typedef struct CreateConversionStmt
3577
- {
3578
- NodeTag type;
3579
- List *conversion_name; /* Name of the conversion */
3580
- char *for_encoding_name; /* source encoding name */
3581
- char *to_encoding_name; /* destination encoding name */
3582
- List *func_name; /* qualified conversion function name */
3583
- bool def; /* is this a default conversion? */
3584
- } CreateConversionStmt;
3585
-
3586
- /* ----------------------
3587
- * CREATE CAST Statement
3588
- * ----------------------
3589
- */
3590
- typedef struct CreateCastStmt
3591
- {
3592
- NodeTag type;
3593
- TypeName *sourcetype;
3594
- TypeName *targettype;
3595
- ObjectWithArgs *func;
3596
- CoercionContext context;
3597
- bool inout;
3598
- } CreateCastStmt;
3599
-
3600
- /* ----------------------
3601
- * CREATE TRANSFORM Statement
3602
- * ----------------------
3603
- */
3604
- typedef struct CreateTransformStmt
3605
- {
3606
- NodeTag type;
3607
- bool replace;
3608
- TypeName *type_name;
3609
- char *lang;
3610
- ObjectWithArgs *fromsql;
3611
- ObjectWithArgs *tosql;
3612
- } CreateTransformStmt;
3613
-
3614
- /* ----------------------
3615
- * PREPARE Statement
3616
- * ----------------------
3617
- */
3618
- typedef struct PrepareStmt
3619
- {
3620
- NodeTag type;
3621
- char *name; /* Name of plan, arbitrary */
3622
- List *argtypes; /* Types of parameters (List of TypeName) */
3623
- Node *query; /* The query itself (as a raw parsetree) */
3624
- } PrepareStmt;
3625
-
3626
-
3627
- /* ----------------------
3628
- * EXECUTE Statement
3629
- * ----------------------
3630
- */
3631
-
3632
- typedef struct ExecuteStmt
3633
- {
3634
- NodeTag type;
3635
- char *name; /* The name of the plan to execute */
3636
- List *params; /* Values to assign to parameters */
3637
- } ExecuteStmt;
3638
-
3639
-
3640
- /* ----------------------
3641
- * DEALLOCATE Statement
3642
- * ----------------------
3643
- */
3644
- typedef struct DeallocateStmt
3645
- {
3646
- NodeTag type;
3647
- char *name; /* The name of the plan to remove */
3648
- /* NULL means DEALLOCATE ALL */
3649
- } DeallocateStmt;
3650
-
3651
- /*
3652
- * DROP OWNED statement
3653
- */
3654
- typedef struct DropOwnedStmt
3655
- {
3656
- NodeTag type;
3657
- List *roles;
3658
- DropBehavior behavior;
3659
- } DropOwnedStmt;
3660
-
3661
- /*
3662
- * REASSIGN OWNED statement
3663
- */
3664
- typedef struct ReassignOwnedStmt
3665
- {
3666
- NodeTag type;
3667
- List *roles;
3668
- RoleSpec *newrole;
3669
- } ReassignOwnedStmt;
3670
-
3671
- /*
3672
- * TS Dictionary stmts: DefineStmt, RenameStmt and DropStmt are default
3673
- */
3674
- typedef struct AlterTSDictionaryStmt
3675
- {
3676
- NodeTag type;
3677
- List *dictname; /* qualified name (list of String) */
3678
- List *options; /* List of DefElem nodes */
3679
- } AlterTSDictionaryStmt;
3680
-
3681
- /*
3682
- * TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default
3683
- */
3684
- typedef enum AlterTSConfigType
3685
- {
3686
- ALTER_TSCONFIG_ADD_MAPPING,
3687
- ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN,
3688
- ALTER_TSCONFIG_REPLACE_DICT,
3689
- ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN,
3690
- ALTER_TSCONFIG_DROP_MAPPING
3691
- } AlterTSConfigType;
3692
-
3693
- typedef struct AlterTSConfigurationStmt
3694
- {
3695
- NodeTag type;
3696
- AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */
3697
- List *cfgname; /* qualified name (list of String) */
3698
-
3699
- /*
3700
- * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
3701
- * NIL, but tokentype isn't, DROP MAPPING was specified.
3702
- */
3703
- List *tokentype; /* list of String */
3704
- List *dicts; /* list of list of String */
3705
- bool override; /* if true - remove old variant */
3706
- bool replace; /* if true - replace dictionary by another */
3707
- bool missing_ok; /* for DROP - skip error if missing? */
3708
- } AlterTSConfigurationStmt;
3709
-
3710
- typedef struct PublicationTable
3711
- {
3712
- NodeTag type;
3713
- RangeVar *relation; /* relation to be published */
3714
- Node *whereClause; /* qualifications */
3715
- List *columns; /* List of columns in a publication table */
3716
- } PublicationTable;
3717
-
3718
- /*
3719
- * Publication object type
3720
- */
3721
- typedef enum PublicationObjSpecType
3722
- {
3723
- PUBLICATIONOBJ_TABLE, /* A table */
3724
- PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */
3725
- PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of
3726
- * search_path */
3727
- PUBLICATIONOBJ_CONTINUATION /* Continuation of previous type */
3728
- } PublicationObjSpecType;
3729
-
3730
- typedef struct PublicationObjSpec
3731
- {
3732
- NodeTag type;
3733
- PublicationObjSpecType pubobjtype; /* type of this publication object */
3734
- char *name;
3735
- PublicationTable *pubtable;
3736
- int location; /* token location, or -1 if unknown */
3737
- } PublicationObjSpec;
3738
-
3739
- typedef struct CreatePublicationStmt
3740
- {
3741
- NodeTag type;
3742
- char *pubname; /* Name of the publication */
3743
- List *options; /* List of DefElem nodes */
3744
- List *pubobjects; /* Optional list of publication objects */
3745
- bool for_all_tables; /* Special publication for all tables in db */
3746
- } CreatePublicationStmt;
3747
-
3748
- typedef enum AlterPublicationAction
3749
- {
3750
- AP_AddObjects, /* add objects to publication */
3751
- AP_DropObjects, /* remove objects from publication */
3752
- AP_SetObjects /* set list of objects */
3753
- } AlterPublicationAction;
3754
-
3755
- typedef struct AlterPublicationStmt
3756
- {
3757
- NodeTag type;
3758
- char *pubname; /* Name of the publication */
3759
-
3760
- /* parameters used for ALTER PUBLICATION ... WITH */
3761
- List *options; /* List of DefElem nodes */
3762
-
3763
- /*
3764
- * Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication
3765
- * objects.
3766
- */
3767
- List *pubobjects; /* Optional list of publication objects */
3768
- bool for_all_tables; /* Special publication for all tables in db */
3769
- AlterPublicationAction action; /* What action to perform with the given
3770
- * objects */
3771
- } AlterPublicationStmt;
3772
-
3773
- typedef struct CreateSubscriptionStmt
3774
- {
3775
- NodeTag type;
3776
- char *subname; /* Name of the subscription */
3777
- char *conninfo; /* Connection string to publisher */
3778
- List *publication; /* One or more publication to subscribe to */
3779
- List *options; /* List of DefElem nodes */
3780
- } CreateSubscriptionStmt;
3781
-
3782
- typedef enum AlterSubscriptionType
3783
- {
3784
- ALTER_SUBSCRIPTION_OPTIONS,
3785
- ALTER_SUBSCRIPTION_CONNECTION,
3786
- ALTER_SUBSCRIPTION_SET_PUBLICATION,
3787
- ALTER_SUBSCRIPTION_ADD_PUBLICATION,
3788
- ALTER_SUBSCRIPTION_DROP_PUBLICATION,
3789
- ALTER_SUBSCRIPTION_REFRESH,
3790
- ALTER_SUBSCRIPTION_ENABLED,
3791
- ALTER_SUBSCRIPTION_SKIP
3792
- } AlterSubscriptionType;
3793
-
3794
- typedef struct AlterSubscriptionStmt
3795
- {
3796
- NodeTag type;
3797
- AlterSubscriptionType kind; /* ALTER_SUBSCRIPTION_OPTIONS, etc */
3798
- char *subname; /* Name of the subscription */
3799
- char *conninfo; /* Connection string to publisher */
3800
- List *publication; /* One or more publication to subscribe to */
3801
- List *options; /* List of DefElem nodes */
3802
- } AlterSubscriptionStmt;
3803
-
3804
- typedef struct DropSubscriptionStmt
3805
- {
3806
- NodeTag type;
3807
- char *subname; /* Name of the subscription */
3808
- bool missing_ok; /* Skip error if missing? */
3809
- DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3810
- } DropSubscriptionStmt;
3811
-
3812
- #endif /* PARSENODES_H */