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