pg_query 2.2.0 → 6.1.0

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