pg_query 2.2.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (895) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +86 -0
  3. data/README.md +57 -31
  4. data/Rakefile +5 -6
  5. data/ext/pg_query/ext_symbols_freebsd.sym +1 -0
  6. data/ext/pg_query/ext_symbols_freebsd_with_ruby_abi_version.sym +2 -0
  7. data/ext/pg_query/ext_symbols_openbsd.sym +1 -0
  8. data/ext/pg_query/ext_symbols_openbsd_with_ruby_abi_version.sym +2 -0
  9. data/ext/pg_query/ext_symbols_with_ruby_abi_version.sym +2 -0
  10. data/ext/pg_query/extconf.rb +33 -9
  11. data/ext/pg_query/include/pg_query.h +30 -4
  12. data/ext/pg_query/include/pg_query_enum_defs.c +839 -290
  13. data/ext/pg_query/include/pg_query_fingerprint_conds.c +638 -481
  14. data/ext/pg_query/include/pg_query_fingerprint_defs.c +6786 -4193
  15. data/ext/pg_query/include/pg_query_outfuncs_conds.c +450 -330
  16. data/ext/pg_query/include/pg_query_outfuncs_defs.c +1489 -1044
  17. data/ext/pg_query/include/pg_query_readfuncs_conds.c +157 -118
  18. data/ext/pg_query/include/pg_query_readfuncs_defs.c +1933 -1410
  19. data/ext/pg_query/include/postgres/access/amapi.h +303 -0
  20. data/ext/pg_query/include/postgres/access/attmap.h +54 -0
  21. data/ext/pg_query/include/postgres/access/attnum.h +64 -0
  22. data/ext/pg_query/include/postgres/access/brin_internal.h +116 -0
  23. data/ext/pg_query/include/postgres/access/brin_tuple.h +112 -0
  24. data/ext/pg_query/include/postgres/access/clog.h +62 -0
  25. data/ext/pg_query/include/postgres/access/commit_ts.h +73 -0
  26. data/ext/pg_query/include/postgres/access/detoast.h +82 -0
  27. data/ext/pg_query/include/postgres/access/genam.h +246 -0
  28. data/ext/pg_query/include/postgres/access/gin.h +91 -0
  29. data/ext/pg_query/include/postgres/access/htup.h +89 -0
  30. data/ext/pg_query/include/postgres/access/htup_details.h +811 -0
  31. data/ext/pg_query/include/postgres/access/itup.h +170 -0
  32. data/ext/pg_query/include/postgres/access/parallel.h +81 -0
  33. data/ext/pg_query/include/postgres/access/printtup.h +35 -0
  34. data/ext/pg_query/include/postgres/access/relation.h +28 -0
  35. data/ext/pg_query/include/postgres/access/relscan.h +191 -0
  36. data/ext/pg_query/include/postgres/access/rmgr.h +62 -0
  37. data/ext/pg_query/include/postgres/access/rmgrlist.h +49 -0
  38. data/ext/pg_query/include/postgres/access/sdir.h +67 -0
  39. data/ext/pg_query/include/postgres/access/skey.h +151 -0
  40. data/ext/pg_query/include/postgres/access/slru.h +218 -0
  41. data/ext/pg_query/include/postgres/access/stratnum.h +85 -0
  42. data/ext/pg_query/include/postgres/access/sysattr.h +29 -0
  43. data/ext/pg_query/include/postgres/access/table.h +28 -0
  44. data/ext/pg_query/include/postgres/access/tableam.h +2110 -0
  45. data/ext/pg_query/include/postgres/access/tidstore.h +50 -0
  46. data/ext/pg_query/include/postgres/access/toast_compression.h +73 -0
  47. data/ext/pg_query/include/postgres/access/transam.h +418 -0
  48. data/ext/pg_query/include/postgres/access/tsmapi.h +82 -0
  49. data/ext/pg_query/include/postgres/access/tupconvert.h +54 -0
  50. data/ext/pg_query/include/postgres/access/tupdesc.h +154 -0
  51. data/ext/pg_query/include/postgres/access/tupmacs.h +207 -0
  52. data/ext/pg_query/include/postgres/access/twophase.h +65 -0
  53. data/ext/pg_query/include/postgres/access/xact.h +530 -0
  54. data/ext/pg_query/include/postgres/access/xlog.h +310 -0
  55. data/ext/pg_query/include/postgres/access/xlog_internal.h +405 -0
  56. data/ext/pg_query/include/postgres/access/xlogbackup.h +43 -0
  57. data/ext/pg_query/include/postgres/access/xlogdefs.h +82 -0
  58. data/ext/pg_query/include/postgres/access/xlogprefetcher.h +55 -0
  59. data/ext/pg_query/include/postgres/access/xlogreader.h +444 -0
  60. data/ext/pg_query/include/postgres/access/xlogrecord.h +248 -0
  61. data/ext/pg_query/include/postgres/access/xlogrecovery.h +158 -0
  62. data/ext/pg_query/include/postgres/archive/archive_module.h +67 -0
  63. data/ext/pg_query/include/postgres/c.h +1374 -0
  64. data/ext/pg_query/include/postgres/catalog/catalog.h +47 -0
  65. data/ext/pg_query/include/postgres/catalog/catversion.h +62 -0
  66. data/ext/pg_query/include/postgres/catalog/dependency.h +228 -0
  67. data/ext/pg_query/include/postgres/catalog/genbki.h +149 -0
  68. data/ext/pg_query/include/postgres/catalog/index.h +218 -0
  69. data/ext/pg_query/include/postgres/catalog/indexing.h +54 -0
  70. data/ext/pg_query/include/postgres/catalog/namespace.h +189 -0
  71. data/ext/pg_query/include/postgres/catalog/objectaccess.h +267 -0
  72. data/ext/pg_query/include/postgres/catalog/objectaddress.h +93 -0
  73. data/ext/pg_query/include/postgres/catalog/pg_aggregate.h +182 -0
  74. data/ext/pg_query/include/postgres/catalog/pg_aggregate_d.h +78 -0
  75. data/ext/pg_query/include/postgres/catalog/pg_am.h +66 -0
  76. data/ext/pg_query/include/postgres/catalog/pg_am_d.h +47 -0
  77. data/ext/pg_query/include/postgres/catalog/pg_attribute.h +240 -0
  78. data/ext/pg_query/include/postgres/catalog/pg_attribute_d.h +62 -0
  79. data/ext/pg_query/include/postgres/catalog/pg_authid.h +66 -0
  80. data/ext/pg_query/include/postgres/catalog/pg_authid_d.h +60 -0
  81. data/ext/pg_query/include/postgres/catalog/pg_class.h +235 -0
  82. data/ext/pg_query/include/postgres/catalog/pg_class_d.h +134 -0
  83. data/ext/pg_query/include/postgres/catalog/pg_collation.h +106 -0
  84. data/ext/pg_query/include/postgres/catalog/pg_collation_d.h +66 -0
  85. data/ext/pg_query/include/postgres/catalog/pg_constraint.h +278 -0
  86. data/ext/pg_query/include/postgres/catalog/pg_constraint_d.h +74 -0
  87. data/ext/pg_query/include/postgres/catalog/pg_control.h +260 -0
  88. data/ext/pg_query/include/postgres/catalog/pg_conversion.h +79 -0
  89. data/ext/pg_query/include/postgres/catalog/pg_conversion_d.h +38 -0
  90. data/ext/pg_query/include/postgres/catalog/pg_database.h +129 -0
  91. data/ext/pg_query/include/postgres/catalog/pg_database_d.h +53 -0
  92. data/ext/pg_query/include/postgres/catalog/pg_depend.h +77 -0
  93. data/ext/pg_query/include/postgres/catalog/pg_depend_d.h +36 -0
  94. data/ext/pg_query/include/postgres/catalog/pg_event_trigger.h +60 -0
  95. data/ext/pg_query/include/postgres/catalog/pg_event_trigger_d.h +36 -0
  96. data/ext/pg_query/include/postgres/catalog/pg_index.h +92 -0
  97. data/ext/pg_query/include/postgres/catalog/pg_index_d.h +59 -0
  98. data/ext/pg_query/include/postgres/catalog/pg_language.h +75 -0
  99. data/ext/pg_query/include/postgres/catalog/pg_language_d.h +41 -0
  100. data/ext/pg_query/include/postgres/catalog/pg_namespace.h +67 -0
  101. data/ext/pg_query/include/postgres/catalog/pg_namespace_d.h +36 -0
  102. data/ext/pg_query/include/postgres/catalog/pg_opclass.h +91 -0
  103. data/ext/pg_query/include/postgres/catalog/pg_opclass_d.h +51 -0
  104. data/ext/pg_query/include/postgres/catalog/pg_operator.h +124 -0
  105. data/ext/pg_query/include/postgres/catalog/pg_operator_d.h +142 -0
  106. data/ext/pg_query/include/postgres/catalog/pg_opfamily.h +67 -0
  107. data/ext/pg_query/include/postgres/catalog/pg_opfamily_d.h +51 -0
  108. data/ext/pg_query/include/postgres/catalog/pg_partitioned_table.h +76 -0
  109. data/ext/pg_query/include/postgres/catalog/pg_partitioned_table_d.h +36 -0
  110. data/ext/pg_query/include/postgres/catalog/pg_proc.h +223 -0
  111. data/ext/pg_query/include/postgres/catalog/pg_proc_d.h +101 -0
  112. data/ext/pg_query/include/postgres/catalog/pg_publication.h +161 -0
  113. data/ext/pg_query/include/postgres/catalog/pg_publication_d.h +38 -0
  114. data/ext/pg_query/include/postgres/catalog/pg_replication_origin.h +65 -0
  115. data/ext/pg_query/include/postgres/catalog/pg_replication_origin_d.h +33 -0
  116. data/ext/pg_query/include/postgres/catalog/pg_statistic.h +288 -0
  117. data/ext/pg_query/include/postgres/catalog/pg_statistic_d.h +199 -0
  118. data/ext/pg_query/include/postgres/catalog/pg_statistic_ext.h +91 -0
  119. data/ext/pg_query/include/postgres/catalog/pg_statistic_ext_d.h +45 -0
  120. data/ext/pg_query/include/postgres/catalog/pg_transform.h +51 -0
  121. data/ext/pg_query/include/postgres/catalog/pg_transform_d.h +34 -0
  122. data/ext/pg_query/include/postgres/catalog/pg_trigger.h +153 -0
  123. data/ext/pg_query/include/postgres/catalog/pg_trigger_d.h +109 -0
  124. data/ext/pg_query/include/postgres/catalog/pg_ts_config.h +56 -0
  125. data/ext/pg_query/include/postgres/catalog/pg_ts_config_d.h +34 -0
  126. data/ext/pg_query/include/postgres/catalog/pg_ts_dict.h +62 -0
  127. data/ext/pg_query/include/postgres/catalog/pg_ts_dict_d.h +35 -0
  128. data/ext/pg_query/include/postgres/catalog/pg_ts_parser.h +63 -0
  129. data/ext/pg_query/include/postgres/catalog/pg_ts_parser_d.h +37 -0
  130. data/ext/pg_query/include/postgres/catalog/pg_ts_template.h +54 -0
  131. data/ext/pg_query/include/postgres/catalog/pg_ts_template_d.h +34 -0
  132. data/ext/pg_query/include/postgres/catalog/pg_type.h +407 -0
  133. data/ext/pg_query/include/postgres/catalog/pg_type_d.h +324 -0
  134. data/ext/pg_query/include/postgres/catalog/storage.h +50 -0
  135. data/ext/pg_query/include/postgres/catalog/syscache_ids.h +104 -0
  136. data/ext/pg_query/include/postgres/commands/async.h +49 -0
  137. data/ext/pg_query/include/postgres/commands/dbcommands.h +37 -0
  138. data/ext/pg_query/include/postgres/commands/defrem.h +161 -0
  139. data/ext/pg_query/include/postgres/commands/event_trigger.h +97 -0
  140. data/ext/pg_query/include/postgres/commands/explain.h +145 -0
  141. data/ext/pg_query/include/postgres/commands/prepare.h +61 -0
  142. data/ext/pg_query/include/postgres/commands/tablespace.h +69 -0
  143. data/ext/pg_query/include/postgres/commands/trigger.h +288 -0
  144. data/ext/pg_query/include/postgres/commands/user.h +43 -0
  145. data/ext/pg_query/include/postgres/commands/vacuum.h +388 -0
  146. data/ext/pg_query/include/postgres/common/cryptohash.h +39 -0
  147. data/ext/pg_query/include/postgres/common/file_perm.h +56 -0
  148. data/ext/pg_query/include/postgres/common/file_utils.h +65 -0
  149. data/ext/pg_query/include/postgres/common/hashfn.h +119 -0
  150. data/ext/pg_query/include/postgres/common/hashfn_unstable.h +407 -0
  151. data/ext/pg_query/include/postgres/common/int.h +512 -0
  152. data/ext/pg_query/include/postgres/common/keywords.h +29 -0
  153. data/ext/pg_query/include/postgres/common/kwlookup.h +44 -0
  154. data/ext/pg_query/include/postgres/common/pg_prng.h +62 -0
  155. data/ext/pg_query/include/postgres/common/relpath.h +97 -0
  156. data/ext/pg_query/include/postgres/common/scram-common.h +70 -0
  157. data/ext/pg_query/include/postgres/common/sha2.h +32 -0
  158. data/ext/pg_query/include/postgres/common/string.h +44 -0
  159. data/ext/pg_query/include/postgres/common/unicode_east_asian_fw_table.h +124 -0
  160. data/ext/pg_query/include/postgres/common/unicode_nonspacing_table.h +326 -0
  161. data/ext/pg_query/include/postgres/copyfuncs.funcs.c +5261 -0
  162. data/ext/pg_query/include/postgres/copyfuncs.switch.c +989 -0
  163. data/ext/pg_query/include/postgres/datatype/timestamp.h +269 -0
  164. data/ext/pg_query/include/postgres/equalfuncs.funcs.c +3310 -0
  165. data/ext/pg_query/include/postgres/equalfuncs.switch.c +836 -0
  166. data/ext/pg_query/include/postgres/executor/execdesc.h +70 -0
  167. data/ext/pg_query/include/postgres/executor/executor.h +681 -0
  168. data/ext/pg_query/include/postgres/executor/functions.h +56 -0
  169. data/ext/pg_query/include/postgres/executor/instrument.h +120 -0
  170. data/ext/pg_query/include/postgres/executor/spi.h +207 -0
  171. data/ext/pg_query/include/postgres/executor/tablefunc.h +67 -0
  172. data/ext/pg_query/include/postgres/executor/tuptable.h +523 -0
  173. data/ext/pg_query/include/postgres/fmgr.h +800 -0
  174. data/ext/pg_query/include/postgres/foreign/fdwapi.h +294 -0
  175. data/ext/pg_query/include/postgres/funcapi.h +360 -0
  176. data/ext/pg_query/include/postgres/gram.h +1168 -0
  177. data/ext/pg_query/include/postgres/gramparse.h +75 -0
  178. data/ext/pg_query/include/postgres/jit/jit.h +106 -0
  179. data/ext/pg_query/include/postgres/kwlist_d.h +1164 -0
  180. data/ext/pg_query/include/postgres/lib/dshash.h +130 -0
  181. data/ext/pg_query/include/postgres/lib/ilist.h +1159 -0
  182. data/ext/pg_query/include/postgres/lib/pairingheap.h +102 -0
  183. data/ext/pg_query/include/postgres/lib/simplehash.h +1206 -0
  184. data/ext/pg_query/include/postgres/lib/sort_template.h +445 -0
  185. data/ext/pg_query/include/postgres/lib/stringinfo.h +243 -0
  186. data/ext/pg_query/include/postgres/libpq/auth.h +37 -0
  187. data/ext/pg_query/include/postgres/libpq/crypt.h +47 -0
  188. data/ext/pg_query/include/postgres/libpq/hba.h +186 -0
  189. data/ext/pg_query/include/postgres/libpq/libpq-be.h +361 -0
  190. data/ext/pg_query/include/postgres/libpq/libpq.h +143 -0
  191. data/ext/pg_query/include/postgres/libpq/pqcomm.h +169 -0
  192. data/ext/pg_query/include/postgres/libpq/pqformat.h +209 -0
  193. data/ext/pg_query/include/postgres/libpq/pqsignal.h +54 -0
  194. data/ext/pg_query/include/postgres/libpq/protocol.h +89 -0
  195. data/ext/pg_query/include/postgres/libpq/sasl.h +136 -0
  196. data/ext/pg_query/include/postgres/libpq/scram.h +37 -0
  197. data/ext/pg_query/include/postgres/mb/pg_wchar.h +793 -0
  198. data/ext/pg_query/include/postgres/mb/stringinfo_mb.h +24 -0
  199. data/ext/pg_query/include/postgres/miscadmin.h +527 -0
  200. data/ext/pg_query/include/postgres/nodes/bitmapset.h +140 -0
  201. data/ext/pg_query/include/postgres/nodes/execnodes.h +2855 -0
  202. data/ext/pg_query/include/postgres/nodes/extensible.h +164 -0
  203. data/ext/pg_query/include/postgres/nodes/lockoptions.h +61 -0
  204. data/ext/pg_query/include/postgres/nodes/makefuncs.h +127 -0
  205. data/ext/pg_query/include/postgres/nodes/memnodes.h +152 -0
  206. data/ext/pg_query/include/postgres/nodes/miscnodes.h +56 -0
  207. data/ext/pg_query/include/postgres/nodes/nodeFuncs.h +222 -0
  208. data/ext/pg_query/include/postgres/nodes/nodes.h +435 -0
  209. data/ext/pg_query/include/postgres/nodes/nodetags.h +491 -0
  210. data/ext/pg_query/include/postgres/nodes/params.h +170 -0
  211. data/ext/pg_query/include/postgres/nodes/parsenodes.h +4233 -0
  212. data/ext/pg_query/include/postgres/nodes/pathnodes.h +3438 -0
  213. data/ext/pg_query/include/postgres/nodes/pg_list.h +686 -0
  214. data/ext/pg_query/include/postgres/nodes/plannodes.h +1593 -0
  215. data/ext/pg_query/include/postgres/nodes/primnodes.h +2339 -0
  216. data/ext/pg_query/include/postgres/nodes/print.h +34 -0
  217. data/ext/pg_query/include/postgres/nodes/queryjumble.h +86 -0
  218. data/ext/pg_query/include/postgres/nodes/replnodes.h +132 -0
  219. data/ext/pg_query/include/postgres/nodes/supportnodes.h +346 -0
  220. data/ext/pg_query/include/postgres/nodes/tidbitmap.h +75 -0
  221. data/ext/pg_query/include/postgres/nodes/value.h +90 -0
  222. data/ext/pg_query/include/postgres/optimizer/cost.h +216 -0
  223. data/ext/pg_query/include/postgres/optimizer/geqo.h +90 -0
  224. data/ext/pg_query/include/postgres/optimizer/geqo_gene.h +45 -0
  225. data/ext/pg_query/include/postgres/optimizer/optimizer.h +205 -0
  226. data/ext/pg_query/include/postgres/optimizer/paths.h +271 -0
  227. data/ext/pg_query/include/postgres/optimizer/planmain.h +123 -0
  228. data/ext/pg_query/include/postgres/parser/analyze.h +66 -0
  229. data/ext/pg_query/include/postgres/parser/kwlist.h +518 -0
  230. data/ext/pg_query/include/postgres/parser/parse_agg.h +65 -0
  231. data/ext/pg_query/include/postgres/parser/parse_coerce.h +105 -0
  232. data/ext/pg_query/include/postgres/parser/parse_expr.h +25 -0
  233. data/ext/pg_query/include/postgres/parser/parse_func.h +74 -0
  234. data/ext/pg_query/include/postgres/parser/parse_node.h +358 -0
  235. data/ext/pg_query/include/postgres/parser/parse_oper.h +68 -0
  236. data/ext/pg_query/include/postgres/parser/parse_relation.h +129 -0
  237. data/ext/pg_query/include/postgres/parser/parse_type.h +61 -0
  238. data/ext/pg_query/include/postgres/parser/parser.h +68 -0
  239. data/ext/pg_query/include/postgres/parser/parsetree.h +61 -0
  240. data/ext/pg_query/include/postgres/parser/scanner.h +152 -0
  241. data/ext/pg_query/include/postgres/parser/scansup.h +27 -0
  242. data/ext/pg_query/include/postgres/partitioning/partdefs.h +26 -0
  243. data/ext/pg_query/include/postgres/pg_config.h +985 -0
  244. data/ext/pg_query/include/postgres/pg_config_manual.h +385 -0
  245. data/ext/pg_query/include/postgres/pg_config_os.h +8 -0
  246. data/ext/pg_query/include/postgres/pg_getopt.h +56 -0
  247. data/ext/pg_query/include/postgres/pg_trace.h +17 -0
  248. data/ext/pg_query/include/postgres/pgstat.h +780 -0
  249. data/ext/pg_query/include/postgres/pgtime.h +94 -0
  250. data/ext/pg_query/include/postgres/pl_gram.h +385 -0
  251. data/ext/pg_query/include/postgres/pl_reserved_kwlist.h +52 -0
  252. data/ext/pg_query/include/postgres/pl_reserved_kwlist_d.h +114 -0
  253. data/ext/pg_query/include/postgres/pl_unreserved_kwlist.h +112 -0
  254. data/ext/pg_query/include/postgres/pl_unreserved_kwlist_d.h +246 -0
  255. data/ext/pg_query/include/postgres/plerrcodes.h +998 -0
  256. data/ext/pg_query/include/postgres/plpgsql.h +1342 -0
  257. data/ext/pg_query/include/postgres/port/atomics/arch-arm.h +32 -0
  258. data/ext/pg_query/include/postgres/port/atomics/arch-hppa.h +17 -0
  259. data/ext/pg_query/include/postgres/port/atomics/arch-ppc.h +256 -0
  260. data/ext/pg_query/include/postgres/port/atomics/arch-x86.h +254 -0
  261. data/ext/pg_query/include/postgres/port/atomics/fallback.h +170 -0
  262. data/ext/pg_query/include/postgres/port/atomics/generic-gcc.h +323 -0
  263. data/ext/pg_query/include/postgres/port/atomics/generic-msvc.h +119 -0
  264. data/ext/pg_query/include/postgres/port/atomics/generic-sunpro.h +121 -0
  265. data/ext/pg_query/include/postgres/port/atomics/generic.h +437 -0
  266. data/ext/pg_query/include/postgres/port/atomics.h +606 -0
  267. data/ext/pg_query/include/postgres/port/pg_bitutils.h +421 -0
  268. data/ext/pg_query/include/postgres/port/pg_bswap.h +161 -0
  269. data/ext/pg_query/include/postgres/port/pg_crc32c.h +110 -0
  270. data/ext/pg_query/include/postgres/port/pg_iovec.h +117 -0
  271. data/ext/pg_query/include/postgres/port/simd.h +422 -0
  272. data/ext/pg_query/include/postgres/port/win32/arpa/inet.h +3 -0
  273. data/ext/pg_query/include/postgres/port/win32/dlfcn.h +1 -0
  274. data/ext/pg_query/include/postgres/port/win32/grp.h +1 -0
  275. data/ext/pg_query/include/postgres/port/win32/netdb.h +7 -0
  276. data/ext/pg_query/include/postgres/port/win32/netinet/in.h +3 -0
  277. data/ext/pg_query/include/postgres/port/win32/netinet/tcp.h +7 -0
  278. data/ext/pg_query/include/postgres/port/win32/pwd.h +3 -0
  279. data/ext/pg_query/include/postgres/port/win32/sys/resource.h +20 -0
  280. data/ext/pg_query/include/postgres/port/win32/sys/select.h +3 -0
  281. data/ext/pg_query/include/postgres/port/win32/sys/socket.h +34 -0
  282. data/ext/pg_query/include/postgres/port/win32/sys/un.h +17 -0
  283. data/ext/pg_query/include/postgres/port/win32/sys/wait.h +3 -0
  284. data/ext/pg_query/include/postgres/port/win32.h +59 -0
  285. data/ext/pg_query/include/postgres/port/win32_msvc/dirent.h +34 -0
  286. data/ext/pg_query/include/postgres/port/win32_msvc/sys/file.h +1 -0
  287. data/ext/pg_query/include/postgres/port/win32_msvc/sys/param.h +1 -0
  288. data/ext/pg_query/include/postgres/port/win32_msvc/sys/time.h +1 -0
  289. data/ext/pg_query/include/postgres/port/win32_msvc/unistd.h +9 -0
  290. data/ext/pg_query/include/postgres/port/win32_msvc/utime.h +3 -0
  291. data/ext/pg_query/include/postgres/port/win32_port.h +582 -0
  292. data/ext/pg_query/include/postgres/port.h +555 -0
  293. data/ext/pg_query/include/postgres/portability/instr_time.h +197 -0
  294. data/ext/pg_query/include/postgres/postgres.h +579 -0
  295. data/ext/pg_query/include/postgres/postgres_ext.h +73 -0
  296. data/ext/pg_query/include/postgres/postmaster/autovacuum.h +69 -0
  297. data/ext/pg_query/include/postgres/postmaster/bgworker.h +164 -0
  298. data/ext/pg_query/include/postgres/postmaster/bgworker_internals.h +60 -0
  299. data/ext/pg_query/include/postgres/postmaster/bgwriter.h +45 -0
  300. data/ext/pg_query/include/postgres/postmaster/interrupt.h +32 -0
  301. data/ext/pg_query/include/postgres/postmaster/pgarch.h +36 -0
  302. data/ext/pg_query/include/postgres/postmaster/postmaster.h +101 -0
  303. data/ext/pg_query/include/postgres/postmaster/startup.h +41 -0
  304. data/ext/pg_query/include/postgres/postmaster/syslogger.h +101 -0
  305. data/ext/pg_query/include/postgres/postmaster/walsummarizer.h +35 -0
  306. data/ext/pg_query/include/postgres/postmaster/walwriter.h +23 -0
  307. data/ext/pg_query/include/postgres/regex/regex.h +272 -0
  308. data/ext/pg_query/include/postgres/replication/logicallauncher.h +34 -0
  309. data/ext/pg_query/include/postgres/replication/logicalproto.h +274 -0
  310. data/ext/pg_query/include/postgres/replication/logicalworker.h +33 -0
  311. data/ext/pg_query/include/postgres/replication/origin.h +73 -0
  312. data/ext/pg_query/include/postgres/replication/reorderbuffer.h +734 -0
  313. data/ext/pg_query/include/postgres/replication/slot.h +289 -0
  314. data/ext/pg_query/include/postgres/replication/slotsync.h +38 -0
  315. data/ext/pg_query/include/postgres/replication/syncrep.h +109 -0
  316. data/ext/pg_query/include/postgres/replication/walreceiver.h +504 -0
  317. data/ext/pg_query/include/postgres/replication/walsender.h +76 -0
  318. data/ext/pg_query/include/postgres/rewrite/prs2lock.h +46 -0
  319. data/ext/pg_query/include/postgres/rewrite/rewriteHandler.h +41 -0
  320. data/ext/pg_query/include/postgres/rewrite/rewriteManip.h +96 -0
  321. data/ext/pg_query/include/postgres/rewrite/rewriteSupport.h +26 -0
  322. data/ext/pg_query/include/postgres/storage/block.h +108 -0
  323. data/ext/pg_query/include/postgres/storage/buf.h +46 -0
  324. data/ext/pg_query/include/postgres/storage/bufmgr.h +411 -0
  325. data/ext/pg_query/include/postgres/storage/bufpage.h +510 -0
  326. data/ext/pg_query/include/postgres/storage/condition_variable.h +73 -0
  327. data/ext/pg_query/include/postgres/storage/dsm.h +61 -0
  328. data/ext/pg_query/include/postgres/storage/dsm_impl.h +79 -0
  329. data/ext/pg_query/include/postgres/storage/fd.h +219 -0
  330. data/ext/pg_query/include/postgres/storage/fileset.h +40 -0
  331. data/ext/pg_query/include/postgres/storage/ipc.h +87 -0
  332. data/ext/pg_query/include/postgres/storage/item.h +19 -0
  333. data/ext/pg_query/include/postgres/storage/itemid.h +184 -0
  334. data/ext/pg_query/include/postgres/storage/itemptr.h +245 -0
  335. data/ext/pg_query/include/postgres/storage/large_object.h +100 -0
  336. data/ext/pg_query/include/postgres/storage/latch.h +196 -0
  337. data/ext/pg_query/include/postgres/storage/lmgr.h +126 -0
  338. data/ext/pg_query/include/postgres/storage/lock.h +624 -0
  339. data/ext/pg_query/include/postgres/storage/lockdefs.h +61 -0
  340. data/ext/pg_query/include/postgres/storage/lwlock.h +228 -0
  341. data/ext/pg_query/include/postgres/storage/lwlocknames.h +47 -0
  342. data/ext/pg_query/include/postgres/storage/off.h +57 -0
  343. data/ext/pg_query/include/postgres/storage/pg_sema.h +61 -0
  344. data/ext/pg_query/include/postgres/storage/pg_shmem.h +93 -0
  345. data/ext/pg_query/include/postgres/storage/pmsignal.h +105 -0
  346. data/ext/pg_query/include/postgres/storage/predicate.h +83 -0
  347. data/ext/pg_query/include/postgres/storage/proc.h +488 -0
  348. data/ext/pg_query/include/postgres/storage/procarray.h +103 -0
  349. data/ext/pg_query/include/postgres/storage/proclist_types.h +53 -0
  350. data/ext/pg_query/include/postgres/storage/procnumber.h +43 -0
  351. data/ext/pg_query/include/postgres/storage/procsignal.h +75 -0
  352. data/ext/pg_query/include/postgres/storage/read_stream.h +65 -0
  353. data/ext/pg_query/include/postgres/storage/relfilelocator.h +100 -0
  354. data/ext/pg_query/include/postgres/storage/s_lock.h +847 -0
  355. data/ext/pg_query/include/postgres/storage/sharedfileset.h +37 -0
  356. data/ext/pg_query/include/postgres/storage/shm_mq.h +86 -0
  357. data/ext/pg_query/include/postgres/storage/shm_toc.h +58 -0
  358. data/ext/pg_query/include/postgres/storage/shmem.h +59 -0
  359. data/ext/pg_query/include/postgres/storage/sinval.h +153 -0
  360. data/ext/pg_query/include/postgres/storage/smgr.h +130 -0
  361. data/ext/pg_query/include/postgres/storage/spin.h +77 -0
  362. data/ext/pg_query/include/postgres/storage/standby.h +109 -0
  363. data/ext/pg_query/include/postgres/storage/standbydefs.h +74 -0
  364. data/ext/pg_query/include/postgres/storage/sync.h +66 -0
  365. data/ext/pg_query/include/postgres/tcop/cmdtag.h +62 -0
  366. data/ext/pg_query/include/postgres/tcop/cmdtaglist.h +219 -0
  367. data/ext/pg_query/include/postgres/tcop/deparse_utility.h +108 -0
  368. data/ext/pg_query/include/postgres/tcop/dest.h +148 -0
  369. data/ext/pg_query/include/postgres/tcop/fastpath.h +20 -0
  370. data/ext/pg_query/include/postgres/tcop/pquery.h +51 -0
  371. data/ext/pg_query/include/postgres/tcop/tcopprot.h +98 -0
  372. data/ext/pg_query/include/postgres/tcop/utility.h +112 -0
  373. data/ext/pg_query/include/postgres/tsearch/ts_cache.h +96 -0
  374. data/ext/pg_query/include/postgres/utils/acl.h +290 -0
  375. data/ext/pg_query/include/postgres/utils/aclchk_internal.h +45 -0
  376. data/ext/pg_query/include/postgres/utils/array.h +481 -0
  377. data/ext/pg_query/include/postgres/utils/ascii.h +84 -0
  378. data/ext/pg_query/include/postgres/utils/backend_progress.h +46 -0
  379. data/ext/pg_query/include/postgres/utils/backend_status.h +340 -0
  380. data/ext/pg_query/include/postgres/utils/builtins.h +139 -0
  381. data/ext/pg_query/include/postgres/utils/bytea.h +28 -0
  382. data/ext/pg_query/include/postgres/utils/catcache.h +231 -0
  383. data/ext/pg_query/include/postgres/utils/date.h +118 -0
  384. data/ext/pg_query/include/postgres/utils/datetime.h +367 -0
  385. data/ext/pg_query/include/postgres/utils/datum.h +76 -0
  386. data/ext/pg_query/include/postgres/utils/dsa.h +166 -0
  387. data/ext/pg_query/include/postgres/utils/elog.h +540 -0
  388. data/ext/pg_query/include/postgres/utils/errcodes.h +352 -0
  389. data/ext/pg_query/include/postgres/utils/expandeddatum.h +170 -0
  390. data/ext/pg_query/include/postgres/utils/expandedrecord.h +241 -0
  391. data/ext/pg_query/include/postgres/utils/float.h +357 -0
  392. data/ext/pg_query/include/postgres/utils/fmgroids.h +3347 -0
  393. data/ext/pg_query/include/postgres/utils/fmgrprotos.h +2904 -0
  394. data/ext/pg_query/include/postgres/utils/fmgrtab.h +49 -0
  395. data/ext/pg_query/include/postgres/utils/guc.h +456 -0
  396. data/ext/pg_query/include/postgres/utils/guc_hooks.h +184 -0
  397. data/ext/pg_query/include/postgres/utils/guc_tables.h +323 -0
  398. data/ext/pg_query/include/postgres/utils/hsearch.h +153 -0
  399. data/ext/pg_query/include/postgres/utils/injection_point.h +44 -0
  400. data/ext/pg_query/include/postgres/utils/inval.h +68 -0
  401. data/ext/pg_query/include/postgres/utils/logtape.h +77 -0
  402. data/ext/pg_query/include/postgres/utils/lsyscache.h +215 -0
  403. data/ext/pg_query/include/postgres/utils/memdebug.h +82 -0
  404. data/ext/pg_query/include/postgres/utils/memutils.h +193 -0
  405. data/ext/pg_query/include/postgres/utils/memutils_internal.h +176 -0
  406. data/ext/pg_query/include/postgres/utils/memutils_memorychunk.h +253 -0
  407. data/ext/pg_query/include/postgres/utils/numeric.h +110 -0
  408. data/ext/pg_query/include/postgres/utils/palloc.h +151 -0
  409. data/ext/pg_query/include/postgres/utils/partcache.h +103 -0
  410. data/ext/pg_query/include/postgres/utils/pg_locale.h +136 -0
  411. data/ext/pg_query/include/postgres/utils/pgstat_internal.h +827 -0
  412. data/ext/pg_query/include/postgres/utils/plancache.h +238 -0
  413. data/ext/pg_query/include/postgres/utils/portal.h +252 -0
  414. data/ext/pg_query/include/postgres/utils/probes.h +114 -0
  415. data/ext/pg_query/include/postgres/utils/ps_status.h +47 -0
  416. data/ext/pg_query/include/postgres/utils/queryenvironment.h +74 -0
  417. data/ext/pg_query/include/postgres/utils/regproc.h +39 -0
  418. data/ext/pg_query/include/postgres/utils/rel.h +711 -0
  419. data/ext/pg_query/include/postgres/utils/relcache.h +155 -0
  420. data/ext/pg_query/include/postgres/utils/reltrigger.h +81 -0
  421. data/ext/pg_query/include/postgres/utils/resowner.h +167 -0
  422. data/ext/pg_query/include/postgres/utils/ruleutils.h +52 -0
  423. data/ext/pg_query/include/postgres/utils/sharedtuplestore.h +61 -0
  424. data/ext/pg_query/include/postgres/utils/snapmgr.h +130 -0
  425. data/ext/pg_query/include/postgres/utils/snapshot.h +219 -0
  426. data/ext/pg_query/include/postgres/utils/sortsupport.h +391 -0
  427. data/ext/pg_query/include/postgres/utils/syscache.h +136 -0
  428. data/ext/pg_query/include/postgres/utils/timeout.h +96 -0
  429. data/ext/pg_query/include/postgres/utils/timestamp.h +147 -0
  430. data/ext/pg_query/include/postgres/utils/tuplesort.h +472 -0
  431. data/ext/pg_query/include/postgres/utils/tuplestore.h +88 -0
  432. data/ext/pg_query/include/postgres/utils/typcache.h +210 -0
  433. data/ext/pg_query/include/postgres/utils/varlena.h +53 -0
  434. data/ext/pg_query/include/postgres/utils/wait_event.h +108 -0
  435. data/ext/pg_query/include/postgres/utils/wait_event_types.h +218 -0
  436. data/ext/pg_query/include/postgres/utils/xml.h +94 -0
  437. data/ext/pg_query/include/postgres/varatt.h +358 -0
  438. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +8077 -6217
  439. data/ext/pg_query/include/protobuf/pg_query.pb.h +132024 -88124
  440. data/ext/pg_query/pg_query.c +10 -1
  441. data/ext/pg_query/pg_query.pb-c.c +24028 -17173
  442. data/ext/pg_query/pg_query_deparse.c +1 -9902
  443. data/ext/pg_query/pg_query_fingerprint.c +42 -18
  444. data/ext/pg_query/pg_query_fingerprint.h +1 -1
  445. data/ext/pg_query/pg_query_internal.h +1 -1
  446. data/ext/pg_query/pg_query_json_plpgsql.c +1 -25
  447. data/ext/pg_query/pg_query_normalize.c +44 -3
  448. data/ext/pg_query/pg_query_outfuncs_json.c +62 -16
  449. data/ext/pg_query/pg_query_outfuncs_protobuf.c +73 -12
  450. data/ext/pg_query/pg_query_parse.c +47 -5
  451. data/ext/pg_query/pg_query_parse_plpgsql.c +19 -18
  452. data/ext/pg_query/pg_query_readfuncs_protobuf.c +45 -10
  453. data/ext/pg_query/pg_query_ruby.c +5 -0
  454. data/ext/pg_query/pg_query_scan.c +4 -3
  455. data/ext/pg_query/pg_query_split.c +6 -5
  456. data/ext/pg_query/postgres_deparse.c +11496 -0
  457. data/ext/pg_query/postgres_deparse.h +9 -0
  458. data/ext/pg_query/src_backend_catalog_namespace.c +262 -71
  459. data/ext/pg_query/src_backend_catalog_pg_proc.c +3 -2
  460. data/ext/pg_query/src_backend_commands_define.c +12 -3
  461. data/ext/pg_query/src_backend_nodes_bitmapset.c +142 -156
  462. data/ext/pg_query/src_backend_nodes_copyfuncs.c +100 -5881
  463. data/ext/pg_query/src_backend_nodes_equalfuncs.c +102 -3831
  464. data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
  465. data/ext/pg_query/src_backend_nodes_list.c +89 -18
  466. data/ext/pg_query/src_backend_nodes_makefuncs.c +138 -4
  467. data/ext/pg_query/src_backend_nodes_nodeFuncs.c +433 -132
  468. data/ext/pg_query/src_backend_nodes_value.c +28 -19
  469. data/ext/pg_query/src_backend_parser_gram.c +45255 -38885
  470. data/ext/pg_query/src_backend_parser_parser.c +53 -8
  471. data/ext/pg_query/src_backend_parser_scan.c +6999 -3438
  472. data/ext/pg_query/src_backend_parser_scansup.c +5 -28
  473. data/ext/pg_query/src_backend_storage_ipc_ipc.c +13 -4
  474. data/ext/pg_query/src_backend_tcop_postgres.c +156 -114
  475. data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +140 -0
  476. data/ext/pg_query/src_backend_utils_adt_datum.c +14 -2
  477. data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
  478. data/ext/pg_query/src_backend_utils_adt_format_type.c +6 -2
  479. data/ext/pg_query/src_backend_utils_adt_numutils.c +488 -0
  480. data/ext/pg_query/src_backend_utils_adt_ruleutils.c +247 -34
  481. data/ext/pg_query/src_backend_utils_error_assert.c +17 -18
  482. data/ext/pg_query/src_backend_utils_error_elog.c +543 -343
  483. data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +47 -18
  484. data/ext/pg_query/src_backend_utils_init_globals.c +22 -7
  485. data/ext/pg_query/src_backend_utils_mb_mbutils.c +84 -148
  486. data/ext/pg_query/src_backend_utils_misc_guc_tables.c +502 -0
  487. data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +166 -0
  488. data/ext/pg_query/src_backend_utils_mmgr_aset.c +708 -499
  489. data/ext/pg_query/src_backend_utils_mmgr_bump.c +728 -0
  490. data/ext/pg_query/src_backend_utils_mmgr_generation.c +1115 -0
  491. data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +710 -218
  492. data/ext/pg_query/src_backend_utils_mmgr_slab.c +1079 -0
  493. data/ext/pg_query/src_common_encnames.c +46 -44
  494. data/ext/pg_query/src_common_hashfn.c +3 -3
  495. data/ext/pg_query/src_common_keywords.c +15 -2
  496. data/ext/pg_query/src_common_kwlist_d.h +602 -510
  497. data/ext/pg_query/src_common_kwlookup.c +1 -1
  498. data/ext/pg_query/src_common_psprintf.c +3 -3
  499. data/ext/pg_query/src_common_stringinfo.c +21 -4
  500. data/ext/pg_query/src_common_wchar.c +754 -178
  501. data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +143 -24
  502. data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -18
  503. data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1295 -1255
  504. data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
  505. data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +10 -10
  506. data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +20 -2
  507. data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +60 -60
  508. data/ext/pg_query/src_port_pg_bitutils.c +283 -54
  509. data/ext/pg_query/src_port_pgstrcasecmp.c +57 -1
  510. data/ext/pg_query/src_port_qsort.c +12 -224
  511. data/ext/pg_query/src_port_snprintf.c +56 -39
  512. data/ext/pg_query/src_port_strerror.c +9 -21
  513. data/ext/pg_query/src_port_strlcpy.c +79 -0
  514. data/lib/pg_query/filter_columns.rb +1 -1
  515. data/lib/pg_query/fingerprint.rb +10 -9
  516. data/lib/pg_query/node.rb +18 -13
  517. data/lib/pg_query/param_refs.rb +3 -3
  518. data/lib/pg_query/parse.rb +25 -15
  519. data/lib/pg_query/parse_error.rb +1 -0
  520. data/lib/pg_query/pg_query_pb.rb +181 -3038
  521. data/lib/pg_query/scan.rb +1 -0
  522. data/lib/pg_query/treewalker.rb +55 -8
  523. data/lib/pg_query/truncate.rb +19 -21
  524. data/lib/pg_query/version.rb +1 -1
  525. metadata +447 -436
  526. data/ext/pg_query/guc-file.c +0 -0
  527. data/ext/pg_query/include/access/amapi.h +0 -246
  528. data/ext/pg_query/include/access/attmap.h +0 -52
  529. data/ext/pg_query/include/access/attnum.h +0 -64
  530. data/ext/pg_query/include/access/clog.h +0 -61
  531. data/ext/pg_query/include/access/commit_ts.h +0 -77
  532. data/ext/pg_query/include/access/detoast.h +0 -92
  533. data/ext/pg_query/include/access/genam.h +0 -228
  534. data/ext/pg_query/include/access/gin.h +0 -78
  535. data/ext/pg_query/include/access/htup.h +0 -89
  536. data/ext/pg_query/include/access/htup_details.h +0 -819
  537. data/ext/pg_query/include/access/itup.h +0 -161
  538. data/ext/pg_query/include/access/parallel.h +0 -82
  539. data/ext/pg_query/include/access/printtup.h +0 -35
  540. data/ext/pg_query/include/access/relation.h +0 -28
  541. data/ext/pg_query/include/access/relscan.h +0 -176
  542. data/ext/pg_query/include/access/rmgr.h +0 -35
  543. data/ext/pg_query/include/access/rmgrlist.h +0 -49
  544. data/ext/pg_query/include/access/sdir.h +0 -58
  545. data/ext/pg_query/include/access/skey.h +0 -151
  546. data/ext/pg_query/include/access/stratnum.h +0 -83
  547. data/ext/pg_query/include/access/sysattr.h +0 -29
  548. data/ext/pg_query/include/access/table.h +0 -27
  549. data/ext/pg_query/include/access/tableam.h +0 -1825
  550. data/ext/pg_query/include/access/transam.h +0 -265
  551. data/ext/pg_query/include/access/tupconvert.h +0 -51
  552. data/ext/pg_query/include/access/tupdesc.h +0 -154
  553. data/ext/pg_query/include/access/tupmacs.h +0 -247
  554. data/ext/pg_query/include/access/twophase.h +0 -63
  555. data/ext/pg_query/include/access/xact.h +0 -469
  556. data/ext/pg_query/include/access/xlog.h +0 -398
  557. data/ext/pg_query/include/access/xlog_internal.h +0 -339
  558. data/ext/pg_query/include/access/xlogdefs.h +0 -109
  559. data/ext/pg_query/include/access/xloginsert.h +0 -64
  560. data/ext/pg_query/include/access/xlogreader.h +0 -337
  561. data/ext/pg_query/include/access/xlogrecord.h +0 -227
  562. data/ext/pg_query/include/bootstrap/bootstrap.h +0 -62
  563. data/ext/pg_query/include/c.h +0 -1334
  564. data/ext/pg_query/include/catalog/catalog.h +0 -42
  565. data/ext/pg_query/include/catalog/catversion.h +0 -58
  566. data/ext/pg_query/include/catalog/dependency.h +0 -277
  567. data/ext/pg_query/include/catalog/genbki.h +0 -64
  568. data/ext/pg_query/include/catalog/index.h +0 -199
  569. data/ext/pg_query/include/catalog/indexing.h +0 -366
  570. data/ext/pg_query/include/catalog/namespace.h +0 -188
  571. data/ext/pg_query/include/catalog/objectaccess.h +0 -197
  572. data/ext/pg_query/include/catalog/objectaddress.h +0 -84
  573. data/ext/pg_query/include/catalog/pg_aggregate.h +0 -176
  574. data/ext/pg_query/include/catalog/pg_aggregate_d.h +0 -77
  575. data/ext/pg_query/include/catalog/pg_am.h +0 -60
  576. data/ext/pg_query/include/catalog/pg_am_d.h +0 -45
  577. data/ext/pg_query/include/catalog/pg_attribute.h +0 -204
  578. data/ext/pg_query/include/catalog/pg_attribute_d.h +0 -59
  579. data/ext/pg_query/include/catalog/pg_authid.h +0 -58
  580. data/ext/pg_query/include/catalog/pg_authid_d.h +0 -49
  581. data/ext/pg_query/include/catalog/pg_class.h +0 -200
  582. data/ext/pg_query/include/catalog/pg_class_d.h +0 -103
  583. data/ext/pg_query/include/catalog/pg_collation.h +0 -73
  584. data/ext/pg_query/include/catalog/pg_collation_d.h +0 -45
  585. data/ext/pg_query/include/catalog/pg_constraint.h +0 -247
  586. data/ext/pg_query/include/catalog/pg_constraint_d.h +0 -67
  587. data/ext/pg_query/include/catalog/pg_control.h +0 -252
  588. data/ext/pg_query/include/catalog/pg_conversion.h +0 -72
  589. data/ext/pg_query/include/catalog/pg_conversion_d.h +0 -35
  590. data/ext/pg_query/include/catalog/pg_depend.h +0 -73
  591. data/ext/pg_query/include/catalog/pg_depend_d.h +0 -34
  592. data/ext/pg_query/include/catalog/pg_event_trigger.h +0 -51
  593. data/ext/pg_query/include/catalog/pg_event_trigger_d.h +0 -34
  594. data/ext/pg_query/include/catalog/pg_index.h +0 -80
  595. data/ext/pg_query/include/catalog/pg_index_d.h +0 -56
  596. data/ext/pg_query/include/catalog/pg_language.h +0 -67
  597. data/ext/pg_query/include/catalog/pg_language_d.h +0 -39
  598. data/ext/pg_query/include/catalog/pg_namespace.h +0 -59
  599. data/ext/pg_query/include/catalog/pg_namespace_d.h +0 -34
  600. data/ext/pg_query/include/catalog/pg_opclass.h +0 -85
  601. data/ext/pg_query/include/catalog/pg_opclass_d.h +0 -49
  602. data/ext/pg_query/include/catalog/pg_operator.h +0 -104
  603. data/ext/pg_query/include/catalog/pg_operator_d.h +0 -106
  604. data/ext/pg_query/include/catalog/pg_opfamily.h +0 -60
  605. data/ext/pg_query/include/catalog/pg_opfamily_d.h +0 -47
  606. data/ext/pg_query/include/catalog/pg_partitioned_table.h +0 -63
  607. data/ext/pg_query/include/catalog/pg_partitioned_table_d.h +0 -35
  608. data/ext/pg_query/include/catalog/pg_proc.h +0 -211
  609. data/ext/pg_query/include/catalog/pg_proc_d.h +0 -99
  610. data/ext/pg_query/include/catalog/pg_publication.h +0 -118
  611. data/ext/pg_query/include/catalog/pg_publication_d.h +0 -36
  612. data/ext/pg_query/include/catalog/pg_replication_origin.h +0 -57
  613. data/ext/pg_query/include/catalog/pg_replication_origin_d.h +0 -29
  614. data/ext/pg_query/include/catalog/pg_statistic.h +0 -275
  615. data/ext/pg_query/include/catalog/pg_statistic_d.h +0 -194
  616. data/ext/pg_query/include/catalog/pg_statistic_ext.h +0 -74
  617. data/ext/pg_query/include/catalog/pg_statistic_ext_d.h +0 -40
  618. data/ext/pg_query/include/catalog/pg_transform.h +0 -45
  619. data/ext/pg_query/include/catalog/pg_transform_d.h +0 -32
  620. data/ext/pg_query/include/catalog/pg_trigger.h +0 -137
  621. data/ext/pg_query/include/catalog/pg_trigger_d.h +0 -106
  622. data/ext/pg_query/include/catalog/pg_ts_config.h +0 -50
  623. data/ext/pg_query/include/catalog/pg_ts_config_d.h +0 -32
  624. data/ext/pg_query/include/catalog/pg_ts_dict.h +0 -54
  625. data/ext/pg_query/include/catalog/pg_ts_dict_d.h +0 -33
  626. data/ext/pg_query/include/catalog/pg_ts_parser.h +0 -57
  627. data/ext/pg_query/include/catalog/pg_ts_parser_d.h +0 -35
  628. data/ext/pg_query/include/catalog/pg_ts_template.h +0 -48
  629. data/ext/pg_query/include/catalog/pg_ts_template_d.h +0 -32
  630. data/ext/pg_query/include/catalog/pg_type.h +0 -373
  631. data/ext/pg_query/include/catalog/pg_type_d.h +0 -285
  632. data/ext/pg_query/include/catalog/storage.h +0 -48
  633. data/ext/pg_query/include/commands/async.h +0 -54
  634. data/ext/pg_query/include/commands/dbcommands.h +0 -35
  635. data/ext/pg_query/include/commands/defrem.h +0 -173
  636. data/ext/pg_query/include/commands/event_trigger.h +0 -88
  637. data/ext/pg_query/include/commands/explain.h +0 -127
  638. data/ext/pg_query/include/commands/prepare.h +0 -61
  639. data/ext/pg_query/include/commands/tablespace.h +0 -69
  640. data/ext/pg_query/include/commands/trigger.h +0 -285
  641. data/ext/pg_query/include/commands/user.h +0 -37
  642. data/ext/pg_query/include/commands/vacuum.h +0 -293
  643. data/ext/pg_query/include/commands/variable.h +0 -38
  644. data/ext/pg_query/include/common/file_perm.h +0 -56
  645. data/ext/pg_query/include/common/hashfn.h +0 -104
  646. data/ext/pg_query/include/common/ip.h +0 -37
  647. data/ext/pg_query/include/common/keywords.h +0 -33
  648. data/ext/pg_query/include/common/kwlookup.h +0 -44
  649. data/ext/pg_query/include/common/relpath.h +0 -90
  650. data/ext/pg_query/include/common/string.h +0 -19
  651. data/ext/pg_query/include/common/unicode_combining_table.h +0 -196
  652. data/ext/pg_query/include/datatype/timestamp.h +0 -197
  653. data/ext/pg_query/include/executor/execdesc.h +0 -70
  654. data/ext/pg_query/include/executor/executor.h +0 -620
  655. data/ext/pg_query/include/executor/functions.h +0 -41
  656. data/ext/pg_query/include/executor/instrument.h +0 -101
  657. data/ext/pg_query/include/executor/spi.h +0 -175
  658. data/ext/pg_query/include/executor/tablefunc.h +0 -67
  659. data/ext/pg_query/include/executor/tuptable.h +0 -487
  660. data/ext/pg_query/include/fmgr.h +0 -775
  661. data/ext/pg_query/include/funcapi.h +0 -348
  662. data/ext/pg_query/include/getaddrinfo.h +0 -162
  663. data/ext/pg_query/include/jit/jit.h +0 -105
  664. data/ext/pg_query/include/kwlist_d.h +0 -1072
  665. data/ext/pg_query/include/lib/ilist.h +0 -727
  666. data/ext/pg_query/include/lib/pairingheap.h +0 -102
  667. data/ext/pg_query/include/lib/simplehash.h +0 -1059
  668. data/ext/pg_query/include/lib/stringinfo.h +0 -161
  669. data/ext/pg_query/include/libpq/auth.h +0 -29
  670. data/ext/pg_query/include/libpq/crypt.h +0 -46
  671. data/ext/pg_query/include/libpq/hba.h +0 -140
  672. data/ext/pg_query/include/libpq/libpq-be.h +0 -326
  673. data/ext/pg_query/include/libpq/libpq.h +0 -134
  674. data/ext/pg_query/include/libpq/pqcomm.h +0 -208
  675. data/ext/pg_query/include/libpq/pqformat.h +0 -210
  676. data/ext/pg_query/include/libpq/pqsignal.h +0 -42
  677. data/ext/pg_query/include/mb/pg_wchar.h +0 -673
  678. data/ext/pg_query/include/mb/stringinfo_mb.h +0 -24
  679. data/ext/pg_query/include/miscadmin.h +0 -489
  680. data/ext/pg_query/include/nodes/bitmapset.h +0 -122
  681. data/ext/pg_query/include/nodes/execnodes.h +0 -2523
  682. data/ext/pg_query/include/nodes/extensible.h +0 -160
  683. data/ext/pg_query/include/nodes/lockoptions.h +0 -61
  684. data/ext/pg_query/include/nodes/makefuncs.h +0 -108
  685. data/ext/pg_query/include/nodes/memnodes.h +0 -108
  686. data/ext/pg_query/include/nodes/nodeFuncs.h +0 -162
  687. data/ext/pg_query/include/nodes/nodes.h +0 -842
  688. data/ext/pg_query/include/nodes/params.h +0 -170
  689. data/ext/pg_query/include/nodes/parsenodes.h +0 -3580
  690. data/ext/pg_query/include/nodes/pathnodes.h +0 -2557
  691. data/ext/pg_query/include/nodes/pg_list.h +0 -606
  692. data/ext/pg_query/include/nodes/plannodes.h +0 -1266
  693. data/ext/pg_query/include/nodes/primnodes.h +0 -1541
  694. data/ext/pg_query/include/nodes/print.h +0 -34
  695. data/ext/pg_query/include/nodes/tidbitmap.h +0 -75
  696. data/ext/pg_query/include/nodes/value.h +0 -61
  697. data/ext/pg_query/include/optimizer/cost.h +0 -206
  698. data/ext/pg_query/include/optimizer/geqo.h +0 -88
  699. data/ext/pg_query/include/optimizer/geqo_gene.h +0 -45
  700. data/ext/pg_query/include/optimizer/optimizer.h +0 -194
  701. data/ext/pg_query/include/optimizer/paths.h +0 -257
  702. data/ext/pg_query/include/optimizer/planmain.h +0 -119
  703. data/ext/pg_query/include/parser/analyze.h +0 -49
  704. data/ext/pg_query/include/parser/gram.h +0 -1067
  705. data/ext/pg_query/include/parser/gramparse.h +0 -75
  706. data/ext/pg_query/include/parser/kwlist.h +0 -477
  707. data/ext/pg_query/include/parser/parse_agg.h +0 -68
  708. data/ext/pg_query/include/parser/parse_clause.h +0 -54
  709. data/ext/pg_query/include/parser/parse_coerce.h +0 -98
  710. data/ext/pg_query/include/parser/parse_collate.h +0 -27
  711. data/ext/pg_query/include/parser/parse_expr.h +0 -26
  712. data/ext/pg_query/include/parser/parse_func.h +0 -73
  713. data/ext/pg_query/include/parser/parse_node.h +0 -327
  714. data/ext/pg_query/include/parser/parse_oper.h +0 -67
  715. data/ext/pg_query/include/parser/parse_relation.h +0 -123
  716. data/ext/pg_query/include/parser/parse_target.h +0 -46
  717. data/ext/pg_query/include/parser/parse_type.h +0 -60
  718. data/ext/pg_query/include/parser/parser.h +0 -41
  719. data/ext/pg_query/include/parser/parsetree.h +0 -61
  720. data/ext/pg_query/include/parser/scanner.h +0 -152
  721. data/ext/pg_query/include/parser/scansup.h +0 -30
  722. data/ext/pg_query/include/partitioning/partdefs.h +0 -26
  723. data/ext/pg_query/include/pg_config.h +0 -995
  724. data/ext/pg_query/include/pg_config_manual.h +0 -357
  725. data/ext/pg_query/include/pg_config_os.h +0 -8
  726. data/ext/pg_query/include/pg_getopt.h +0 -56
  727. data/ext/pg_query/include/pg_trace.h +0 -17
  728. data/ext/pg_query/include/pgstat.h +0 -1488
  729. data/ext/pg_query/include/pgtime.h +0 -84
  730. data/ext/pg_query/include/pl_gram.h +0 -385
  731. data/ext/pg_query/include/pl_reserved_kwlist.h +0 -52
  732. data/ext/pg_query/include/pl_reserved_kwlist_d.h +0 -114
  733. data/ext/pg_query/include/pl_unreserved_kwlist.h +0 -112
  734. data/ext/pg_query/include/pl_unreserved_kwlist_d.h +0 -246
  735. data/ext/pg_query/include/plerrcodes.h +0 -990
  736. data/ext/pg_query/include/plpgsql.h +0 -1347
  737. data/ext/pg_query/include/port/atomics/arch-arm.h +0 -26
  738. data/ext/pg_query/include/port/atomics/arch-ppc.h +0 -254
  739. data/ext/pg_query/include/port/atomics/arch-x86.h +0 -252
  740. data/ext/pg_query/include/port/atomics/fallback.h +0 -170
  741. data/ext/pg_query/include/port/atomics/generic-gcc.h +0 -286
  742. data/ext/pg_query/include/port/atomics/generic.h +0 -401
  743. data/ext/pg_query/include/port/atomics.h +0 -524
  744. data/ext/pg_query/include/port/pg_bitutils.h +0 -272
  745. data/ext/pg_query/include/port/pg_bswap.h +0 -161
  746. data/ext/pg_query/include/port/pg_crc32c.h +0 -101
  747. data/ext/pg_query/include/port.h +0 -528
  748. data/ext/pg_query/include/portability/instr_time.h +0 -256
  749. data/ext/pg_query/include/postgres.h +0 -764
  750. data/ext/pg_query/include/postgres_ext.h +0 -74
  751. data/ext/pg_query/include/postmaster/autovacuum.h +0 -83
  752. data/ext/pg_query/include/postmaster/bgworker.h +0 -161
  753. data/ext/pg_query/include/postmaster/bgworker_internals.h +0 -64
  754. data/ext/pg_query/include/postmaster/bgwriter.h +0 -45
  755. data/ext/pg_query/include/postmaster/fork_process.h +0 -17
  756. data/ext/pg_query/include/postmaster/interrupt.h +0 -32
  757. data/ext/pg_query/include/postmaster/pgarch.h +0 -39
  758. data/ext/pg_query/include/postmaster/postmaster.h +0 -77
  759. data/ext/pg_query/include/postmaster/syslogger.h +0 -98
  760. data/ext/pg_query/include/postmaster/walwriter.h +0 -21
  761. data/ext/pg_query/include/regex/regex.h +0 -184
  762. data/ext/pg_query/include/replication/logicallauncher.h +0 -31
  763. data/ext/pg_query/include/replication/logicalproto.h +0 -110
  764. data/ext/pg_query/include/replication/logicalworker.h +0 -19
  765. data/ext/pg_query/include/replication/origin.h +0 -73
  766. data/ext/pg_query/include/replication/reorderbuffer.h +0 -468
  767. data/ext/pg_query/include/replication/slot.h +0 -219
  768. data/ext/pg_query/include/replication/syncrep.h +0 -115
  769. data/ext/pg_query/include/replication/walreceiver.h +0 -340
  770. data/ext/pg_query/include/replication/walsender.h +0 -74
  771. data/ext/pg_query/include/rewrite/prs2lock.h +0 -46
  772. data/ext/pg_query/include/rewrite/rewriteHandler.h +0 -40
  773. data/ext/pg_query/include/rewrite/rewriteManip.h +0 -87
  774. data/ext/pg_query/include/rewrite/rewriteSupport.h +0 -26
  775. data/ext/pg_query/include/storage/backendid.h +0 -37
  776. data/ext/pg_query/include/storage/block.h +0 -121
  777. data/ext/pg_query/include/storage/buf.h +0 -46
  778. data/ext/pg_query/include/storage/bufmgr.h +0 -292
  779. data/ext/pg_query/include/storage/bufpage.h +0 -459
  780. data/ext/pg_query/include/storage/condition_variable.h +0 -62
  781. data/ext/pg_query/include/storage/dsm.h +0 -61
  782. data/ext/pg_query/include/storage/dsm_impl.h +0 -75
  783. data/ext/pg_query/include/storage/fd.h +0 -168
  784. data/ext/pg_query/include/storage/ipc.h +0 -81
  785. data/ext/pg_query/include/storage/item.h +0 -19
  786. data/ext/pg_query/include/storage/itemid.h +0 -184
  787. data/ext/pg_query/include/storage/itemptr.h +0 -206
  788. data/ext/pg_query/include/storage/large_object.h +0 -100
  789. data/ext/pg_query/include/storage/latch.h +0 -190
  790. data/ext/pg_query/include/storage/lmgr.h +0 -114
  791. data/ext/pg_query/include/storage/lock.h +0 -613
  792. data/ext/pg_query/include/storage/lockdefs.h +0 -59
  793. data/ext/pg_query/include/storage/lwlock.h +0 -233
  794. data/ext/pg_query/include/storage/lwlocknames.h +0 -51
  795. data/ext/pg_query/include/storage/off.h +0 -57
  796. data/ext/pg_query/include/storage/pg_sema.h +0 -61
  797. data/ext/pg_query/include/storage/pg_shmem.h +0 -90
  798. data/ext/pg_query/include/storage/pmsignal.h +0 -94
  799. data/ext/pg_query/include/storage/predicate.h +0 -87
  800. data/ext/pg_query/include/storage/proc.h +0 -347
  801. data/ext/pg_query/include/storage/proclist_types.h +0 -51
  802. data/ext/pg_query/include/storage/procsignal.h +0 -75
  803. data/ext/pg_query/include/storage/relfilenode.h +0 -99
  804. data/ext/pg_query/include/storage/s_lock.h +0 -1071
  805. data/ext/pg_query/include/storage/sharedfileset.h +0 -45
  806. data/ext/pg_query/include/storage/shm_mq.h +0 -85
  807. data/ext/pg_query/include/storage/shm_toc.h +0 -58
  808. data/ext/pg_query/include/storage/shmem.h +0 -81
  809. data/ext/pg_query/include/storage/sinval.h +0 -153
  810. data/ext/pg_query/include/storage/sinvaladt.h +0 -43
  811. data/ext/pg_query/include/storage/smgr.h +0 -109
  812. data/ext/pg_query/include/storage/spin.h +0 -77
  813. data/ext/pg_query/include/storage/standby.h +0 -91
  814. data/ext/pg_query/include/storage/standbydefs.h +0 -74
  815. data/ext/pg_query/include/storage/sync.h +0 -62
  816. data/ext/pg_query/include/tcop/cmdtag.h +0 -58
  817. data/ext/pg_query/include/tcop/cmdtaglist.h +0 -217
  818. data/ext/pg_query/include/tcop/deparse_utility.h +0 -108
  819. data/ext/pg_query/include/tcop/dest.h +0 -149
  820. data/ext/pg_query/include/tcop/fastpath.h +0 -21
  821. data/ext/pg_query/include/tcop/pquery.h +0 -51
  822. data/ext/pg_query/include/tcop/tcopprot.h +0 -89
  823. data/ext/pg_query/include/tcop/utility.h +0 -108
  824. data/ext/pg_query/include/tsearch/ts_cache.h +0 -98
  825. data/ext/pg_query/include/utils/acl.h +0 -312
  826. data/ext/pg_query/include/utils/aclchk_internal.h +0 -45
  827. data/ext/pg_query/include/utils/array.h +0 -459
  828. data/ext/pg_query/include/utils/builtins.h +0 -128
  829. data/ext/pg_query/include/utils/bytea.h +0 -27
  830. data/ext/pg_query/include/utils/catcache.h +0 -231
  831. data/ext/pg_query/include/utils/date.h +0 -90
  832. data/ext/pg_query/include/utils/datetime.h +0 -343
  833. data/ext/pg_query/include/utils/datum.h +0 -68
  834. data/ext/pg_query/include/utils/dsa.h +0 -123
  835. data/ext/pg_query/include/utils/dynahash.h +0 -19
  836. data/ext/pg_query/include/utils/elog.h +0 -439
  837. data/ext/pg_query/include/utils/errcodes.h +0 -352
  838. data/ext/pg_query/include/utils/expandeddatum.h +0 -159
  839. data/ext/pg_query/include/utils/expandedrecord.h +0 -231
  840. data/ext/pg_query/include/utils/float.h +0 -356
  841. data/ext/pg_query/include/utils/fmgroids.h +0 -2657
  842. data/ext/pg_query/include/utils/fmgrprotos.h +0 -2646
  843. data/ext/pg_query/include/utils/fmgrtab.h +0 -48
  844. data/ext/pg_query/include/utils/guc.h +0 -443
  845. data/ext/pg_query/include/utils/guc_tables.h +0 -272
  846. data/ext/pg_query/include/utils/hsearch.h +0 -149
  847. data/ext/pg_query/include/utils/inval.h +0 -65
  848. data/ext/pg_query/include/utils/lsyscache.h +0 -198
  849. data/ext/pg_query/include/utils/memdebug.h +0 -82
  850. data/ext/pg_query/include/utils/memutils.h +0 -225
  851. data/ext/pg_query/include/utils/numeric.h +0 -76
  852. data/ext/pg_query/include/utils/palloc.h +0 -136
  853. data/ext/pg_query/include/utils/partcache.h +0 -102
  854. data/ext/pg_query/include/utils/pg_locale.h +0 -119
  855. data/ext/pg_query/include/utils/pg_lsn.h +0 -29
  856. data/ext/pg_query/include/utils/pidfile.h +0 -56
  857. data/ext/pg_query/include/utils/plancache.h +0 -235
  858. data/ext/pg_query/include/utils/portal.h +0 -254
  859. data/ext/pg_query/include/utils/probes.h +0 -114
  860. data/ext/pg_query/include/utils/ps_status.h +0 -25
  861. data/ext/pg_query/include/utils/queryenvironment.h +0 -74
  862. data/ext/pg_query/include/utils/regproc.h +0 -28
  863. data/ext/pg_query/include/utils/rel.h +0 -643
  864. data/ext/pg_query/include/utils/relcache.h +0 -150
  865. data/ext/pg_query/include/utils/reltrigger.h +0 -81
  866. data/ext/pg_query/include/utils/resowner.h +0 -86
  867. data/ext/pg_query/include/utils/rls.h +0 -50
  868. data/ext/pg_query/include/utils/ruleutils.h +0 -44
  869. data/ext/pg_query/include/utils/sharedtuplestore.h +0 -61
  870. data/ext/pg_query/include/utils/snapmgr.h +0 -159
  871. data/ext/pg_query/include/utils/snapshot.h +0 -206
  872. data/ext/pg_query/include/utils/sortsupport.h +0 -276
  873. data/ext/pg_query/include/utils/syscache.h +0 -219
  874. data/ext/pg_query/include/utils/timeout.h +0 -88
  875. data/ext/pg_query/include/utils/timestamp.h +0 -116
  876. data/ext/pg_query/include/utils/tuplesort.h +0 -277
  877. data/ext/pg_query/include/utils/tuplestore.h +0 -91
  878. data/ext/pg_query/include/utils/typcache.h +0 -202
  879. data/ext/pg_query/include/utils/tzparser.h +0 -39
  880. data/ext/pg_query/include/utils/varlena.h +0 -39
  881. data/ext/pg_query/include/utils/xml.h +0 -84
  882. data/ext/pg_query/pg_query_ruby_freebsd.sym +0 -2
  883. data/ext/pg_query/src_backend_libpq_pqcomm.c +0 -659
  884. data/ext/pg_query/src_backend_parser_parse_expr.c +0 -313
  885. data/ext/pg_query/src_backend_postmaster_postmaster.c +0 -2230
  886. data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -370
  887. data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1086
  888. data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1832
  889. data/ext/pg_query/src_common_string.c +0 -86
  890. data/ext/pg_query/src_port_erand48.c +0 -127
  891. data/ext/pg_query/src_port_pgsleep.c +0 -69
  892. data/ext/pg_query/src_port_random.c +0 -31
  893. data/ext/pg_query/src_port_strnlen.c +0 -39
  894. /data/ext/pg_query/{pg_query_ruby.sym → ext_symbols.sym} +0 -0
  895. /data/ext/pg_query/include/{pg_config_ext.h → postgres/pg_config_ext.h} +0 -0
@@ -16,18 +16,18 @@
16
16
  * - read_datatype
17
17
  * - parse_datatype
18
18
  * - read_sql_expression
19
+ * - read_sql_construct
20
+ * - check_sql_expr
21
+ * - plpgsql_sql_error_callback
22
+ * - check_assignable
19
23
  * - tok_is_keyword
24
+ * - NameOfDatum
20
25
  * - word_is_not_variable
21
26
  * - cword_is_not_variable
22
- * - check_assignable
23
27
  * - make_case
24
28
  * - read_sql_expression2
25
29
  * - make_scalar_list1
26
30
  * - read_cursor_args
27
- * - read_sql_construct
28
- * - check_sql_expr
29
- * - plpgsql_sql_error_callback
30
- * - NameOfDatum
31
31
  * - read_into_scalar_list
32
32
  * - current_token_is_not_variable
33
33
  * - make_return_next_stmt
@@ -204,39 +204,39 @@
204
204
  K_LAST = 336,
205
205
  K_LOG = 337,
206
206
  K_LOOP = 338,
207
- K_MESSAGE = 339,
208
- K_MESSAGE_TEXT = 340,
209
- K_MOVE = 341,
210
- K_NEXT = 342,
211
- K_NO = 343,
212
- K_NOT = 344,
213
- K_NOTICE = 345,
214
- K_NULL = 346,
215
- K_OPEN = 347,
216
- K_OPTION = 348,
217
- K_OR = 349,
218
- K_PERFORM = 350,
219
- K_PG_CONTEXT = 351,
220
- K_PG_DATATYPE_NAME = 352,
221
- K_PG_EXCEPTION_CONTEXT = 353,
222
- K_PG_EXCEPTION_DETAIL = 354,
223
- K_PG_EXCEPTION_HINT = 355,
224
- K_PRINT_STRICT_PARAMS = 356,
225
- K_PRIOR = 357,
226
- K_QUERY = 358,
227
- K_RAISE = 359,
228
- K_RELATIVE = 360,
229
- K_RESET = 361,
230
- K_RETURN = 362,
231
- K_RETURNED_SQLSTATE = 363,
232
- K_REVERSE = 364,
233
- K_ROLLBACK = 365,
234
- K_ROW_COUNT = 366,
235
- K_ROWTYPE = 367,
236
- K_SCHEMA = 368,
237
- K_SCHEMA_NAME = 369,
238
- K_SCROLL = 370,
239
- K_SET = 371,
207
+ K_MERGE = 339,
208
+ K_MESSAGE = 340,
209
+ K_MESSAGE_TEXT = 341,
210
+ K_MOVE = 342,
211
+ K_NEXT = 343,
212
+ K_NO = 344,
213
+ K_NOT = 345,
214
+ K_NOTICE = 346,
215
+ K_NULL = 347,
216
+ K_OPEN = 348,
217
+ K_OPTION = 349,
218
+ K_OR = 350,
219
+ K_PERFORM = 351,
220
+ K_PG_CONTEXT = 352,
221
+ K_PG_DATATYPE_NAME = 353,
222
+ K_PG_EXCEPTION_CONTEXT = 354,
223
+ K_PG_EXCEPTION_DETAIL = 355,
224
+ K_PG_EXCEPTION_HINT = 356,
225
+ K_PG_ROUTINE_OID = 357,
226
+ K_PRINT_STRICT_PARAMS = 358,
227
+ K_PRIOR = 359,
228
+ K_QUERY = 360,
229
+ K_RAISE = 361,
230
+ K_RELATIVE = 362,
231
+ K_RETURN = 363,
232
+ K_RETURNED_SQLSTATE = 364,
233
+ K_REVERSE = 365,
234
+ K_ROLLBACK = 366,
235
+ K_ROW_COUNT = 367,
236
+ K_ROWTYPE = 368,
237
+ K_SCHEMA = 369,
238
+ K_SCHEMA_NAME = 370,
239
+ K_SCROLL = 371,
240
240
  K_SLICE = 372,
241
241
  K_SQLSTATE = 373,
242
242
  K_STACKED = 374,
@@ -337,39 +337,39 @@
337
337
  #define K_LAST 336
338
338
  #define K_LOG 337
339
339
  #define K_LOOP 338
340
- #define K_MESSAGE 339
341
- #define K_MESSAGE_TEXT 340
342
- #define K_MOVE 341
343
- #define K_NEXT 342
344
- #define K_NO 343
345
- #define K_NOT 344
346
- #define K_NOTICE 345
347
- #define K_NULL 346
348
- #define K_OPEN 347
349
- #define K_OPTION 348
350
- #define K_OR 349
351
- #define K_PERFORM 350
352
- #define K_PG_CONTEXT 351
353
- #define K_PG_DATATYPE_NAME 352
354
- #define K_PG_EXCEPTION_CONTEXT 353
355
- #define K_PG_EXCEPTION_DETAIL 354
356
- #define K_PG_EXCEPTION_HINT 355
357
- #define K_PRINT_STRICT_PARAMS 356
358
- #define K_PRIOR 357
359
- #define K_QUERY 358
360
- #define K_RAISE 359
361
- #define K_RELATIVE 360
362
- #define K_RESET 361
363
- #define K_RETURN 362
364
- #define K_RETURNED_SQLSTATE 363
365
- #define K_REVERSE 364
366
- #define K_ROLLBACK 365
367
- #define K_ROW_COUNT 366
368
- #define K_ROWTYPE 367
369
- #define K_SCHEMA 368
370
- #define K_SCHEMA_NAME 369
371
- #define K_SCROLL 370
372
- #define K_SET 371
340
+ #define K_MERGE 339
341
+ #define K_MESSAGE 340
342
+ #define K_MESSAGE_TEXT 341
343
+ #define K_MOVE 342
344
+ #define K_NEXT 343
345
+ #define K_NO 344
346
+ #define K_NOT 345
347
+ #define K_NOTICE 346
348
+ #define K_NULL 347
349
+ #define K_OPEN 348
350
+ #define K_OPTION 349
351
+ #define K_OR 350
352
+ #define K_PERFORM 351
353
+ #define K_PG_CONTEXT 352
354
+ #define K_PG_DATATYPE_NAME 353
355
+ #define K_PG_EXCEPTION_CONTEXT 354
356
+ #define K_PG_EXCEPTION_DETAIL 355
357
+ #define K_PG_EXCEPTION_HINT 356
358
+ #define K_PG_ROUTINE_OID 357
359
+ #define K_PRINT_STRICT_PARAMS 358
360
+ #define K_PRIOR 359
361
+ #define K_QUERY 360
362
+ #define K_RAISE 361
363
+ #define K_RELATIVE 362
364
+ #define K_RETURN 363
365
+ #define K_RETURNED_SQLSTATE 364
366
+ #define K_REVERSE 365
367
+ #define K_ROLLBACK 366
368
+ #define K_ROW_COUNT 367
369
+ #define K_ROWTYPE 368
370
+ #define K_SCHEMA 369
371
+ #define K_SCHEMA_NAME 370
372
+ #define K_SCROLL 371
373
373
  #define K_SLICE 372
374
374
  #define K_SQLSTATE 373
375
375
  #define K_STACKED 374
@@ -397,7 +397,7 @@
397
397
  *
398
398
  * pl_gram.y - Parser for the PL/pgSQL procedural language
399
399
  *
400
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
400
+ * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
401
401
  * Portions Copyright (c) 1994, Regents of the University of California
402
402
  *
403
403
  *
@@ -433,10 +433,7 @@
433
433
  /*
434
434
  * Bison doesn't allocate anything that needs to live across parser calls,
435
435
  * so we can easily have it use palloc instead of malloc. This prevents
436
- * memory leaks if we error out during parsing. Note this only works with
437
- * bison >= 2.0. However, in bison 1.875 the default is to use alloca()
438
- * if possible, so there's not really much problem anyhow, at least if
439
- * you're building with gcc.
436
+ * memory leaks if we error out during parsing.
440
437
  */
441
438
  #define YYMALLOC palloc
442
439
  #define YYFREE pfree
@@ -445,7 +442,6 @@
445
442
  typedef struct
446
443
  {
447
444
  int location;
448
- int leaderlen;
449
445
  } sql_error_callback_arg;
450
446
 
451
447
  #define parser_errposition(pos) plpgsql_scanner_errposition(pos)
@@ -461,10 +457,9 @@ static PLpgSQL_expr *read_sql_construct(int until,
461
457
  int until2,
462
458
  int until3,
463
459
  const char *expected,
464
- const char *sqlstart,
460
+ RawParseMode parsemode,
465
461
  bool isexpression,
466
462
  bool valid_sql,
467
- bool trim,
468
463
  int *startloc,
469
464
  int *endtoken);
470
465
  static PLpgSQL_expr *read_sql_expression(int until,
@@ -472,9 +467,10 @@ static PLpgSQL_expr *read_sql_expression(int until,
472
467
  static PLpgSQL_expr *read_sql_expression2(int until, int until2,
473
468
  const char *expected,
474
469
  int *endtoken);
475
- static PLpgSQL_expr *read_sql_stmt(const char *sqlstart);
470
+ static PLpgSQL_expr *read_sql_stmt(void);
476
471
  static PLpgSQL_type *read_datatype(int tok);
477
- static PLpgSQL_stmt *make_execsql_stmt(int firsttoken, int location);
472
+ static PLpgSQL_stmt *make_execsql_stmt(int firsttoken, int location,
473
+ PLword *word);
478
474
  static PLpgSQL_stmt_fetch *read_fetch_direction(void);
479
475
  static void complete_direction(PLpgSQL_stmt_fetch *fetch,
480
476
  bool *check_FROM);
@@ -493,15 +489,15 @@ static PLpgSQL_row *read_into_scalar_list(char *initial_name,
493
489
  static PLpgSQL_row *make_scalar_list1(char *initial_name,
494
490
  PLpgSQL_datum *initial_datum,
495
491
  int lineno, int location);
496
- static void check_sql_expr(const char *stmt, int location,
497
- int leaderlen);
492
+ static void check_sql_expr(const char *stmt,
493
+ RawParseMode parseMode, int location);
498
494
  static void plpgsql_sql_error_callback(void *arg);
499
495
  static PLpgSQL_type *parse_datatype(const char *string, int location);
500
496
  static void check_labels(const char *start_label,
501
497
  const char *end_label,
502
498
  int end_location);
503
499
  static PLpgSQL_expr *read_cursor_args(PLpgSQL_var *cursor,
504
- int until, const char *expected);
500
+ int until);
505
501
  static List *read_raise_options(void);
506
502
  static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
507
503
 
@@ -527,59 +523,59 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
527
523
 
528
524
  #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
529
525
  typedef union YYSTYPE
530
- #line 120 "pl_gram.y"
526
+ #line 117 "pl_gram.y"
531
527
  {
532
- core_YYSTYPE core_yystype;
533
- /* these fields must match core_YYSTYPE: */
534
- int ival;
535
- char *str;
536
- const char *keyword;
537
-
538
- PLword word;
539
- PLcword cword;
540
- PLwdatum wdatum;
541
- bool boolean;
542
- Oid oid;
543
- struct
544
- {
545
- char *name;
546
- int lineno;
547
- } varname;
548
- struct
549
- {
550
- char *name;
551
- int lineno;
552
- PLpgSQL_datum *scalar;
553
- PLpgSQL_datum *row;
554
- } forvariable;
555
- struct
556
- {
557
- char *label;
558
- int n_initvars;
559
- int *initvarnos;
560
- } declhdr;
561
- struct
562
- {
563
- List *stmts;
564
- char *end_label;
565
- int end_label_location;
566
- } loop_body;
567
- List *list;
568
- PLpgSQL_type *dtype;
569
- PLpgSQL_datum *datum;
570
- PLpgSQL_var *var;
571
- PLpgSQL_expr *expr;
572
- PLpgSQL_stmt *stmt;
573
- PLpgSQL_condition *condition;
574
- PLpgSQL_exception *exception;
575
- PLpgSQL_exception_block *exception_block;
576
- PLpgSQL_nsitem *nsitem;
577
- PLpgSQL_diag_item *diagitem;
578
- PLpgSQL_stmt_fetch *fetch;
579
- PLpgSQL_case_when *casewhen;
528
+ core_YYSTYPE core_yystype;
529
+ /* these fields must match core_YYSTYPE: */
530
+ int ival;
531
+ char *str;
532
+ const char *keyword;
533
+
534
+ PLword word;
535
+ PLcword cword;
536
+ PLwdatum wdatum;
537
+ bool boolean;
538
+ Oid oid;
539
+ struct
540
+ {
541
+ char *name;
542
+ int lineno;
543
+ } varname;
544
+ struct
545
+ {
546
+ char *name;
547
+ int lineno;
548
+ PLpgSQL_datum *scalar;
549
+ PLpgSQL_datum *row;
550
+ } forvariable;
551
+ struct
552
+ {
553
+ char *label;
554
+ int n_initvars;
555
+ int *initvarnos;
556
+ } declhdr;
557
+ struct
558
+ {
559
+ List *stmts;
560
+ char *end_label;
561
+ int end_label_location;
562
+ } loop_body;
563
+ List *list;
564
+ PLpgSQL_type *dtype;
565
+ PLpgSQL_datum *datum;
566
+ PLpgSQL_var *var;
567
+ PLpgSQL_expr *expr;
568
+ PLpgSQL_stmt *stmt;
569
+ PLpgSQL_condition *condition;
570
+ PLpgSQL_exception *exception;
571
+ PLpgSQL_exception_block *exception_block;
572
+ PLpgSQL_nsitem *nsitem;
573
+ PLpgSQL_diag_item *diagitem;
574
+ PLpgSQL_stmt_fetch *fetch;
575
+ PLpgSQL_case_when *casewhen;
580
576
  }
581
577
  /* Line 193 of yacc.c. */
582
- #line 534 "pl_gram.c"
578
+ #line 530 "pl_gram.c"
583
579
  YYSTYPE;
584
580
  # define yystype YYSTYPE /* obsolescent; will be withdrawn */
585
581
  # define YYSTYPE_IS_DECLARED 1
@@ -604,7 +600,7 @@ typedef struct YYLTYPE
604
600
 
605
601
 
606
602
  /* Line 216 of yacc.c. */
607
- #line 559 "pl_gram.c"
603
+ #line 555 "pl_gram.c"
608
604
 
609
605
  #ifdef short
610
606
  # undef short
@@ -821,16 +817,16 @@ union yyalloc
821
817
  /* YYFINAL -- State number of the termination state. */
822
818
  #define YYFINAL 3
823
819
  /* YYLAST -- Last index in YYTABLE. */
824
- #define YYLAST 1465
820
+ #define YYLAST 1335
825
821
 
826
822
  /* YYNTOKENS -- Number of terminals. */
827
- #define YYNTOKENS 140
823
+ #define YYNTOKENS 139
828
824
  /* YYNNTS -- Number of nonterminals. */
829
- #define YYNNTS 90
825
+ #define YYNNTS 87
830
826
  /* YYNRULES -- Number of rules. */
831
- #define YYNRULES 258
827
+ #define YYNRULES 253
832
828
  /* YYNRULES -- Number of states. */
833
- #define YYNSTATES 342
829
+ #define YYNSTATES 334
834
830
 
835
831
  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
836
832
  #define YYUNDEFTOK 2
@@ -851,7 +847,7 @@ static const yytype_uint8 yytranslate[] =
851
847
  2, 138, 2, 2, 2, 2, 2, 2, 2, 2,
852
848
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
853
849
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
854
- 2, 139, 2, 2, 2, 2, 2, 2, 2, 2,
850
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
855
851
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
856
852
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
857
853
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -896,123 +892,122 @@ static const yytype_uint16 yyprhs[] =
896
892
  137, 140, 141, 144, 146, 148, 150, 152, 154, 156,
897
893
  157, 160, 163, 165, 167, 169, 171, 173, 175, 177,
898
894
  179, 181, 183, 185, 187, 189, 191, 193, 195, 197,
899
- 199, 201, 203, 205, 207, 209, 211, 214, 216, 218,
900
- 222, 228, 229, 231, 233, 237, 239, 243, 244, 246,
901
- 248, 250, 252, 256, 265, 266, 271, 272, 275, 283,
902
- 284, 287, 289, 293, 294, 297, 301, 306, 311, 314,
903
- 316, 318, 320, 329, 330, 333, 337, 339, 341, 343,
904
- 345, 347, 353, 355, 357, 359, 361, 363, 366, 371,
905
- 376, 377, 381, 384, 388, 392, 395, 399, 400, 402,
906
- 404, 406, 408, 410, 411, 412, 416, 419, 421, 426,
907
- 430, 432, 434, 435, 436, 437, 438, 439, 443, 444,
908
- 448, 449, 451, 453, 456, 458, 460, 462, 464, 466,
909
- 468, 470, 472, 474, 476, 478, 480, 482, 484, 486,
910
- 488, 490, 492, 494, 496, 498, 500, 502, 504, 506,
911
- 508, 510, 512, 514, 516, 518, 520, 522, 524, 526,
912
- 528, 530, 532, 534, 536, 538, 540, 542, 544, 546,
913
- 548, 550, 552, 554, 556, 558, 560, 562, 564, 566,
914
- 568, 570, 572, 574, 576, 578, 580, 582, 584, 586,
915
- 588, 590, 592, 594, 596, 598, 600, 602, 604, 606,
916
- 608, 610, 612, 614, 616, 618, 620, 622, 624
895
+ 199, 201, 203, 205, 207, 209, 211, 213, 215, 217,
896
+ 223, 224, 226, 228, 232, 234, 238, 239, 241, 243,
897
+ 245, 254, 255, 260, 261, 264, 272, 273, 276, 278,
898
+ 282, 283, 286, 290, 295, 300, 303, 305, 307, 309,
899
+ 318, 319, 322, 326, 328, 330, 332, 334, 336, 342,
900
+ 344, 346, 348, 350, 352, 354, 357, 362, 367, 368,
901
+ 372, 375, 379, 383, 386, 390, 391, 393, 395, 397,
902
+ 398, 399, 403, 406, 408, 413, 417, 419, 421, 422,
903
+ 423, 424, 425, 429, 430, 434, 435, 437, 439, 442,
904
+ 444, 446, 448, 450, 452, 454, 456, 458, 460, 462,
905
+ 464, 466, 468, 470, 472, 474, 476, 478, 480, 482,
906
+ 484, 486, 488, 490, 492, 494, 496, 498, 500, 502,
907
+ 504, 506, 508, 510, 512, 514, 516, 518, 520, 522,
908
+ 524, 526, 528, 530, 532, 534, 536, 538, 540, 542,
909
+ 544, 546, 548, 550, 552, 554, 556, 558, 560, 562,
910
+ 564, 566, 568, 570, 572, 574, 576, 578, 580, 582,
911
+ 584, 586, 588, 590, 592, 594, 596, 598, 600, 602,
912
+ 604, 606, 608, 610
917
913
  };
918
914
 
919
915
  /* YYRHS -- A `-1'-separated list of the rules' RHS. */
920
916
  static const yytype_int16 yyrhs[] =
921
917
  {
922
- 141, 0, -1, 142, 146, 145, -1, -1, 142, 143,
923
- -1, 133, 93, 57, -1, 133, 101, 144, -1, 133,
918
+ 140, 0, -1, 141, 145, 144, -1, -1, 141, 142,
919
+ -1, 133, 94, 57, -1, 133, 103, 143, -1, 133,
924
920
  129, 62, -1, 133, 129, 127, -1, 133, 129, 126,
925
- -1, 22, -1, 229, -1, -1, 134, -1, 147, 34,
926
- 168, 214, 60, 226, -1, 224, -1, 224, 148, -1,
927
- 224, 148, 149, -1, 52, -1, 149, 150, -1, 150,
928
- -1, 151, -1, 52, -1, 25, 228, 26, -1, 160,
929
- 161, 162, 163, 164, 165, -1, 160, 28, 68, 159,
930
- 134, -1, -1, 160, 153, 49, 152, 155, 158, 154,
931
- -1, -1, 88, 115, -1, 115, -1, -1, -1, 135,
932
- 156, 136, -1, 157, -1, 156, 137, 157, -1, 160,
933
- 162, -1, 80, -1, 68, -1, 22, -1, 229, -1,
934
- 23, -1, 22, -1, 229, -1, -1, 44, -1, -1,
935
- -1, 40, 22, -1, 40, 229, -1, 40, 23, -1,
936
- -1, 89, 91, -1, 134, -1, 166, -1, 167, -1,
937
- 53, -1, 138, -1, 15, -1, -1, 168, 169, -1,
938
- 146, 134, -1, 172, -1, 180, -1, 183, -1, 188,
939
- -1, 189, -1, 190, -1, 193, -1, 195, -1, 197,
940
- -1, 198, -1, 199, -1, 201, -1, 202, -1, 170,
941
- -1, 171, -1, 173, -1, 203, -1, 204, -1, 205,
942
- -1, 207, -1, 208, -1, 209, -1, 210, -1, 212,
943
- -1, 95, 220, -1, 36, -1, 56, -1, 179, 167,
944
- 220, -1, 72, 174, 55, 175, 134, -1, -1, 48,
945
- -1, 119, -1, 175, 137, 176, -1, 176, -1, 178,
946
- 167, 177, -1, -1, 179, -1, 22, -1, 23, -1,
947
- 24, -1, 179, 139, 221, -1, 74, 222, 168, 181,
948
- 182, 60, 74, 134, -1, -1, 181, 59, 222, 168,
949
- -1, -1, 58, 168, -1, 37, 184, 185, 187, 60,
950
- 37, 134, -1, -1, 185, 186, -1, 186, -1, 131,
951
- 222, 168, -1, -1, 58, 168, -1, 225, 83, 200,
952
- -1, 225, 132, 223, 200, -1, 225, 68, 191, 200,
953
- -1, 192, 76, -1, 24, -1, 22, -1, 23, -1,
954
- 225, 69, 192, 194, 76, 31, 223, 200, -1, -1,
955
- 117, 11, -1, 196, 226, 227, -1, 65, -1, 47,
956
- -1, 107, -1, 104, -1, 32, -1, 168, 60, 83,
957
- 226, 134, -1, 75, -1, 78, -1, 22, -1, 23,
958
- -1, 64, -1, 92, 213, -1, 66, 206, 213, 79,
959
- -1, 86, 206, 213, 134, -1, -1, 39, 213, 134,
960
- -1, 91, 134, -1, 43, 211, 134, -1, 110, 211,
961
- 134, -1, 30, 38, -1, 30, 88, 38, -1, -1,
962
- 116, -1, 106, -1, 24, -1, 22, -1, 23, -1,
963
- -1, -1, 63, 215, 216, -1, 216, 217, -1, 217,
964
- -1, 131, 218, 123, 168, -1, 218, 94, 219, -1,
965
- 219, -1, 228, -1, -1, -1, -1, -1, -1, 25,
966
- 228, 26, -1, -1, 25, 228, 26, -1, -1, 228,
967
- -1, 134, -1, 131, 220, -1, 22, -1, 229, -1,
968
- 24, -1, 27, -1, 28, -1, 30, -1, 31, -1,
969
- 32, -1, 33, -1, 36, -1, 38, -1, 39, -1,
970
- 40, -1, 41, -1, 42, -1, 43, -1, 44, -1,
971
- 45, -1, 46, -1, 47, -1, 48, -1, 49, -1,
972
- 50, -1, 51, -1, 53, -1, 54, -1, 55, -1,
973
- 56, -1, 57, -1, 59, -1, 61, -1, 62, -1,
974
- 63, -1, 65, -1, 66, -1, 67, -1, 70, -1,
975
- 72, -1, 73, -1, 75, -1, 77, -1, 78, -1,
976
- 80, -1, 81, -1, 82, -1, 84, -1, 85, -1,
977
- 86, -1, 87, -1, 88, -1, 90, -1, 92, -1,
978
- 93, -1, 95, -1, 96, -1, 97, -1, 98, -1,
979
- 99, -1, 100, -1, 101, -1, 102, -1, 103, -1,
980
- 104, -1, 105, -1, 106, -1, 107, -1, 108, -1,
981
- 109, -1, 110, -1, 111, -1, 112, -1, 113, -1,
982
- 114, -1, 115, -1, 116, -1, 117, -1, 118, -1,
983
- 119, -1, 121, -1, 122, -1, 125, -1, 126, -1,
984
- 127, -1, 129, -1, 130, -1
921
+ -1, 22, -1, 225, -1, -1, 134, -1, 146, 34,
922
+ 167, 211, 60, 222, -1, 220, -1, 220, 147, -1,
923
+ 220, 147, 148, -1, 52, -1, 148, 149, -1, 149,
924
+ -1, 150, -1, 52, -1, 25, 224, 26, -1, 159,
925
+ 160, 161, 162, 163, 164, -1, 159, 28, 68, 158,
926
+ 134, -1, -1, 159, 152, 49, 151, 154, 157, 153,
927
+ -1, -1, 89, 116, -1, 116, -1, -1, -1, 135,
928
+ 155, 136, -1, 156, -1, 155, 137, 156, -1, 159,
929
+ 161, -1, 80, -1, 68, -1, 22, -1, 225, -1,
930
+ 23, -1, 22, -1, 225, -1, -1, 44, -1, -1,
931
+ -1, 40, 22, -1, 40, 225, -1, 40, 23, -1,
932
+ -1, 90, 92, -1, 134, -1, 165, -1, 166, -1,
933
+ 53, -1, 138, -1, 15, -1, -1, 167, 168, -1,
934
+ 145, 134, -1, 171, -1, 178, -1, 181, -1, 186,
935
+ -1, 187, -1, 188, -1, 191, -1, 193, -1, 195,
936
+ -1, 196, -1, 197, -1, 199, -1, 200, -1, 169,
937
+ -1, 170, -1, 172, -1, 201, -1, 202, -1, 203,
938
+ -1, 205, -1, 206, -1, 207, -1, 208, -1, 96,
939
+ -1, 36, -1, 56, -1, 24, -1, 72, 173, 55,
940
+ 174, 134, -1, -1, 48, -1, 119, -1, 174, 137,
941
+ 175, -1, 175, -1, 177, 166, 176, -1, -1, 24,
942
+ -1, 22, -1, 23, -1, 74, 218, 167, 179, 180,
943
+ 60, 74, 134, -1, -1, 179, 59, 218, 167, -1,
944
+ -1, 58, 167, -1, 37, 182, 183, 185, 60, 37,
945
+ 134, -1, -1, 183, 184, -1, 184, -1, 131, 218,
946
+ 167, -1, -1, 58, 167, -1, 221, 83, 198, -1,
947
+ 221, 132, 219, 198, -1, 221, 68, 189, 198, -1,
948
+ 190, 76, -1, 24, -1, 22, -1, 23, -1, 221,
949
+ 69, 190, 192, 76, 31, 219, 198, -1, -1, 117,
950
+ 11, -1, 194, 222, 223, -1, 65, -1, 47, -1,
951
+ 108, -1, 106, -1, 32, -1, 167, 60, 83, 222,
952
+ 134, -1, 75, -1, 78, -1, 84, -1, 22, -1,
953
+ 23, -1, 64, -1, 93, 210, -1, 66, 204, 210,
954
+ 79, -1, 87, 204, 210, 134, -1, -1, 39, 210,
955
+ 134, -1, 92, 134, -1, 43, 209, 134, -1, 111,
956
+ 209, 134, -1, 30, 38, -1, 30, 89, 38, -1,
957
+ -1, 24, -1, 22, -1, 23, -1, -1, -1, 63,
958
+ 212, 213, -1, 213, 214, -1, 214, -1, 131, 215,
959
+ 123, 167, -1, 215, 95, 216, -1, 216, -1, 224,
960
+ -1, -1, -1, -1, -1, 25, 224, 26, -1, -1,
961
+ 25, 224, 26, -1, -1, 224, -1, 134, -1, 131,
962
+ 217, -1, 22, -1, 225, -1, 24, -1, 27, -1,
963
+ 28, -1, 30, -1, 31, -1, 32, -1, 33, -1,
964
+ 36, -1, 38, -1, 39, -1, 40, -1, 41, -1,
965
+ 42, -1, 43, -1, 44, -1, 45, -1, 46, -1,
966
+ 47, -1, 48, -1, 49, -1, 50, -1, 51, -1,
967
+ 53, -1, 54, -1, 55, -1, 56, -1, 57, -1,
968
+ 59, -1, 61, -1, 62, -1, 63, -1, 65, -1,
969
+ 66, -1, 67, -1, 70, -1, 72, -1, 73, -1,
970
+ 75, -1, 77, -1, 78, -1, 80, -1, 81, -1,
971
+ 82, -1, 84, -1, 85, -1, 86, -1, 87, -1,
972
+ 88, -1, 89, -1, 91, -1, 93, -1, 94, -1,
973
+ 96, -1, 97, -1, 98, -1, 99, -1, 100, -1,
974
+ 101, -1, 102, -1, 103, -1, 104, -1, 105, -1,
975
+ 106, -1, 107, -1, 108, -1, 109, -1, 110, -1,
976
+ 111, -1, 112, -1, 113, -1, 114, -1, 115, -1,
977
+ 116, -1, 117, -1, 118, -1, 119, -1, 121, -1,
978
+ 122, -1, 125, -1, 126, -1, 127, -1, 129, -1,
979
+ 130, -1
985
980
  };
986
981
 
987
982
  /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
988
983
  static const yytype_uint16 yyrline[] =
989
984
  {
990
- 0, 364, 364, 370, 371, 374, 378, 387, 391, 395,
991
- 401, 405, 410, 411, 414, 437, 445, 452, 461, 473,
992
- 474, 477, 478, 482, 495, 533, 539, 538, 591, 594,
993
- 598, 605, 611, 614, 645, 649, 655, 663, 664, 666,
994
- 681, 696, 724, 752, 783, 784, 789, 800, 801, 806,
995
- 811, 818, 819, 823, 825, 831, 832, 840, 841, 845,
996
- 846, 856, 858, 860, 862, 864, 866, 868, 870, 872,
997
- 874, 876, 878, 880, 882, 884, 886, 888, 890, 892,
998
- 894, 896, 898, 900, 902, 904, 908, 922, 936, 953,
999
- 968, 1031, 1034, 1038, 1044, 1048, 1054, 1067, 1111, 1122,
1000
- 1127, 1135, 1140, 1157, 1175, 1178, 1192, 1195, 1201, 1208,
1001
- 1222, 1226, 1232, 1244, 1247, 1262, 1280, 1299, 1333, 1595,
1002
- 1621, 1635, 1642, 1681, 1684, 1690, 1743, 1747, 1753, 1779,
1003
- 1924, 1948, 1966, 1970, 1974, 1984, 1996, 2060, 2138, 2168,
1004
- 2181, 2186, 2200, 2207, 2221, 2236, 2237, 2238, 2241, 2254,
1005
- 2269, 2291, 2296, 2304, 2306, 2305, 2347, 2351, 2357, 2370,
1006
- 2379, 2385, 2422, 2426, 2430, 2434, 2438, 2442, 2450, 2454,
1007
- 2462, 2465, 2472, 2474, 2481, 2485, 2489, 2498, 2499, 2500,
1008
- 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510,
1009
- 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520,
1010
- 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530,
1011
- 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540,
1012
- 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550,
1013
- 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560,
1014
- 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570,
1015
- 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579
985
+ 0, 360, 360, 366, 367, 370, 374, 383, 387, 391,
986
+ 397, 401, 406, 407, 410, 433, 441, 448, 457, 469,
987
+ 470, 473, 474, 478, 491, 529, 535, 534, 561, 564,
988
+ 568, 575, 581, 584, 615, 619, 625, 633, 634, 636,
989
+ 651, 666, 694, 722, 753, 754, 759, 771, 772, 777,
990
+ 782, 789, 790, 794, 796, 802, 803, 811, 812, 816,
991
+ 817, 827, 829, 831, 833, 835, 837, 839, 841, 843,
992
+ 845, 847, 849, 851, 853, 855, 857, 859, 861, 863,
993
+ 865, 867, 869, 871, 873, 877, 913, 931, 952, 991,
994
+ 1055, 1058, 1062, 1068, 1072, 1078, 1091, 1138, 1156, 1161,
995
+ 1168, 1186, 1189, 1203, 1206, 1212, 1219, 1233, 1237, 1243,
996
+ 1255, 1258, 1273, 1291, 1310, 1344, 1602, 1628, 1642, 1649,
997
+ 1688, 1691, 1697, 1750, 1754, 1760, 1786, 1931, 1955, 1973,
998
+ 1977, 1981, 1985, 1996, 2009, 2073, 2151, 2181, 2194, 2199,
999
+ 2213, 2220, 2234, 2249, 2250, 2251, 2255, 2277, 2282, 2290,
1000
+ 2292, 2291, 2333, 2337, 2343, 2356, 2365, 2371, 2408, 2412,
1001
+ 2416, 2420, 2424, 2432, 2436, 2444, 2447, 2454, 2456, 2463,
1002
+ 2467, 2471, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487,
1003
+ 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497,
1004
+ 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507,
1005
+ 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517,
1006
+ 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527,
1007
+ 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537,
1008
+ 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547,
1009
+ 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557,
1010
+ 2558, 2559, 2560, 2561
1016
1011
  };
1017
1012
  #endif
1018
1013
 
@@ -1035,39 +1030,39 @@ static const char *const yytname[] =
1035
1030
  "K_EXCEPTION", "K_EXECUTE", "K_EXIT", "K_FETCH", "K_FIRST", "K_FOR",
1036
1031
  "K_FOREACH", "K_FORWARD", "K_FROM", "K_GET", "K_HINT", "K_IF",
1037
1032
  "K_IMPORT", "K_IN", "K_INFO", "K_INSERT", "K_INTO", "K_IS", "K_LAST",
1038
- "K_LOG", "K_LOOP", "K_MESSAGE", "K_MESSAGE_TEXT", "K_MOVE", "K_NEXT",
1039
- "K_NO", "K_NOT", "K_NOTICE", "K_NULL", "K_OPEN", "K_OPTION", "K_OR",
1040
- "K_PERFORM", "K_PG_CONTEXT", "K_PG_DATATYPE_NAME",
1033
+ "K_LOG", "K_LOOP", "K_MERGE", "K_MESSAGE", "K_MESSAGE_TEXT", "K_MOVE",
1034
+ "K_NEXT", "K_NO", "K_NOT", "K_NOTICE", "K_NULL", "K_OPEN", "K_OPTION",
1035
+ "K_OR", "K_PERFORM", "K_PG_CONTEXT", "K_PG_DATATYPE_NAME",
1041
1036
  "K_PG_EXCEPTION_CONTEXT", "K_PG_EXCEPTION_DETAIL", "K_PG_EXCEPTION_HINT",
1042
- "K_PRINT_STRICT_PARAMS", "K_PRIOR", "K_QUERY", "K_RAISE", "K_RELATIVE",
1043
- "K_RESET", "K_RETURN", "K_RETURNED_SQLSTATE", "K_REVERSE", "K_ROLLBACK",
1044
- "K_ROW_COUNT", "K_ROWTYPE", "K_SCHEMA", "K_SCHEMA_NAME", "K_SCROLL",
1045
- "K_SET", "K_SLICE", "K_SQLSTATE", "K_STACKED", "K_STRICT", "K_TABLE",
1037
+ "K_PG_ROUTINE_OID", "K_PRINT_STRICT_PARAMS", "K_PRIOR", "K_QUERY",
1038
+ "K_RAISE", "K_RELATIVE", "K_RETURN", "K_RETURNED_SQLSTATE", "K_REVERSE",
1039
+ "K_ROLLBACK", "K_ROW_COUNT", "K_ROWTYPE", "K_SCHEMA", "K_SCHEMA_NAME",
1040
+ "K_SCROLL", "K_SLICE", "K_SQLSTATE", "K_STACKED", "K_STRICT", "K_TABLE",
1046
1041
  "K_TABLE_NAME", "K_THEN", "K_TO", "K_TYPE", "K_USE_COLUMN",
1047
1042
  "K_USE_VARIABLE", "K_USING", "K_VARIABLE_CONFLICT", "K_WARNING",
1048
- "K_WHEN", "K_WHILE", "'#'", "';'", "'('", "')'", "','", "'='", "'['",
1049
- "$accept", "pl_function", "comp_options", "comp_option", "option_value",
1050
- "opt_semi", "pl_block", "decl_sect", "decl_start", "decl_stmts",
1051
- "decl_stmt", "decl_statement", "@1", "opt_scrollable",
1052
- "decl_cursor_query", "decl_cursor_args", "decl_cursor_arglist",
1053
- "decl_cursor_arg", "decl_is_for", "decl_aliasitem", "decl_varname",
1054
- "decl_const", "decl_datatype", "decl_collate", "decl_notnull",
1055
- "decl_defval", "decl_defkey", "assign_operator", "proc_sect",
1056
- "proc_stmt", "stmt_perform", "stmt_call", "stmt_assign", "stmt_getdiag",
1043
+ "K_WHEN", "K_WHILE", "'#'", "';'", "'('", "')'", "','", "'='", "$accept",
1044
+ "pl_function", "comp_options", "comp_option", "option_value", "opt_semi",
1045
+ "pl_block", "decl_sect", "decl_start", "decl_stmts", "decl_stmt",
1046
+ "decl_statement", "@1", "opt_scrollable", "decl_cursor_query",
1047
+ "decl_cursor_args", "decl_cursor_arglist", "decl_cursor_arg",
1048
+ "decl_is_for", "decl_aliasitem", "decl_varname", "decl_const",
1049
+ "decl_datatype", "decl_collate", "decl_notnull", "decl_defval",
1050
+ "decl_defkey", "assign_operator", "proc_sect", "proc_stmt",
1051
+ "stmt_perform", "stmt_call", "stmt_assign", "stmt_getdiag",
1057
1052
  "getdiag_area_opt", "getdiag_list", "getdiag_list_item", "getdiag_item",
1058
- "getdiag_target", "assign_var", "stmt_if", "stmt_elsifs", "stmt_else",
1059
- "stmt_case", "opt_expr_until_when", "case_when_list", "case_when",
1060
- "opt_case_else", "stmt_loop", "stmt_while", "stmt_for", "for_control",
1061
- "for_variable", "stmt_foreach_a", "foreach_slice", "stmt_exit",
1062
- "exit_type", "stmt_return", "stmt_raise", "stmt_assert", "loop_body",
1063
- "stmt_execsql", "stmt_dynexecute", "stmt_open", "stmt_fetch",
1064
- "stmt_move", "opt_fetch_direction", "stmt_close", "stmt_null",
1065
- "stmt_commit", "stmt_rollback", "opt_transaction_chain", "stmt_set",
1066
- "cursor_variable", "exception_sect", "@2", "proc_exceptions",
1067
- "proc_exception", "proc_conditions", "proc_condition", "expr_until_semi",
1068
- "expr_until_rightbracket", "expr_until_then", "expr_until_loop",
1069
- "opt_block_label", "opt_loop_label", "opt_label", "opt_exitcond",
1070
- "any_identifier", "unreserved_keyword", 0
1053
+ "getdiag_target", "stmt_if", "stmt_elsifs", "stmt_else", "stmt_case",
1054
+ "opt_expr_until_when", "case_when_list", "case_when", "opt_case_else",
1055
+ "stmt_loop", "stmt_while", "stmt_for", "for_control", "for_variable",
1056
+ "stmt_foreach_a", "foreach_slice", "stmt_exit", "exit_type",
1057
+ "stmt_return", "stmt_raise", "stmt_assert", "loop_body", "stmt_execsql",
1058
+ "stmt_dynexecute", "stmt_open", "stmt_fetch", "stmt_move",
1059
+ "opt_fetch_direction", "stmt_close", "stmt_null", "stmt_commit",
1060
+ "stmt_rollback", "opt_transaction_chain", "cursor_variable",
1061
+ "exception_sect", "@2", "proc_exceptions", "proc_exception",
1062
+ "proc_conditions", "proc_condition", "expr_until_semi",
1063
+ "expr_until_then", "expr_until_loop", "opt_block_label",
1064
+ "opt_loop_label", "opt_label", "opt_exitcond", "any_identifier",
1065
+ "unreserved_keyword", 0
1071
1066
  };
1072
1067
  #endif
1073
1068
 
@@ -1089,39 +1084,39 @@ static const yytype_uint16 yytoknum[] =
1089
1084
  355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1090
1085
  365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1091
1086
  375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1092
- 385, 386, 387, 35, 59, 40, 41, 44, 61, 91
1087
+ 385, 386, 387, 35, 59, 40, 41, 44, 61
1093
1088
  };
1094
1089
  # endif
1095
1090
 
1096
1091
  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1097
1092
  static const yytype_uint8 yyr1[] =
1098
1093
  {
1099
- 0, 140, 141, 142, 142, 143, 143, 143, 143, 143,
1100
- 144, 144, 145, 145, 146, 147, 147, 147, 148, 149,
1101
- 149, 150, 150, 150, 151, 151, 152, 151, 153, 153,
1102
- 153, 154, 155, 155, 156, 156, 157, 158, 158, 159,
1103
- 159, 159, 160, 160, 161, 161, 162, 163, 163, 163,
1104
- 163, 164, 164, 165, 165, 166, 166, 167, 167, 168,
1105
- 168, 169, 169, 169, 169, 169, 169, 169, 169, 169,
1106
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
1107
- 169, 169, 169, 169, 169, 169, 170, 171, 171, 172,
1108
- 173, 174, 174, 174, 175, 175, 176, 177, 178, 178,
1109
- 178, 179, 179, 180, 181, 181, 182, 182, 183, 184,
1110
- 185, 185, 186, 187, 187, 188, 189, 190, 191, 192,
1111
- 192, 192, 193, 194, 194, 195, 196, 196, 197, 198,
1112
- 199, 200, 201, 201, 201, 201, 202, 203, 204, 205,
1113
- 206, 207, 208, 209, 210, 211, 211, 211, 212, 212,
1114
- 213, 213, 213, 214, 215, 214, 216, 216, 217, 218,
1115
- 218, 219, 220, 221, 222, 223, 224, 224, 225, 225,
1116
- 226, 226, 227, 227, 228, 228, 228, 229, 229, 229,
1117
- 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1118
- 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1119
- 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1120
- 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1121
- 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1122
- 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1123
- 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1124
- 229, 229, 229, 229, 229, 229, 229, 229, 229
1094
+ 0, 139, 140, 141, 141, 142, 142, 142, 142, 142,
1095
+ 143, 143, 144, 144, 145, 146, 146, 146, 147, 148,
1096
+ 148, 149, 149, 149, 150, 150, 151, 150, 152, 152,
1097
+ 152, 153, 154, 154, 155, 155, 156, 157, 157, 158,
1098
+ 158, 158, 159, 159, 160, 160, 161, 162, 162, 162,
1099
+ 162, 163, 163, 164, 164, 165, 165, 166, 166, 167,
1100
+ 167, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1101
+ 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1102
+ 168, 168, 168, 168, 168, 169, 170, 170, 171, 172,
1103
+ 173, 173, 173, 174, 174, 175, 176, 177, 177, 177,
1104
+ 178, 179, 179, 180, 180, 181, 182, 183, 183, 184,
1105
+ 185, 185, 186, 187, 188, 189, 190, 190, 190, 191,
1106
+ 192, 192, 193, 194, 194, 195, 196, 197, 198, 199,
1107
+ 199, 199, 199, 199, 200, 201, 202, 203, 204, 205,
1108
+ 206, 207, 208, 209, 209, 209, 210, 210, 210, 211,
1109
+ 212, 211, 213, 213, 214, 215, 215, 216, 217, 218,
1110
+ 219, 220, 220, 221, 221, 222, 222, 223, 223, 224,
1111
+ 224, 224, 225, 225, 225, 225, 225, 225, 225, 225,
1112
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1113
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1114
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1115
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1116
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1117
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1118
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1119
+ 225, 225, 225, 225
1125
1120
  };
1126
1121
 
1127
1122
  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -1135,16 +1130,15 @@ static const yytype_uint8 yyr2[] =
1135
1130
  2, 0, 2, 1, 1, 1, 1, 1, 1, 0,
1136
1131
  2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1137
1132
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1138
- 1, 1, 1, 1, 1, 1, 2, 1, 1, 3,
1139
- 5, 0, 1, 1, 3, 1, 3, 0, 1, 1,
1140
- 1, 1, 3, 8, 0, 4, 0, 2, 7, 0,
1141
- 2, 1, 3, 0, 2, 3, 4, 4, 2, 1,
1142
- 1, 1, 8, 0, 2, 3, 1, 1, 1, 1,
1143
- 1, 5, 1, 1, 1, 1, 1, 2, 4, 4,
1144
- 0, 3, 2, 3, 3, 2, 3, 0, 1, 1,
1145
- 1, 1, 1, 0, 0, 3, 2, 1, 4, 3,
1146
- 1, 1, 0, 0, 0, 0, 0, 3, 0, 3,
1147
- 0, 1, 1, 2, 1, 1, 1, 1, 1, 1,
1133
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
1134
+ 0, 1, 1, 3, 1, 3, 0, 1, 1, 1,
1135
+ 8, 0, 4, 0, 2, 7, 0, 2, 1, 3,
1136
+ 0, 2, 3, 4, 4, 2, 1, 1, 1, 8,
1137
+ 0, 2, 3, 1, 1, 1, 1, 1, 5, 1,
1138
+ 1, 1, 1, 1, 1, 2, 4, 4, 0, 3,
1139
+ 2, 3, 3, 2, 3, 0, 1, 1, 1, 0,
1140
+ 0, 3, 2, 1, 4, 3, 1, 1, 0, 0,
1141
+ 0, 0, 3, 0, 3, 0, 1, 1, 2, 1,
1148
1142
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1149
1143
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1150
1144
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -1152,164 +1146,162 @@ static const yytype_uint8 yyr2[] =
1152
1146
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1153
1147
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1154
1148
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1155
- 1, 1, 1, 1, 1, 1, 1, 1, 1
1149
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1150
+ 1, 1, 1, 1
1156
1151
  };
1157
1152
 
1158
1153
  /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1159
1154
  STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1160
1155
  means the default is an error. */
1161
- static const yytype_uint16 yydefact[] =
1156
+ static const yytype_uint8 yydefact[] =
1162
1157
  {
1163
- 3, 0, 166, 1, 0, 0, 4, 12, 0, 15,
1164
- 174, 176, 177, 178, 179, 180, 181, 182, 183, 184,
1165
- 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
1166
- 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
1167
- 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
1168
- 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
1169
- 225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
1170
- 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
1171
- 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
1172
- 255, 256, 257, 258, 0, 175, 0, 0, 0, 13,
1173
- 2, 59, 18, 16, 167, 5, 10, 6, 11, 7,
1174
- 9, 8, 168, 42, 0, 22, 17, 20, 21, 44,
1175
- 43, 134, 135, 101, 0, 130, 87, 109, 0, 147,
1176
- 127, 88, 154, 136, 126, 140, 91, 164, 132, 133,
1177
- 140, 0, 0, 162, 129, 149, 128, 147, 148, 0,
1178
- 60, 75, 76, 62, 77, 0, 63, 64, 65, 66,
1179
- 67, 68, 69, 170, 70, 71, 72, 73, 74, 78,
1180
- 79, 80, 81, 82, 83, 84, 85, 0, 0, 0,
1181
- 19, 0, 45, 0, 30, 0, 46, 0, 0, 151,
1182
- 152, 150, 0, 0, 0, 0, 0, 92, 93, 0,
1183
- 59, 0, 142, 137, 86, 0, 61, 58, 57, 163,
1184
- 162, 0, 171, 170, 0, 0, 59, 165, 23, 0,
1185
- 29, 26, 47, 169, 164, 113, 111, 141, 145, 0,
1186
- 143, 0, 155, 157, 0, 0, 168, 0, 144, 102,
1187
- 89, 162, 172, 125, 14, 120, 121, 119, 59, 0,
1188
- 123, 168, 115, 59, 39, 41, 0, 40, 32, 0,
1189
- 51, 59, 59, 110, 0, 146, 0, 160, 161, 156,
1190
- 138, 99, 100, 0, 95, 0, 98, 106, 139, 173,
1191
- 117, 118, 0, 0, 0, 116, 25, 0, 0, 48,
1192
- 50, 49, 0, 0, 168, 168, 0, 0, 59, 90,
1193
- 0, 97, 59, 164, 0, 124, 0, 170, 0, 34,
1194
- 46, 38, 37, 31, 52, 56, 53, 24, 54, 55,
1195
- 0, 159, 168, 94, 96, 168, 59, 0, 165, 0,
1196
- 33, 0, 36, 27, 108, 168, 0, 59, 131, 35,
1197
- 103, 122
1158
+ 3, 0, 161, 1, 0, 0, 4, 12, 0, 15,
1159
+ 169, 171, 172, 173, 174, 175, 176, 177, 178, 179,
1160
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
1161
+ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
1162
+ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
1163
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
1164
+ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
1165
+ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
1166
+ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
1167
+ 250, 251, 252, 253, 0, 170, 0, 0, 0, 13,
1168
+ 2, 59, 18, 16, 162, 5, 10, 6, 11, 7,
1169
+ 9, 8, 163, 42, 0, 22, 17, 20, 21, 44,
1170
+ 43, 132, 133, 88, 0, 127, 86, 106, 0, 145,
1171
+ 124, 87, 150, 134, 123, 138, 90, 159, 129, 130,
1172
+ 131, 138, 0, 0, 85, 126, 125, 145, 0, 60,
1173
+ 75, 76, 62, 77, 63, 64, 65, 66, 67, 68,
1174
+ 69, 165, 70, 71, 72, 73, 74, 78, 79, 80,
1175
+ 81, 82, 83, 84, 0, 0, 0, 19, 0, 45,
1176
+ 0, 30, 0, 46, 0, 0, 147, 148, 146, 0,
1177
+ 0, 0, 0, 0, 91, 92, 0, 59, 0, 140,
1178
+ 135, 0, 61, 0, 166, 165, 0, 0, 59, 160,
1179
+ 23, 0, 29, 26, 47, 164, 159, 110, 108, 139,
1180
+ 143, 0, 141, 0, 151, 153, 0, 0, 163, 0,
1181
+ 142, 158, 167, 122, 14, 117, 118, 116, 59, 0,
1182
+ 120, 163, 112, 59, 39, 41, 0, 40, 32, 0,
1183
+ 51, 59, 59, 107, 0, 144, 0, 156, 157, 152,
1184
+ 136, 98, 99, 97, 0, 94, 0, 103, 137, 168,
1185
+ 114, 115, 0, 0, 0, 113, 25, 0, 0, 48,
1186
+ 50, 49, 0, 0, 163, 163, 0, 0, 59, 89,
1187
+ 0, 58, 57, 96, 59, 159, 0, 121, 0, 165,
1188
+ 0, 34, 46, 38, 37, 31, 52, 56, 53, 24,
1189
+ 54, 55, 0, 155, 163, 93, 95, 163, 59, 0,
1190
+ 160, 0, 33, 0, 36, 27, 105, 163, 0, 59,
1191
+ 128, 35, 100, 119
1198
1192
  };
1199
1193
 
1200
1194
  /* YYDEFGOTO[NTERM-NUM]. */
1201
1195
  static const yytype_int16 yydefgoto[] =
1202
1196
  {
1203
- -1, 1, 2, 6, 107, 100, 149, 8, 103, 116,
1204
- 117, 118, 258, 185, 333, 288, 308, 309, 313, 256,
1205
- 119, 186, 222, 260, 293, 317, 318, 210, 251, 150,
1206
- 151, 152, 153, 154, 199, 273, 274, 324, 275, 155,
1207
- 156, 277, 304, 157, 188, 225, 226, 264, 158, 159,
1208
- 160, 248, 249, 161, 283, 162, 163, 164, 165, 166,
1209
- 252, 167, 168, 169, 170, 171, 196, 172, 173, 174,
1210
- 175, 194, 176, 192, 177, 195, 232, 233, 266, 267,
1211
- 204, 239, 200, 253, 9, 178, 211, 243, 212, 95
1197
+ -1, 1, 2, 6, 107, 100, 148, 8, 103, 116,
1198
+ 117, 118, 248, 182, 325, 278, 300, 301, 305, 246,
1199
+ 119, 183, 214, 250, 283, 309, 310, 293, 241, 149,
1200
+ 150, 151, 152, 153, 196, 264, 265, 316, 266, 154,
1201
+ 267, 296, 155, 185, 217, 218, 254, 156, 157, 158,
1202
+ 238, 239, 159, 273, 160, 161, 162, 163, 164, 242,
1203
+ 165, 166, 167, 168, 169, 193, 170, 171, 172, 173,
1204
+ 191, 189, 174, 192, 224, 225, 256, 257, 269, 197,
1205
+ 243, 9, 175, 203, 233, 204, 95
1212
1206
  };
1213
1207
 
1214
1208
  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1215
1209
  STATE-NUM. */
1216
- #define YYPACT_NINF -272
1210
+ #define YYPACT_NINF -260
1217
1211
  static const yytype_int16 yypact[] =
1218
1212
  {
1219
- -272, 34, -17, -272, 365, -71, -272, -92, 15, 20,
1220
- -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,
1221
- -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,
1222
- -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,
1223
- -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,
1224
- -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,
1225
- -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,
1226
- -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,
1227
- -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,
1228
- -272, -272, -272, -272, 48, -272, 25, 689, -49, -272,
1229
- -272, -272, -272, 256, -272, -272, -272, -272, -272, -272,
1230
- -272, -272, 1082, -272, 365, -272, 256, -272, -272, 3,
1231
- -272, -272, -272, -272, 365, -272, -272, -272, 40, 55,
1232
- -272, -272, -272, -272, -272, -272, -36, -272, -272, -272,
1233
- -272, -48, 40, -272, -272, -272, -272, 55, -272, -46,
1234
- -272, -272, -272, -272, -272, -13, -272, -272, -272, -272,
1235
- -272, -272, -272, 365, -272, -272, -272, -272, -272, -272,
1236
- -272, -272, -272, -272, -272, -272, -272, 42, -51, 68,
1237
- -272, 36, -272, -6, -272, 57, -272, 89, -12, -272,
1238
- -272, -272, -1, -19, 0, 4, 40, -272, -272, 72,
1239
- -272, 40, -272, -272, -272, 2, -272, -272, -272, -272,
1240
- -272, -80, -272, 365, 77, 77, -272, -272, -272, 474,
1241
- -272, -272, 91, -7, -272, -47, -272, -272, -272, 92,
1242
- -272, 365, 4, -272, 58, 90, 904, 5, -272, -272,
1243
- -272, -272, -272, -272, -272, -272, -272, -272, -272, 62,
1244
- 23, 1171, -272, -272, -272, -272, 7, -272, 8, 583,
1245
- 53, -272, -272, -272, 84, -272, -73, -272, -272, -272,
1246
- -272, -272, -272, -66, -272, -9, 6, -3, -272, -272,
1247
- -272, -272, 135, 71, 65, -272, -272, 795, -39, -272,
1248
- -272, -272, 59, -10, 1, 1260, 112, 365, -272, -272,
1249
- 90, -272, -272, -272, 93, -272, 120, 365, -15, -272,
1250
- -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,
1251
- 18, -272, 146, -272, -272, 1349, -272, 80, -272, 21,
1252
- -272, 795, -272, -272, -272, 993, 22, -272, -272, -272,
1253
- -272, -272
1213
+ -260, 21, -20, -260, 355, -61, -260, -99, 3, 7,
1214
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1215
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1216
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1217
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1218
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1219
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1220
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1221
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1222
+ -260, -260, -260, -260, 22, -260, 23, 679, -38, -260,
1223
+ -260, -260, -260, 246, -260, -260, -260, -260, -260, -260,
1224
+ -260, -260, 1026, -260, 355, -260, 246, -260, -260, -18,
1225
+ -260, -260, -260, -260, 355, -260, -260, -260, 30, 49,
1226
+ -260, -260, -260, -260, -260, -260, -37, -260, -260, -260,
1227
+ -260, -260, -48, 30, -260, -260, -260, 49, -33, -260,
1228
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1229
+ -260, 355, -260, -260, -260, -260, -260, -260, -260, -260,
1230
+ -260, -260, -260, -260, 36, -23, 78, -260, 37, -260,
1231
+ -10, -260, 58, -260, 85, -17, -260, -260, -260, -22,
1232
+ -19, -16, -15, 30, -260, -260, 62, -260, 30, -260,
1233
+ -260, -11, -260, -95, -260, 355, 68, 68, -260, -260,
1234
+ -260, 464, -260, -260, 79, -2, -260, -50, -260, -260,
1235
+ -260, 86, -260, 355, -15, -260, 48, 71, 894, -6,
1236
+ -260, -260, -260, -260, -260, -260, -260, -260, -260, 53,
1237
+ 13, 1092, -260, -260, -260, -260, -3, -260, -1, 573,
1238
+ 42, -260, -260, -260, 73, -260, -51, -260, -260, -260,
1239
+ -260, -260, -260, -260, -76, -260, -12, 15, -260, -260,
1240
+ -260, -260, 125, 59, 54, -260, -260, 785, -39, -260,
1241
+ -260, -260, 46, -13, -9, 1158, 102, 355, -260, -260,
1242
+ 71, -260, -260, -260, -260, -260, 80, -260, 110, 355,
1243
+ -60, -260, -260, -260, -260, -260, -260, -260, -260, -260,
1244
+ -260, -260, 8, -260, 124, -260, -260, 1224, -260, 69,
1245
+ -260, 10, -260, 785, -260, -260, -260, 960, 11, -260,
1246
+ -260, -260, -260, -260
1254
1247
  };
1255
1248
 
1256
1249
  /* YYPGOTO[NTERM-NUM]. */
1257
1250
  static const yytype_int16 yypgoto[] =
1258
1251
  {
1259
- -272, -272, -272, -272, -272, -272, 155, -272, -272, -272,
1260
- 43, -272, -272, -272, -272, -272, -272, -173, -272, -272,
1261
- -271, -272, -150, -272, -272, -272, -272, -247, -97, -272,
1262
- -272, -272, -272, -272, -272, -272, -139, -272, -272, -220,
1263
- -272, -272, -272, -272, -272, -272, -63, -272, -272, -272,
1264
- -272, -272, -43, -272, -272, -272, -272, -272, -272, -272,
1265
- -239, -272, -272, -272, -272, -272, 26, -272, -272, -272,
1266
- -272, 27, -272, -106, -272, -272, -272, -65, -272, -124,
1267
- -171, -272, -214, -153, -272, -272, -210, -272, -4, -96
1252
+ -260, -260, -260, -260, -260, -260, 148, -260, -260, -260,
1253
+ 35, -260, -260, -260, -260, -260, -260, -171, -260, -260,
1254
+ -259, -260, -145, -260, -260, -260, -260, -124, -97, -260,
1255
+ -260, -260, -260, -260, -260, -260, -128, -260, -260, -260,
1256
+ -260, -260, -260, -260, -260, -53, -260, -260, -260, -260,
1257
+ -260, -42, -260, -260, -260, -260, -260, -260, -260, -221,
1258
+ -260, -260, -260, -260, -260, 25, -260, -260, -260, -260,
1259
+ 26, -131, -260, -260, -260, -56, -260, -118, -260, -210,
1260
+ -150, -260, -260, -196, -260, -4, -96
1268
1261
  };
1269
1262
 
1270
1263
  /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1271
1264
  positive, shift that token. If negative, reduce the rule which
1272
1265
  number is the opposite. If zero, do what YYDEFACT says.
1273
1266
  If YYTABLE_NINF, syntax error. */
1274
- #define YYTABLE_NINF -168
1267
+ #define YYTABLE_NINF -163
1275
1268
  static const yytype_int16 yytable[] =
1276
1269
  {
1277
- 94, 108, 207, 244, 112, 207, 207, 120, 4, 280,
1278
- 261, 262, 197, 109, 285, 276, 310, 214, 215, 228,
1279
- 120, 297, 96, 121, 122, 123, 124, -167, 301, 311,
1280
- 97, 181, 216, 125, 3, -166, 203, 126, 127, 240,
1281
- 128, 312, 99, 315, 129, -167, 319, 182, 130, 101,
1282
- 298, 241, -28, -166, 242, 302, 303, 131, 98, -112,
1283
- 310, -112, 189, 190, 191, 133, 134, 135, 299, 229,
1284
- 279, 300, 102, 136, 104, 137, 138, 110, 111, 139,
1285
- 276, 217, 105, 198, 224, 193, 202, 140, 206, 326,
1286
- 234, 183, 141, 142, 218, 237, 143, 329, 341, 245,
1287
- 246, 247, 213, 236, 219, 144, 221, 145, 146, 220,
1288
- 179, 147, 271, 272, 123, 223, 5, 148, 184, 224,
1289
- 187, 330, 331, 257, 316, 208, 209, 235, 208, 208,
1290
- 265, 259, -112, 227, 230, 231, 238, 270, 281, 278,
1291
- 282, 286, 292, 287, 296, 209, 305, 306, 307, 320,
1292
- 314, 328, 334, 327, 336, 338, 340, 7, 339, 180,
1293
- 332, 323, 263, 291, 294, 295, 201, 269, 121, 122,
1294
- 123, 124, 250, 321, 205, 337, 0, 0, 125, 0,
1295
- -166, 0, 126, 127, 0, 128, 0, 0, 0, 129,
1296
- 0, 120, 0, 130, 0, 0, 0, 0, -166, 0,
1297
- 0, 322, 131, 0, 0, 325, -158, 0, 0, 0,
1298
- 133, 134, 135, 0, 0, 0, 0, 0, 136, 0,
1299
- 137, 138, 0, 0, 139, 0, 0, 268, 0, 335,
1300
- 0, 0, 140, 0, 0, 120, 0, 141, 142, 0,
1301
- 0, 143, 0, 0, 0, 0, 0, 0, 0, 0,
1302
- 144, 0, 145, 146, 0, 0, 147, 0, 0, 0,
1303
- 0, 0, 148, 0, 0, 0, 0, 0, 0, 0,
1304
- 0, 0, 0, 0, 0, 0, 0, -158, 113, 0,
1270
+ 94, 108, 291, 291, 112, 4, 251, 120, 252, 234,
1271
+ 178, 194, 200, 121, 122, 123, 124, 270, 302, 220,
1272
+ 120, 3, 275, 125, 109, -161, 179, 126, 127, 303,
1273
+ 128, -28, -162, 96, 129, 99, 231, 101, 130, 232,
1274
+ 307, 304, 97, -161, 287, 206, 207, 131, 104, -109,
1275
+ -162, -109, 186, 187, 188, 133, 134, 135, 289, 102,
1276
+ 208, 290, 226, 136, 302, 137, 138, 229, 98, 139,
1277
+ 221, 180, 288, 294, 295, 140, 322, 323, 141, 190,
1278
+ 105, 216, 195, 142, 143, 318, 199, 144, 110, 111,
1279
+ 235, 236, 237, 261, 262, 263, 205, 145, 181, 146,
1280
+ 228, 202, 147, 321, 210, 211, 212, 213, 333, 209,
1281
+ 176, 215, 219, 5, 216, 247, 223, 227, 222, 249,
1282
+ 184, 308, -109, 230, 255, 292, 292, 260, 268, 271,
1283
+ 272, 276, 282, 286, 277, 298, 297, 299, 306, 312,
1284
+ 319, 320, 326, 328, 330, 332, 121, 122, 123, 124,
1285
+ 7, 177, 331, 281, 284, 285, 125, 324, -161, 311,
1286
+ 126, 127, 315, 128, 253, 240, 198, 129, 259, 313,
1287
+ 329, 130, 0, 201, 0, 0, -161, 0, 0, 0,
1288
+ 131, 120, 0, 0, -154, 0, 0, 0, 133, 134,
1289
+ 135, 314, 0, 0, 0, 0, 136, 317, 137, 138,
1290
+ 0, 0, 139, 0, 0, 0, 0, 0, 140, 0,
1291
+ 0, 141, 0, 0, 0, 0, 142, 143, 0, 258,
1292
+ 144, 327, 0, 0, 0, 0, 0, 120, 0, 0,
1293
+ 145, 0, 146, 0, 0, 147, 0, 0, 0, 0,
1294
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1295
+ 0, 0, 0, 0, 0, -154, 0, 0, 0, 0,
1296
+ 0, 0, 0, 0, 0, 0, 0, 0, 113, 0,
1305
1297
  0, 114, 0, 12, 13, 0, 14, 15, 16, 17,
1306
- 0, 0, 18, 268, 19, 20, 21, 22, 23, 24,
1298
+ 0, 0, 18, 258, 19, 20, 21, 22, 23, 24,
1307
1299
  25, 26, 27, 28, 29, 30, 31, 32, 115, 33,
1308
1300
  34, 35, 36, 37, 0, 38, 0, 39, 40, 41,
1309
1301
  0, 42, 43, 44, 0, 0, 45, 0, 46, 47,
1310
1302
  0, 48, 0, 49, 50, 0, 51, 52, 53, 0,
1311
- 54, 55, 56, 57, 58, 0, 59, 0, 60, 61,
1312
- 0, 62, 63, 64, 65, 66, 67, 68, 69, 70,
1303
+ 54, 55, 56, 57, 58, 59, 0, 60, 0, 61,
1304
+ 62, 0, 63, 64, 65, 66, 67, 68, 69, 70,
1313
1305
  71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
1314
1306
  81, 82, 83, 84, 85, 86, 0, 87, 88, 0,
1315
1307
  0, 89, 90, 91, 0, 92, 93, 10, 0, 11,
@@ -1319,29 +1311,29 @@ static const yytype_int16 yytable[] =
1319
1311
  35, 36, 37, 0, 38, 0, 39, 40, 41, 0,
1320
1312
  42, 43, 44, 0, 0, 45, 0, 46, 47, 0,
1321
1313
  48, 0, 49, 50, 0, 51, 52, 53, 0, 54,
1322
- 55, 56, 57, 58, 0, 59, 0, 60, 61, 0,
1323
- 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1314
+ 55, 56, 57, 58, 59, 0, 60, 0, 61, 62,
1315
+ 0, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1324
1316
  72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1325
1317
  82, 83, 84, 85, 86, 0, 87, 88, 0, 0,
1326
- 89, 90, 91, 0, 92, 93, 254, 255, 0, 0,
1318
+ 89, 90, 91, 0, 92, 93, 244, 245, 0, 0,
1327
1319
  0, 12, 13, 0, 14, 15, 16, 17, 0, 0,
1328
1320
  18, 0, 19, 20, 21, 22, 23, 24, 25, 26,
1329
1321
  27, 28, 29, 30, 31, 32, 0, 33, 34, 35,
1330
1322
  36, 37, 0, 38, 0, 39, 40, 41, 0, 42,
1331
1323
  43, 44, 0, 0, 45, 0, 46, 47, 0, 48,
1332
1324
  0, 49, 50, 0, 51, 52, 53, 0, 54, 55,
1333
- 56, 57, 58, 0, 59, 0, 60, 61, 0, 62,
1325
+ 56, 57, 58, 59, 0, 60, 0, 61, 62, 0,
1334
1326
  63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1335
1327
  73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
1336
1328
  83, 84, 85, 86, 0, 87, 88, 0, 0, 89,
1337
- 90, 91, 0, 92, 93, 289, 290, 0, 0, 0,
1329
+ 90, 91, 0, 92, 93, 279, 280, 0, 0, 0,
1338
1330
  12, 13, 0, 14, 15, 16, 17, 0, 0, 18,
1339
1331
  0, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1340
1332
  28, 29, 30, 31, 32, 0, 33, 34, 35, 36,
1341
1333
  37, 0, 38, 0, 39, 40, 41, 0, 42, 43,
1342
1334
  44, 0, 0, 45, 0, 46, 47, 0, 48, 0,
1343
1335
  49, 50, 0, 51, 52, 53, 0, 54, 55, 56,
1344
- 57, 58, 0, 59, 0, 60, 61, 0, 62, 63,
1336
+ 57, 58, 59, 0, 60, 0, 61, 62, 0, 63,
1345
1337
  64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
1346
1338
  74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
1347
1339
  84, 85, 86, 0, 87, 88, 0, 0, 89, 90,
@@ -1351,8 +1343,8 @@ static const yytype_int16 yytable[] =
1351
1343
  32, 0, 33, 34, 35, 36, 37, 0, 38, 0,
1352
1344
  39, 40, 41, 0, 42, 43, 44, 0, 0, 45,
1353
1345
  0, 46, 47, 0, 48, 0, 49, 50, 0, 51,
1354
- 52, 53, 0, 54, 55, 56, 57, 58, 0, 59,
1355
- 0, 60, 61, 0, 62, 63, 64, 65, 66, 67,
1346
+ 52, 53, 0, 54, 55, 56, 57, 58, 59, 0,
1347
+ 60, 0, 61, 62, 0, 63, 64, 65, 66, 67,
1356
1348
  68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
1357
1349
  78, 79, 80, 81, 82, 83, 84, 85, 86, 0,
1358
1350
  87, 88, 0, 0, 89, 90, 91, 113, 92, 93,
@@ -1362,105 +1354,92 @@ static const yytype_int16 yytable[] =
1362
1354
  35, 36, 37, 0, 38, 0, 39, 40, 41, 0,
1363
1355
  42, 43, 44, 0, 0, 45, 0, 46, 47, 0,
1364
1356
  48, 0, 49, 50, 0, 51, 52, 53, 0, 54,
1365
- 55, 56, 57, 58, 0, 59, 0, 60, 61, 0,
1366
- 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1357
+ 55, 56, 57, 58, 59, 0, 60, 0, 61, 62,
1358
+ 0, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1367
1359
  72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1368
1360
  82, 83, 84, 85, 86, 0, 87, 88, 0, 0,
1369
1361
  89, 90, 91, 0, 92, 93, 121, 122, 123, 124,
1370
- 0, 0, 0, 0, 0, 0, 125, 0, -166, 0,
1362
+ 0, 0, 0, 0, 0, 0, 125, 0, -161, 0,
1371
1363
  126, 127, 0, 128, 0, 0, 0, 129, 0, 0,
1372
- 0, 130, 0, 0, 0, 0, -166, 0, 0, 0,
1373
- 131, 0, -104, -104, -104, 0, 0, 0, 133, 134,
1364
+ 0, 130, 0, 0, 0, 0, -161, 0, 0, 0,
1365
+ 131, 0, -101, -101, -101, 0, 0, 0, 133, 134,
1374
1366
  135, 0, 0, 0, 0, 0, 136, 0, 137, 138,
1375
- 0, 0, 139, 0, 0, 0, 0, 0, 0, 0,
1376
- 140, 0, 0, 0, 0, 141, 142, 0, 0, 143,
1377
- 0, 0, 0, 0, 0, 0, 0, 0, 144, 0,
1378
- 145, 146, 0, 0, 147, 121, 122, 123, 124, 0,
1379
- 148, 0, 0, 0, 0, 125, 0, -166, 0, 126,
1380
- 127, 0, 128, 0, 0, 0, 129, 0, 0, 0,
1381
- 130, 0, 0, 0, 0, -166, 0, 0, 0, 131,
1382
- 0, -105, -105, -105, 0, 0, 0, 133, 134, 135,
1383
- 0, 0, 0, 0, 0, 136, 0, 137, 138, 0,
1384
- 0, 139, 0, 0, 0, 0, 0, 0, 0, 140,
1385
- 0, 0, 0, 0, 141, 142, 0, 0, 143, 0,
1386
- 0, 0, 0, 0, 0, 0, 0, 144, 0, 145,
1387
- 146, 0, 0, 147, 121, 122, 123, 124, 0, 148,
1388
- 0, 0, 0, 0, 125, 0, -166, 0, 126, 127,
1389
- 0, 128, 0, 0, 0, 129, 0, 0, 0, 130,
1390
- 0, 0, 0, 0, -166, 0, 0, 0, 131, 0,
1391
- 0, 0, -153, 0, 0, 132, 133, 134, 135, 0,
1392
- 0, 0, 0, 0, 136, 0, 137, 138, 0, 0,
1393
- 139, 0, 0, 0, 0, 0, 0, 0, 140, 0,
1394
- 0, 0, 0, 141, 142, 0, 0, 143, 0, 0,
1395
- 0, 0, 0, 0, 0, 0, 144, 0, 145, 146,
1396
- 0, 0, 147, 121, 122, 123, 124, 0, 148, 0,
1397
- 0, 0, 0, 125, 0, -166, 0, 126, 127, 0,
1398
- 128, 0, 0, 0, 129, 0, 0, 0, 130, 0,
1399
- 0, 0, 0, -166, 0, 0, 0, 131, 0, 0,
1400
- 0, 284, 0, 0, 0, 133, 134, 135, 0, 0,
1401
- 0, 0, 0, 136, 0, 137, 138, 0, 0, 139,
1402
- 0, 0, 0, 0, 0, 0, 0, 140, 0, 0,
1403
- 0, 0, 141, 142, 0, 0, 143, 0, 0, 0,
1404
- 0, 0, 0, 0, 0, 144, 0, 145, 146, 0,
1405
- 0, 147, 121, 122, 123, 124, 0, 148, 0, 0,
1406
- 0, 0, 125, 0, -166, 0, 126, 127, 0, 128,
1407
- 0, 0, 0, 129, 0, 0, 0, 130, 0, 0,
1408
- 0, 0, -166, 0, 0, 0, 131, 0, 0, 0,
1409
- -114, 0, 0, 0, 133, 134, 135, 0, 0, 0,
1367
+ 0, 0, 139, 0, 0, 0, 0, 0, 140, 0,
1368
+ 0, 141, 121, 122, 123, 124, 142, 143, 0, 0,
1369
+ 144, 0, 125, 0, -161, 0, 126, 127, 0, 128,
1370
+ 145, 0, 146, 129, 0, 147, 0, 130, 0, 0,
1371
+ 0, 0, -161, 0, 0, 0, 131, 0, -102, -102,
1372
+ -102, 0, 0, 0, 133, 134, 135, 0, 0, 0,
1410
1373
  0, 0, 136, 0, 137, 138, 0, 0, 139, 0,
1411
- 0, 0, 0, 0, 0, 0, 140, 0, 0, 0,
1412
- 0, 141, 142, 0, 0, 143, 0, 0, 0, 0,
1413
- 0, 0, 0, 0, 144, 0, 145, 146, 0, 0,
1414
- 147, 121, 122, 123, 124, 0, 148, 0, 0, 0,
1415
- 0, 125, 0, -166, 0, 126, 127, 0, 128, 0,
1416
- 0, 0, 129, 0, 0, 0, 130, 0, 0, 0,
1417
- 0, -166, 0, 0, 0, 131, 0, 0, 0, -107,
1418
- 0, 0, 0, 133, 134, 135, 0, 0, 0, 0,
1419
- 0, 136, 0, 137, 138, 0, 0, 139, 0, 0,
1420
- 0, 0, 0, 0, 0, 140, 0, 0, 0, 0,
1421
- 141, 142, 0, 0, 143, 0, 0, 0, 0, 0,
1422
- 0, 0, 0, 144, 0, 145, 146, 0, 0, 147,
1423
- 0, 0, 0, 0, 0, 148
1374
+ 0, 0, 0, 0, 140, 0, 0, 141, 121, 122,
1375
+ 123, 124, 142, 143, 0, 0, 144, 0, 125, 0,
1376
+ -161, 0, 126, 127, 0, 128, 145, 0, 146, 129,
1377
+ 0, 147, 0, 130, 0, 0, 0, 0, -161, 0,
1378
+ 0, 0, 131, 0, 0, 0, -149, 0, 0, 132,
1379
+ 133, 134, 135, 0, 0, 0, 0, 0, 136, 0,
1380
+ 137, 138, 0, 0, 139, 0, 0, 0, 0, 0,
1381
+ 140, 0, 0, 141, 121, 122, 123, 124, 142, 143,
1382
+ 0, 0, 144, 0, 125, 0, -161, 0, 126, 127,
1383
+ 0, 128, 145, 0, 146, 129, 0, 147, 0, 130,
1384
+ 0, 0, 0, 0, -161, 0, 0, 0, 131, 0,
1385
+ 0, 0, 274, 0, 0, 0, 133, 134, 135, 0,
1386
+ 0, 0, 0, 0, 136, 0, 137, 138, 0, 0,
1387
+ 139, 0, 0, 0, 0, 0, 140, 0, 0, 141,
1388
+ 121, 122, 123, 124, 142, 143, 0, 0, 144, 0,
1389
+ 125, 0, -161, 0, 126, 127, 0, 128, 145, 0,
1390
+ 146, 129, 0, 147, 0, 130, 0, 0, 0, 0,
1391
+ -161, 0, 0, 0, 131, 0, 0, 0, -111, 0,
1392
+ 0, 0, 133, 134, 135, 0, 0, 0, 0, 0,
1393
+ 136, 0, 137, 138, 0, 0, 139, 0, 0, 0,
1394
+ 0, 0, 140, 0, 0, 141, 121, 122, 123, 124,
1395
+ 142, 143, 0, 0, 144, 0, 125, 0, -161, 0,
1396
+ 126, 127, 0, 128, 145, 0, 146, 129, 0, 147,
1397
+ 0, 130, 0, 0, 0, 0, -161, 0, 0, 0,
1398
+ 131, 0, 0, 0, -104, 0, 0, 0, 133, 134,
1399
+ 135, 0, 0, 0, 0, 0, 136, 0, 137, 138,
1400
+ 0, 0, 139, 0, 0, 0, 0, 0, 140, 0,
1401
+ 0, 141, 0, 0, 0, 0, 142, 143, 0, 0,
1402
+ 144, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1403
+ 145, 0, 146, 0, 0, 147
1424
1404
  };
1425
1405
 
1426
1406
  static const yytype_int16 yycheck[] =
1427
1407
  {
1428
- 4, 97, 15, 213, 101, 15, 15, 103, 25, 248,
1429
- 224, 58, 48, 62, 253, 235, 287, 68, 69, 38,
1430
- 116, 94, 93, 22, 23, 24, 25, 34, 275, 68,
1431
- 101, 28, 83, 32, 0, 34, 142, 36, 37, 210,
1432
- 39, 80, 134, 53, 43, 52, 293, 44, 47, 34,
1433
- 123, 131, 49, 52, 134, 58, 59, 56, 129, 58,
1434
- 331, 60, 22, 23, 24, 64, 65, 66, 134, 88,
1435
- 241, 137, 52, 72, 26, 74, 75, 126, 127, 78,
1436
- 300, 132, 57, 119, 131, 30, 134, 86, 134, 303,
1437
- 196, 88, 91, 92, 26, 201, 95, 307, 337, 22,
1438
- 23, 24, 60, 200, 68, 104, 49, 106, 107, 115,
1439
- 114, 110, 22, 23, 24, 26, 133, 116, 115, 131,
1440
- 124, 136, 137, 219, 134, 138, 139, 55, 138, 138,
1441
- 38, 40, 131, 134, 134, 131, 134, 79, 76, 134,
1442
- 117, 134, 89, 135, 60, 139, 11, 76, 83, 37,
1443
- 91, 31, 134, 60, 74, 134, 134, 2, 331, 116,
1444
- 310, 300, 225, 259, 261, 262, 140, 232, 22, 23,
1445
- 24, 25, 215, 297, 147, 328, -1, -1, 32, -1,
1446
- 34, -1, 36, 37, -1, 39, -1, -1, -1, 43,
1447
- -1, 287, -1, 47, -1, -1, -1, -1, 52, -1,
1448
- -1, 298, 56, -1, -1, 302, 60, -1, -1, -1,
1449
- 64, 65, 66, -1, -1, -1, -1, -1, 72, -1,
1450
- 74, 75, -1, -1, 78, -1, -1, 231, -1, 326,
1451
- -1, -1, 86, -1, -1, 331, -1, 91, 92, -1,
1452
- -1, 95, -1, -1, -1, -1, -1, -1, -1, -1,
1453
- 104, -1, 106, 107, -1, -1, 110, -1, -1, -1,
1454
- -1, -1, 116, -1, -1, -1, -1, -1, -1, -1,
1455
- -1, -1, -1, -1, -1, -1, -1, 131, 22, -1,
1408
+ 4, 97, 15, 15, 101, 25, 216, 103, 58, 205,
1409
+ 28, 48, 143, 22, 23, 24, 25, 238, 277, 38,
1410
+ 116, 0, 243, 32, 62, 34, 44, 36, 37, 68,
1411
+ 39, 49, 34, 94, 43, 134, 131, 34, 47, 134,
1412
+ 53, 80, 103, 52, 95, 68, 69, 56, 26, 58,
1413
+ 52, 60, 22, 23, 24, 64, 65, 66, 134, 52,
1414
+ 83, 137, 193, 72, 323, 74, 75, 198, 129, 78,
1415
+ 89, 89, 123, 58, 59, 84, 136, 137, 87, 30,
1416
+ 57, 131, 119, 92, 93, 295, 134, 96, 126, 127,
1417
+ 22, 23, 24, 22, 23, 24, 60, 106, 116, 108,
1418
+ 197, 134, 111, 299, 26, 68, 116, 49, 329, 132,
1419
+ 114, 26, 134, 133, 131, 211, 131, 55, 134, 40,
1420
+ 124, 134, 131, 134, 38, 138, 138, 79, 134, 76,
1421
+ 117, 134, 90, 60, 135, 76, 11, 83, 92, 37,
1422
+ 60, 31, 134, 74, 134, 134, 22, 23, 24, 25,
1423
+ 2, 116, 323, 249, 251, 252, 32, 302, 34, 283,
1424
+ 36, 37, 290, 39, 217, 207, 141, 43, 224, 287,
1425
+ 320, 47, -1, 147, -1, -1, 52, -1, -1, -1,
1426
+ 56, 277, -1, -1, 60, -1, -1, -1, 64, 65,
1427
+ 66, 288, -1, -1, -1, -1, 72, 294, 74, 75,
1428
+ -1, -1, 78, -1, -1, -1, -1, -1, 84, -1,
1429
+ -1, 87, -1, -1, -1, -1, 92, 93, -1, 223,
1430
+ 96, 318, -1, -1, -1, -1, -1, 323, -1, -1,
1431
+ 106, -1, 108, -1, -1, 111, -1, -1, -1, -1,
1432
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1433
+ -1, -1, -1, -1, -1, 131, -1, -1, -1, -1,
1434
+ -1, -1, -1, -1, -1, -1, -1, -1, 22, -1,
1456
1435
  -1, 25, -1, 27, 28, -1, 30, 31, 32, 33,
1457
- -1, -1, 36, 297, 38, 39, 40, 41, 42, 43,
1436
+ -1, -1, 36, 287, 38, 39, 40, 41, 42, 43,
1458
1437
  44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
1459
1438
  54, 55, 56, 57, -1, 59, -1, 61, 62, 63,
1460
1439
  -1, 65, 66, 67, -1, -1, 70, -1, 72, 73,
1461
1440
  -1, 75, -1, 77, 78, -1, 80, 81, 82, -1,
1462
- 84, 85, 86, 87, 88, -1, 90, -1, 92, 93,
1463
- -1, 95, 96, 97, 98, 99, 100, 101, 102, 103,
1441
+ 84, 85, 86, 87, 88, 89, -1, 91, -1, 93,
1442
+ 94, -1, 96, 97, 98, 99, 100, 101, 102, 103,
1464
1443
  104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
1465
1444
  114, 115, 116, 117, 118, 119, -1, 121, 122, -1,
1466
1445
  -1, 125, 126, 127, -1, 129, 130, 22, -1, 24,
@@ -1470,8 +1449,8 @@ static const yytype_int16 yycheck[] =
1470
1449
  55, 56, 57, -1, 59, -1, 61, 62, 63, -1,
1471
1450
  65, 66, 67, -1, -1, 70, -1, 72, 73, -1,
1472
1451
  75, -1, 77, 78, -1, 80, 81, 82, -1, 84,
1473
- 85, 86, 87, 88, -1, 90, -1, 92, 93, -1,
1474
- 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1452
+ 85, 86, 87, 88, 89, -1, 91, -1, 93, 94,
1453
+ -1, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1475
1454
  105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1476
1455
  115, 116, 117, 118, 119, -1, 121, 122, -1, -1,
1477
1456
  125, 126, 127, -1, 129, 130, 22, 23, -1, -1,
@@ -1481,7 +1460,7 @@ static const yytype_int16 yycheck[] =
1481
1460
  56, 57, -1, 59, -1, 61, 62, 63, -1, 65,
1482
1461
  66, 67, -1, -1, 70, -1, 72, 73, -1, 75,
1483
1462
  -1, 77, 78, -1, 80, 81, 82, -1, 84, 85,
1484
- 86, 87, 88, -1, 90, -1, 92, 93, -1, 95,
1463
+ 86, 87, 88, 89, -1, 91, -1, 93, 94, -1,
1485
1464
  96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1486
1465
  106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
1487
1466
  116, 117, 118, 119, -1, 121, 122, -1, -1, 125,
@@ -1492,7 +1471,7 @@ static const yytype_int16 yycheck[] =
1492
1471
  57, -1, 59, -1, 61, 62, 63, -1, 65, 66,
1493
1472
  67, -1, -1, 70, -1, 72, 73, -1, 75, -1,
1494
1473
  77, 78, -1, 80, 81, 82, -1, 84, 85, 86,
1495
- 87, 88, -1, 90, -1, 92, 93, -1, 95, 96,
1474
+ 87, 88, 89, -1, 91, -1, 93, 94, -1, 96,
1496
1475
  97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1497
1476
  107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1498
1477
  117, 118, 119, -1, 121, 122, -1, -1, 125, 126,
@@ -1502,8 +1481,8 @@ static const yytype_int16 yycheck[] =
1502
1481
  51, -1, 53, 54, 55, 56, 57, -1, 59, -1,
1503
1482
  61, 62, 63, -1, 65, 66, 67, -1, -1, 70,
1504
1483
  -1, 72, 73, -1, 75, -1, 77, 78, -1, 80,
1505
- 81, 82, -1, 84, 85, 86, 87, 88, -1, 90,
1506
- -1, 92, 93, -1, 95, 96, 97, 98, 99, 100,
1484
+ 81, 82, -1, 84, 85, 86, 87, 88, 89, -1,
1485
+ 91, -1, 93, 94, -1, 96, 97, 98, 99, 100,
1507
1486
  101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
1508
1487
  111, 112, 113, 114, 115, 116, 117, 118, 119, -1,
1509
1488
  121, 122, -1, -1, 125, 126, 127, 22, 129, 130,
@@ -1513,8 +1492,8 @@ static const yytype_int16 yycheck[] =
1513
1492
  55, 56, 57, -1, 59, -1, 61, 62, 63, -1,
1514
1493
  65, 66, 67, -1, -1, 70, -1, 72, 73, -1,
1515
1494
  75, -1, 77, 78, -1, 80, 81, 82, -1, 84,
1516
- 85, 86, 87, 88, -1, 90, -1, 92, 93, -1,
1517
- 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1495
+ 85, 86, 87, 88, 89, -1, 91, -1, 93, 94,
1496
+ -1, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1518
1497
  105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1519
1498
  115, 116, 117, 118, 119, -1, 121, 122, -1, -1,
1520
1499
  125, 126, 127, -1, 129, 130, 22, 23, 24, 25,
@@ -1523,96 +1502,83 @@ static const yytype_int16 yycheck[] =
1523
1502
  -1, 47, -1, -1, -1, -1, 52, -1, -1, -1,
1524
1503
  56, -1, 58, 59, 60, -1, -1, -1, 64, 65,
1525
1504
  66, -1, -1, -1, -1, -1, 72, -1, 74, 75,
1526
- -1, -1, 78, -1, -1, -1, -1, -1, -1, -1,
1527
- 86, -1, -1, -1, -1, 91, 92, -1, -1, 95,
1528
- -1, -1, -1, -1, -1, -1, -1, -1, 104, -1,
1529
- 106, 107, -1, -1, 110, 22, 23, 24, 25, -1,
1530
- 116, -1, -1, -1, -1, 32, -1, 34, -1, 36,
1531
- 37, -1, 39, -1, -1, -1, 43, -1, -1, -1,
1532
- 47, -1, -1, -1, -1, 52, -1, -1, -1, 56,
1533
- -1, 58, 59, 60, -1, -1, -1, 64, 65, 66,
1534
- -1, -1, -1, -1, -1, 72, -1, 74, 75, -1,
1535
- -1, 78, -1, -1, -1, -1, -1, -1, -1, 86,
1536
- -1, -1, -1, -1, 91, 92, -1, -1, 95, -1,
1537
- -1, -1, -1, -1, -1, -1, -1, 104, -1, 106,
1538
- 107, -1, -1, 110, 22, 23, 24, 25, -1, 116,
1539
- -1, -1, -1, -1, 32, -1, 34, -1, 36, 37,
1540
- -1, 39, -1, -1, -1, 43, -1, -1, -1, 47,
1541
- -1, -1, -1, -1, 52, -1, -1, -1, 56, -1,
1542
- -1, -1, 60, -1, -1, 63, 64, 65, 66, -1,
1543
- -1, -1, -1, -1, 72, -1, 74, 75, -1, -1,
1544
- 78, -1, -1, -1, -1, -1, -1, -1, 86, -1,
1545
- -1, -1, -1, 91, 92, -1, -1, 95, -1, -1,
1546
- -1, -1, -1, -1, -1, -1, 104, -1, 106, 107,
1547
- -1, -1, 110, 22, 23, 24, 25, -1, 116, -1,
1548
- -1, -1, -1, 32, -1, 34, -1, 36, 37, -1,
1549
- 39, -1, -1, -1, 43, -1, -1, -1, 47, -1,
1550
- -1, -1, -1, 52, -1, -1, -1, 56, -1, -1,
1551
- -1, 60, -1, -1, -1, 64, 65, 66, -1, -1,
1552
- -1, -1, -1, 72, -1, 74, 75, -1, -1, 78,
1553
- -1, -1, -1, -1, -1, -1, -1, 86, -1, -1,
1554
- -1, -1, 91, 92, -1, -1, 95, -1, -1, -1,
1555
- -1, -1, -1, -1, -1, 104, -1, 106, 107, -1,
1556
- -1, 110, 22, 23, 24, 25, -1, 116, -1, -1,
1557
- -1, -1, 32, -1, 34, -1, 36, 37, -1, 39,
1558
- -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
1559
- -1, -1, 52, -1, -1, -1, 56, -1, -1, -1,
1505
+ -1, -1, 78, -1, -1, -1, -1, -1, 84, -1,
1506
+ -1, 87, 22, 23, 24, 25, 92, 93, -1, -1,
1507
+ 96, -1, 32, -1, 34, -1, 36, 37, -1, 39,
1508
+ 106, -1, 108, 43, -1, 111, -1, 47, -1, -1,
1509
+ -1, -1, 52, -1, -1, -1, 56, -1, 58, 59,
1560
1510
  60, -1, -1, -1, 64, 65, 66, -1, -1, -1,
1561
1511
  -1, -1, 72, -1, 74, 75, -1, -1, 78, -1,
1562
- -1, -1, -1, -1, -1, -1, 86, -1, -1, -1,
1563
- -1, 91, 92, -1, -1, 95, -1, -1, -1, -1,
1564
- -1, -1, -1, -1, 104, -1, 106, 107, -1, -1,
1565
- 110, 22, 23, 24, 25, -1, 116, -1, -1, -1,
1566
- -1, 32, -1, 34, -1, 36, 37, -1, 39, -1,
1567
- -1, -1, 43, -1, -1, -1, 47, -1, -1, -1,
1568
- -1, 52, -1, -1, -1, 56, -1, -1, -1, 60,
1569
- -1, -1, -1, 64, 65, 66, -1, -1, -1, -1,
1570
- -1, 72, -1, 74, 75, -1, -1, 78, -1, -1,
1571
- -1, -1, -1, -1, -1, 86, -1, -1, -1, -1,
1572
- 91, 92, -1, -1, 95, -1, -1, -1, -1, -1,
1573
- -1, -1, -1, 104, -1, 106, 107, -1, -1, 110,
1574
- -1, -1, -1, -1, -1, 116
1512
+ -1, -1, -1, -1, 84, -1, -1, 87, 22, 23,
1513
+ 24, 25, 92, 93, -1, -1, 96, -1, 32, -1,
1514
+ 34, -1, 36, 37, -1, 39, 106, -1, 108, 43,
1515
+ -1, 111, -1, 47, -1, -1, -1, -1, 52, -1,
1516
+ -1, -1, 56, -1, -1, -1, 60, -1, -1, 63,
1517
+ 64, 65, 66, -1, -1, -1, -1, -1, 72, -1,
1518
+ 74, 75, -1, -1, 78, -1, -1, -1, -1, -1,
1519
+ 84, -1, -1, 87, 22, 23, 24, 25, 92, 93,
1520
+ -1, -1, 96, -1, 32, -1, 34, -1, 36, 37,
1521
+ -1, 39, 106, -1, 108, 43, -1, 111, -1, 47,
1522
+ -1, -1, -1, -1, 52, -1, -1, -1, 56, -1,
1523
+ -1, -1, 60, -1, -1, -1, 64, 65, 66, -1,
1524
+ -1, -1, -1, -1, 72, -1, 74, 75, -1, -1,
1525
+ 78, -1, -1, -1, -1, -1, 84, -1, -1, 87,
1526
+ 22, 23, 24, 25, 92, 93, -1, -1, 96, -1,
1527
+ 32, -1, 34, -1, 36, 37, -1, 39, 106, -1,
1528
+ 108, 43, -1, 111, -1, 47, -1, -1, -1, -1,
1529
+ 52, -1, -1, -1, 56, -1, -1, -1, 60, -1,
1530
+ -1, -1, 64, 65, 66, -1, -1, -1, -1, -1,
1531
+ 72, -1, 74, 75, -1, -1, 78, -1, -1, -1,
1532
+ -1, -1, 84, -1, -1, 87, 22, 23, 24, 25,
1533
+ 92, 93, -1, -1, 96, -1, 32, -1, 34, -1,
1534
+ 36, 37, -1, 39, 106, -1, 108, 43, -1, 111,
1535
+ -1, 47, -1, -1, -1, -1, 52, -1, -1, -1,
1536
+ 56, -1, -1, -1, 60, -1, -1, -1, 64, 65,
1537
+ 66, -1, -1, -1, -1, -1, 72, -1, 74, 75,
1538
+ -1, -1, 78, -1, -1, -1, -1, -1, 84, -1,
1539
+ -1, 87, -1, -1, -1, -1, 92, 93, -1, -1,
1540
+ 96, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1541
+ 106, -1, 108, -1, -1, 111
1575
1542
  };
1576
1543
 
1577
1544
  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1578
1545
  symbol of state STATE-NUM. */
1579
1546
  static const yytype_uint8 yystos[] =
1580
1547
  {
1581
- 0, 141, 142, 0, 25, 133, 143, 146, 147, 224,
1548
+ 0, 140, 141, 0, 25, 133, 142, 145, 146, 220,
1582
1549
  22, 24, 27, 28, 30, 31, 32, 33, 36, 38,
1583
1550
  39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1584
1551
  49, 50, 51, 53, 54, 55, 56, 57, 59, 61,
1585
1552
  62, 63, 65, 66, 67, 70, 72, 73, 75, 77,
1586
- 78, 80, 81, 82, 84, 85, 86, 87, 88, 90,
1587
- 92, 93, 95, 96, 97, 98, 99, 100, 101, 102,
1553
+ 78, 80, 81, 82, 84, 85, 86, 87, 88, 89,
1554
+ 91, 93, 94, 96, 97, 98, 99, 100, 101, 102,
1588
1555
  103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
1589
1556
  113, 114, 115, 116, 117, 118, 119, 121, 122, 125,
1590
- 126, 127, 129, 130, 228, 229, 93, 101, 129, 134,
1591
- 145, 34, 52, 148, 26, 57, 22, 144, 229, 62,
1592
- 126, 127, 168, 22, 25, 52, 149, 150, 151, 160,
1593
- 229, 22, 23, 24, 25, 32, 36, 37, 39, 43,
1557
+ 126, 127, 129, 130, 224, 225, 94, 103, 129, 134,
1558
+ 144, 34, 52, 147, 26, 57, 22, 143, 225, 62,
1559
+ 126, 127, 167, 22, 25, 52, 148, 149, 150, 159,
1560
+ 225, 22, 23, 24, 25, 32, 36, 37, 39, 43,
1594
1561
  47, 56, 63, 64, 65, 66, 72, 74, 75, 78,
1595
- 86, 91, 92, 95, 104, 106, 107, 110, 116, 146,
1596
- 169, 170, 171, 172, 173, 179, 180, 183, 188, 189,
1597
- 190, 193, 195, 196, 197, 198, 199, 201, 202, 203,
1598
- 204, 205, 207, 208, 209, 210, 212, 214, 225, 228,
1599
- 150, 28, 44, 88, 115, 153, 161, 228, 184, 22,
1600
- 23, 24, 213, 30, 211, 215, 206, 48, 119, 174,
1601
- 222, 206, 134, 213, 220, 211, 134, 15, 138, 139,
1602
- 167, 226, 228, 60, 68, 69, 83, 132, 26, 68,
1603
- 115, 49, 162, 26, 131, 185, 186, 134, 38, 88,
1604
- 134, 131, 216, 217, 213, 55, 168, 213, 134, 221,
1605
- 220, 131, 134, 227, 226, 22, 23, 24, 191, 192,
1606
- 192, 168, 200, 223, 22, 23, 159, 229, 152, 40,
1607
- 163, 222, 58, 186, 187, 38, 218, 219, 228, 217,
1608
- 79, 22, 23, 175, 176, 178, 179, 181, 134, 220,
1609
- 200, 76, 117, 194, 60, 200, 134, 135, 155, 22,
1610
- 23, 229, 89, 164, 168, 168, 60, 94, 123, 134,
1611
- 137, 167, 58, 59, 182, 11, 76, 83, 156, 157,
1612
- 160, 68, 80, 158, 91, 53, 134, 165, 166, 167,
1613
- 37, 219, 168, 176, 177, 168, 222, 60, 31, 226,
1614
- 136, 137, 162, 154, 134, 168, 74, 223, 134, 157,
1615
- 134, 200
1562
+ 84, 87, 92, 93, 96, 106, 108, 111, 145, 168,
1563
+ 169, 170, 171, 172, 178, 181, 186, 187, 188, 191,
1564
+ 193, 194, 195, 196, 197, 199, 200, 201, 202, 203,
1565
+ 205, 206, 207, 208, 211, 221, 224, 149, 28, 44,
1566
+ 89, 116, 152, 160, 224, 182, 22, 23, 24, 210,
1567
+ 30, 209, 212, 204, 48, 119, 173, 218, 204, 134,
1568
+ 210, 209, 134, 222, 224, 60, 68, 69, 83, 132,
1569
+ 26, 68, 116, 49, 161, 26, 131, 183, 184, 134,
1570
+ 38, 89, 134, 131, 213, 214, 210, 55, 167, 210,
1571
+ 134, 131, 134, 223, 222, 22, 23, 24, 189, 190,
1572
+ 190, 167, 198, 219, 22, 23, 158, 225, 151, 40,
1573
+ 162, 218, 58, 184, 185, 38, 215, 216, 224, 214,
1574
+ 79, 22, 23, 24, 174, 175, 177, 179, 134, 217,
1575
+ 198, 76, 117, 192, 60, 198, 134, 135, 154, 22,
1576
+ 23, 225, 90, 163, 167, 167, 60, 95, 123, 134,
1577
+ 137, 15, 138, 166, 58, 59, 180, 11, 76, 83,
1578
+ 155, 156, 159, 68, 80, 157, 92, 53, 134, 164,
1579
+ 165, 166, 37, 216, 167, 175, 176, 167, 218, 60,
1580
+ 31, 222, 136, 137, 161, 153, 134, 167, 74, 219,
1581
+ 134, 156, 134, 198
1616
1582
  };
1617
1583
 
1618
1584
  #define yyerrok (yyerrstatus = 0)
@@ -2453,21 +2419,21 @@ yyreduce:
2453
2419
  switch (yyn)
2454
2420
  {
2455
2421
  case 2:
2456
- #line 365 "pl_gram.y"
2422
+ #line 361 "pl_gram.y"
2457
2423
  {
2458
2424
  plpgsql_parse_result = (PLpgSQL_stmt_block *) (yyvsp[(2) - (3)].stmt);
2459
2425
  ;}
2460
2426
  break;
2461
2427
 
2462
2428
  case 5:
2463
- #line 375 "pl_gram.y"
2429
+ #line 371 "pl_gram.y"
2464
2430
  {
2465
2431
  plpgsql_DumpExecTree = true;
2466
2432
  ;}
2467
2433
  break;
2468
2434
 
2469
2435
  case 6:
2470
- #line 379 "pl_gram.y"
2436
+ #line 375 "pl_gram.y"
2471
2437
  {
2472
2438
  if (strcmp((yyvsp[(3) - (3)].str), "on") == 0)
2473
2439
  plpgsql_curr_compile->print_strict_params = true;
@@ -2479,42 +2445,42 @@ yyreduce:
2479
2445
  break;
2480
2446
 
2481
2447
  case 7:
2482
- #line 388 "pl_gram.y"
2448
+ #line 384 "pl_gram.y"
2483
2449
  {
2484
2450
  plpgsql_curr_compile->resolve_option = PLPGSQL_RESOLVE_ERROR;
2485
2451
  ;}
2486
2452
  break;
2487
2453
 
2488
2454
  case 8:
2489
- #line 392 "pl_gram.y"
2455
+ #line 388 "pl_gram.y"
2490
2456
  {
2491
2457
  plpgsql_curr_compile->resolve_option = PLPGSQL_RESOLVE_VARIABLE;
2492
2458
  ;}
2493
2459
  break;
2494
2460
 
2495
2461
  case 9:
2496
- #line 396 "pl_gram.y"
2462
+ #line 392 "pl_gram.y"
2497
2463
  {
2498
2464
  plpgsql_curr_compile->resolve_option = PLPGSQL_RESOLVE_COLUMN;
2499
2465
  ;}
2500
2466
  break;
2501
2467
 
2502
2468
  case 10:
2503
- #line 402 "pl_gram.y"
2469
+ #line 398 "pl_gram.y"
2504
2470
  {
2505
2471
  (yyval.str) = (yyvsp[(1) - (1)].word).ident;
2506
2472
  ;}
2507
2473
  break;
2508
2474
 
2509
2475
  case 11:
2510
- #line 406 "pl_gram.y"
2476
+ #line 402 "pl_gram.y"
2511
2477
  {
2512
2478
  (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword));
2513
2479
  ;}
2514
2480
  break;
2515
2481
 
2516
2482
  case 14:
2517
- #line 415 "pl_gram.y"
2483
+ #line 411 "pl_gram.y"
2518
2484
  {
2519
2485
  PLpgSQL_stmt_block *new;
2520
2486
 
@@ -2532,12 +2498,12 @@ yyreduce:
2532
2498
  check_labels((yyvsp[(1) - (6)].declhdr).label, (yyvsp[(6) - (6)].str), (yylsp[(6) - (6)]));
2533
2499
  plpgsql_ns_pop();
2534
2500
 
2535
- (yyval.stmt) = (PLpgSQL_stmt *)new;
2501
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
2536
2502
  ;}
2537
2503
  break;
2538
2504
 
2539
2505
  case 15:
2540
- #line 438 "pl_gram.y"
2506
+ #line 434 "pl_gram.y"
2541
2507
  {
2542
2508
  /* done with decls, so resume identifier lookup */
2543
2509
  plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
@@ -2548,7 +2514,7 @@ yyreduce:
2548
2514
  break;
2549
2515
 
2550
2516
  case 16:
2551
- #line 446 "pl_gram.y"
2517
+ #line 442 "pl_gram.y"
2552
2518
  {
2553
2519
  plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
2554
2520
  (yyval.declhdr).label = (yyvsp[(1) - (2)].str);
@@ -2558,7 +2524,7 @@ yyreduce:
2558
2524
  break;
2559
2525
 
2560
2526
  case 17:
2561
- #line 453 "pl_gram.y"
2527
+ #line 449 "pl_gram.y"
2562
2528
  {
2563
2529
  plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
2564
2530
  (yyval.declhdr).label = (yyvsp[(1) - (3)].str);
@@ -2568,7 +2534,7 @@ yyreduce:
2568
2534
  break;
2569
2535
 
2570
2536
  case 18:
2571
- #line 462 "pl_gram.y"
2537
+ #line 458 "pl_gram.y"
2572
2538
  {
2573
2539
  /* Forget any variables created before block */
2574
2540
  plpgsql_add_initdatums(NULL);
@@ -2581,14 +2547,14 @@ yyreduce:
2581
2547
  break;
2582
2548
 
2583
2549
  case 22:
2584
- #line 479 "pl_gram.y"
2550
+ #line 475 "pl_gram.y"
2585
2551
  {
2586
2552
  /* We allow useless extra DECLAREs */
2587
2553
  ;}
2588
2554
  break;
2589
2555
 
2590
2556
  case 23:
2591
- #line 483 "pl_gram.y"
2557
+ #line 479 "pl_gram.y"
2592
2558
  {
2593
2559
  /*
2594
2560
  * Throw a helpful error if user tries to put block
@@ -2602,7 +2568,7 @@ yyreduce:
2602
2568
  break;
2603
2569
 
2604
2570
  case 24:
2605
- #line 496 "pl_gram.y"
2571
+ #line 492 "pl_gram.y"
2606
2572
  {
2607
2573
  PLpgSQL_variable *var;
2608
2574
 
@@ -2643,7 +2609,7 @@ yyreduce:
2643
2609
  break;
2644
2610
 
2645
2611
  case 25:
2646
- #line 534 "pl_gram.y"
2612
+ #line 530 "pl_gram.y"
2647
2613
  {
2648
2614
  plpgsql_ns_additem((yyvsp[(4) - (5)].nsitem)->itemtype,
2649
2615
  (yyvsp[(4) - (5)].nsitem)->itemno, (yyvsp[(1) - (5)].varname).name);
@@ -2651,18 +2617,14 @@ yyreduce:
2651
2617
  break;
2652
2618
 
2653
2619
  case 26:
2654
- #line 539 "pl_gram.y"
2620
+ #line 535 "pl_gram.y"
2655
2621
  { plpgsql_ns_push((yyvsp[(1) - (3)].varname).name, PLPGSQL_LABEL_OTHER); ;}
2656
2622
  break;
2657
2623
 
2658
2624
  case 27:
2659
- #line 541 "pl_gram.y"
2625
+ #line 537 "pl_gram.y"
2660
2626
  {
2661
2627
  PLpgSQL_var *new;
2662
- PLpgSQL_expr *curname_def;
2663
- char buf[1024];
2664
- char *cp1;
2665
- char *cp2;
2666
2628
 
2667
2629
  /* pop local namespace for cursor args */
2668
2630
  plpgsql_ns_pop();
@@ -2675,28 +2637,6 @@ yyreduce:
2675
2637
  NULL),
2676
2638
  true);
2677
2639
 
2678
- curname_def = palloc0(sizeof(PLpgSQL_expr));
2679
-
2680
- strcpy(buf, "SELECT ");
2681
- cp1 = new->refname;
2682
- cp2 = buf + strlen(buf);
2683
- /*
2684
- * Don't trust standard_conforming_strings here;
2685
- * it might change before we use the string.
2686
- */
2687
- if (strchr(cp1, '\\') != NULL)
2688
- *cp2++ = ESCAPE_STRING_SYNTAX;
2689
- *cp2++ = '\'';
2690
- while (*cp1)
2691
- {
2692
- if (SQL_STR_DOUBLE(*cp1, true))
2693
- *cp2++ = *cp1;
2694
- *cp2++ = *cp1++;
2695
- }
2696
- strcpy(cp2, "'::pg_catalog.refcursor");
2697
- curname_def->query = pstrdup(buf);
2698
- new->default_val = curname_def;
2699
-
2700
2640
  new->cursor_explicit_expr = (yyvsp[(7) - (7)].expr);
2701
2641
  if ((yyvsp[(5) - (7)].datum) == NULL)
2702
2642
  new->cursor_explicit_argrow = -1;
@@ -2707,46 +2647,46 @@ yyreduce:
2707
2647
  break;
2708
2648
 
2709
2649
  case 28:
2710
- #line 591 "pl_gram.y"
2650
+ #line 561 "pl_gram.y"
2711
2651
  {
2712
2652
  (yyval.ival) = 0;
2713
2653
  ;}
2714
2654
  break;
2715
2655
 
2716
2656
  case 29:
2717
- #line 595 "pl_gram.y"
2657
+ #line 565 "pl_gram.y"
2718
2658
  {
2719
2659
  (yyval.ival) = CURSOR_OPT_NO_SCROLL;
2720
2660
  ;}
2721
2661
  break;
2722
2662
 
2723
2663
  case 30:
2724
- #line 599 "pl_gram.y"
2664
+ #line 569 "pl_gram.y"
2725
2665
  {
2726
2666
  (yyval.ival) = CURSOR_OPT_SCROLL;
2727
2667
  ;}
2728
2668
  break;
2729
2669
 
2730
2670
  case 31:
2731
- #line 605 "pl_gram.y"
2671
+ #line 575 "pl_gram.y"
2732
2672
  {
2733
- (yyval.expr) = read_sql_stmt("");
2673
+ (yyval.expr) = read_sql_stmt();
2734
2674
  ;}
2735
2675
  break;
2736
2676
 
2737
2677
  case 32:
2738
- #line 611 "pl_gram.y"
2678
+ #line 581 "pl_gram.y"
2739
2679
  {
2740
2680
  (yyval.datum) = NULL;
2741
2681
  ;}
2742
2682
  break;
2743
2683
 
2744
2684
  case 33:
2745
- #line 615 "pl_gram.y"
2685
+ #line 585 "pl_gram.y"
2746
2686
  {
2747
2687
  PLpgSQL_row *new;
2748
- int i;
2749
- ListCell *l;
2688
+ int i;
2689
+ ListCell *l;
2750
2690
 
2751
2691
  new = palloc0(sizeof(PLpgSQL_row));
2752
2692
  new->dtype = PLPGSQL_DTYPE_ROW;
@@ -2774,21 +2714,21 @@ yyreduce:
2774
2714
  break;
2775
2715
 
2776
2716
  case 34:
2777
- #line 646 "pl_gram.y"
2717
+ #line 616 "pl_gram.y"
2778
2718
  {
2779
2719
  (yyval.list) = list_make1((yyvsp[(1) - (1)].datum));
2780
2720
  ;}
2781
2721
  break;
2782
2722
 
2783
2723
  case 35:
2784
- #line 650 "pl_gram.y"
2724
+ #line 620 "pl_gram.y"
2785
2725
  {
2786
2726
  (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].datum));
2787
2727
  ;}
2788
2728
  break;
2789
2729
 
2790
2730
  case 36:
2791
- #line 656 "pl_gram.y"
2731
+ #line 626 "pl_gram.y"
2792
2732
  {
2793
2733
  (yyval.datum) = (PLpgSQL_datum *)
2794
2734
  plpgsql_build_variable((yyvsp[(1) - (2)].varname).name, (yyvsp[(1) - (2)].varname).lineno,
@@ -2797,7 +2737,7 @@ yyreduce:
2797
2737
  break;
2798
2738
 
2799
2739
  case 39:
2800
- #line 667 "pl_gram.y"
2740
+ #line 637 "pl_gram.y"
2801
2741
  {
2802
2742
  PLpgSQL_nsitem *nsi;
2803
2743
 
@@ -2815,7 +2755,7 @@ yyreduce:
2815
2755
  break;
2816
2756
 
2817
2757
  case 40:
2818
- #line 682 "pl_gram.y"
2758
+ #line 652 "pl_gram.y"
2819
2759
  {
2820
2760
  PLpgSQL_nsitem *nsi;
2821
2761
 
@@ -2833,7 +2773,7 @@ yyreduce:
2833
2773
  break;
2834
2774
 
2835
2775
  case 41:
2836
- #line 697 "pl_gram.y"
2776
+ #line 667 "pl_gram.y"
2837
2777
  {
2838
2778
  PLpgSQL_nsitem *nsi;
2839
2779
 
@@ -2862,7 +2802,7 @@ yyreduce:
2862
2802
  break;
2863
2803
 
2864
2804
  case 42:
2865
- #line 725 "pl_gram.y"
2805
+ #line 695 "pl_gram.y"
2866
2806
  {
2867
2807
  (yyval.varname).name = (yyvsp[(1) - (1)].word).ident;
2868
2808
  (yyval.varname).lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
@@ -2893,7 +2833,7 @@ yyreduce:
2893
2833
  break;
2894
2834
 
2895
2835
  case 43:
2896
- #line 753 "pl_gram.y"
2836
+ #line 723 "pl_gram.y"
2897
2837
  {
2898
2838
  (yyval.varname).name = pstrdup((yyvsp[(1) - (1)].keyword));
2899
2839
  (yyval.varname).lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
@@ -2924,21 +2864,22 @@ yyreduce:
2924
2864
  break;
2925
2865
 
2926
2866
  case 44:
2927
- #line 783 "pl_gram.y"
2867
+ #line 753 "pl_gram.y"
2928
2868
  { (yyval.boolean) = false; ;}
2929
2869
  break;
2930
2870
 
2931
2871
  case 45:
2932
- #line 785 "pl_gram.y"
2872
+ #line 755 "pl_gram.y"
2933
2873
  { (yyval.boolean) = true; ;}
2934
2874
  break;
2935
2875
 
2936
2876
  case 46:
2937
- #line 789 "pl_gram.y"
2877
+ #line 759 "pl_gram.y"
2938
2878
  {
2939
2879
  /*
2940
- * If there's a lookahead token, read_datatype
2941
- * should consume it.
2880
+ * If there's a lookahead token, read_datatype() will
2881
+ * consume it, and then we must tell bison to forget
2882
+ * it.
2942
2883
  */
2943
2884
  (yyval.dtype) = read_datatype(yychar);
2944
2885
  yyclearin;
@@ -2946,12 +2887,12 @@ yyreduce:
2946
2887
  break;
2947
2888
 
2948
2889
  case 47:
2949
- #line 800 "pl_gram.y"
2890
+ #line 771 "pl_gram.y"
2950
2891
  { (yyval.oid) = InvalidOid; ;}
2951
2892
  break;
2952
2893
 
2953
2894
  case 48:
2954
- #line 802 "pl_gram.y"
2895
+ #line 773 "pl_gram.y"
2955
2896
  {
2956
2897
  (yyval.oid) = get_collation_oid(list_make1(makeString((yyvsp[(2) - (2)].word).ident)),
2957
2898
  false);
@@ -2959,7 +2900,7 @@ yyreduce:
2959
2900
  break;
2960
2901
 
2961
2902
  case 49:
2962
- #line 807 "pl_gram.y"
2903
+ #line 778 "pl_gram.y"
2963
2904
  {
2964
2905
  (yyval.oid) = get_collation_oid(list_make1(makeString(pstrdup((yyvsp[(2) - (2)].keyword)))),
2965
2906
  false);
@@ -2967,41 +2908,41 @@ yyreduce:
2967
2908
  break;
2968
2909
 
2969
2910
  case 50:
2970
- #line 812 "pl_gram.y"
2911
+ #line 783 "pl_gram.y"
2971
2912
  {
2972
2913
  (yyval.oid) = get_collation_oid((yyvsp[(2) - (2)].cword).idents, false);
2973
2914
  ;}
2974
2915
  break;
2975
2916
 
2976
2917
  case 51:
2977
- #line 818 "pl_gram.y"
2918
+ #line 789 "pl_gram.y"
2978
2919
  { (yyval.boolean) = false; ;}
2979
2920
  break;
2980
2921
 
2981
2922
  case 52:
2982
- #line 820 "pl_gram.y"
2923
+ #line 791 "pl_gram.y"
2983
2924
  { (yyval.boolean) = true; ;}
2984
2925
  break;
2985
2926
 
2986
2927
  case 53:
2987
- #line 824 "pl_gram.y"
2928
+ #line 795 "pl_gram.y"
2988
2929
  { (yyval.expr) = NULL; ;}
2989
2930
  break;
2990
2931
 
2991
2932
  case 54:
2992
- #line 826 "pl_gram.y"
2933
+ #line 797 "pl_gram.y"
2993
2934
  {
2994
2935
  (yyval.expr) = read_sql_expression(';', ";");
2995
2936
  ;}
2996
2937
  break;
2997
2938
 
2998
2939
  case 59:
2999
- #line 845 "pl_gram.y"
2940
+ #line 816 "pl_gram.y"
3000
2941
  { (yyval.list) = NIL; ;}
3001
2942
  break;
3002
2943
 
3003
2944
  case 60:
3004
- #line 847 "pl_gram.y"
2945
+ #line 818 "pl_gram.y"
3005
2946
  {
3006
2947
  /* don't bother linking null statements into list */
3007
2948
  if ((yyvsp[(2) - (2)].stmt) == NULL)
@@ -3012,147 +2953,164 @@ yyreduce:
3012
2953
  break;
3013
2954
 
3014
2955
  case 61:
3015
- #line 857 "pl_gram.y"
2956
+ #line 828 "pl_gram.y"
3016
2957
  { (yyval.stmt) = (yyvsp[(1) - (2)].stmt); ;}
3017
2958
  break;
3018
2959
 
3019
2960
  case 62:
3020
- #line 859 "pl_gram.y"
2961
+ #line 830 "pl_gram.y"
3021
2962
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3022
2963
  break;
3023
2964
 
3024
2965
  case 63:
3025
- #line 861 "pl_gram.y"
2966
+ #line 832 "pl_gram.y"
3026
2967
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3027
2968
  break;
3028
2969
 
3029
2970
  case 64:
3030
- #line 863 "pl_gram.y"
2971
+ #line 834 "pl_gram.y"
3031
2972
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3032
2973
  break;
3033
2974
 
3034
2975
  case 65:
3035
- #line 865 "pl_gram.y"
2976
+ #line 836 "pl_gram.y"
3036
2977
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3037
2978
  break;
3038
2979
 
3039
2980
  case 66:
3040
- #line 867 "pl_gram.y"
2981
+ #line 838 "pl_gram.y"
3041
2982
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3042
2983
  break;
3043
2984
 
3044
2985
  case 67:
3045
- #line 869 "pl_gram.y"
2986
+ #line 840 "pl_gram.y"
3046
2987
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3047
2988
  break;
3048
2989
 
3049
2990
  case 68:
3050
- #line 871 "pl_gram.y"
2991
+ #line 842 "pl_gram.y"
3051
2992
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3052
2993
  break;
3053
2994
 
3054
2995
  case 69:
3055
- #line 873 "pl_gram.y"
2996
+ #line 844 "pl_gram.y"
3056
2997
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3057
2998
  break;
3058
2999
 
3059
3000
  case 70:
3060
- #line 875 "pl_gram.y"
3001
+ #line 846 "pl_gram.y"
3061
3002
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3062
3003
  break;
3063
3004
 
3064
3005
  case 71:
3065
- #line 877 "pl_gram.y"
3006
+ #line 848 "pl_gram.y"
3066
3007
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3067
3008
  break;
3068
3009
 
3069
3010
  case 72:
3070
- #line 879 "pl_gram.y"
3011
+ #line 850 "pl_gram.y"
3071
3012
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3072
3013
  break;
3073
3014
 
3074
3015
  case 73:
3075
- #line 881 "pl_gram.y"
3016
+ #line 852 "pl_gram.y"
3076
3017
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3077
3018
  break;
3078
3019
 
3079
3020
  case 74:
3080
- #line 883 "pl_gram.y"
3021
+ #line 854 "pl_gram.y"
3081
3022
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3082
3023
  break;
3083
3024
 
3084
3025
  case 75:
3085
- #line 885 "pl_gram.y"
3026
+ #line 856 "pl_gram.y"
3086
3027
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3087
3028
  break;
3088
3029
 
3089
3030
  case 76:
3090
- #line 887 "pl_gram.y"
3031
+ #line 858 "pl_gram.y"
3091
3032
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3092
3033
  break;
3093
3034
 
3094
3035
  case 77:
3095
- #line 889 "pl_gram.y"
3036
+ #line 860 "pl_gram.y"
3096
3037
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3097
3038
  break;
3098
3039
 
3099
3040
  case 78:
3100
- #line 891 "pl_gram.y"
3041
+ #line 862 "pl_gram.y"
3101
3042
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3102
3043
  break;
3103
3044
 
3104
3045
  case 79:
3105
- #line 893 "pl_gram.y"
3046
+ #line 864 "pl_gram.y"
3106
3047
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3107
3048
  break;
3108
3049
 
3109
3050
  case 80:
3110
- #line 895 "pl_gram.y"
3051
+ #line 866 "pl_gram.y"
3111
3052
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3112
3053
  break;
3113
3054
 
3114
3055
  case 81:
3115
- #line 897 "pl_gram.y"
3056
+ #line 868 "pl_gram.y"
3116
3057
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3117
3058
  break;
3118
3059
 
3119
3060
  case 82:
3120
- #line 899 "pl_gram.y"
3061
+ #line 870 "pl_gram.y"
3121
3062
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3122
3063
  break;
3123
3064
 
3124
3065
  case 83:
3125
- #line 901 "pl_gram.y"
3066
+ #line 872 "pl_gram.y"
3126
3067
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3127
3068
  break;
3128
3069
 
3129
3070
  case 84:
3130
- #line 903 "pl_gram.y"
3071
+ #line 874 "pl_gram.y"
3131
3072
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3132
3073
  break;
3133
3074
 
3134
3075
  case 85:
3135
- #line 905 "pl_gram.y"
3136
- { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3137
- break;
3138
-
3139
- case 86:
3140
- #line 909 "pl_gram.y"
3076
+ #line 878 "pl_gram.y"
3141
3077
  {
3142
3078
  PLpgSQL_stmt_perform *new;
3079
+ int startloc;
3143
3080
 
3144
3081
  new = palloc0(sizeof(PLpgSQL_stmt_perform));
3145
3082
  new->cmd_type = PLPGSQL_STMT_PERFORM;
3146
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (2)]));
3083
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
3147
3084
  new->stmtid = ++plpgsql_curr_compile->nstatements;
3148
- new->expr = (yyvsp[(2) - (2)].expr);
3085
+ plpgsql_push_back_token(K_PERFORM);
3149
3086
 
3150
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3087
+ /*
3088
+ * Since PERFORM isn't legal SQL, we have to cheat to
3089
+ * the extent of substituting "SELECT" for "PERFORM"
3090
+ * in the parsed text. It does not seem worth
3091
+ * inventing a separate parse mode for this one case.
3092
+ * We can't do syntax-checking until after we make the
3093
+ * substitution.
3094
+ */
3095
+ new->expr = read_sql_construct(';', 0, 0, ";",
3096
+ RAW_PARSE_DEFAULT,
3097
+ false, false,
3098
+ &startloc, NULL);
3099
+ /* overwrite "perform" ... */
3100
+ memcpy(new->expr->query, " SELECT", 7);
3101
+ /* left-justify to get rid of the leading space */
3102
+ memmove(new->expr->query, new->expr->query + 1,
3103
+ strlen(new->expr->query));
3104
+ /* offset syntax error position to account for that */
3105
+ check_sql_expr(new->expr->query, new->expr->parseMode,
3106
+ startloc + 1);
3107
+
3108
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3151
3109
  ;}
3152
3110
  break;
3153
3111
 
3154
- case 87:
3155
- #line 923 "pl_gram.y"
3112
+ case 86:
3113
+ #line 914 "pl_gram.y"
3156
3114
  {
3157
3115
  PLpgSQL_stmt_call *new;
3158
3116
 
@@ -3160,16 +3118,20 @@ yyreduce:
3160
3118
  new->cmd_type = PLPGSQL_STMT_CALL;
3161
3119
  new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
3162
3120
  new->stmtid = ++plpgsql_curr_compile->nstatements;
3163
- new->expr = read_sql_stmt("CALL ");
3121
+ plpgsql_push_back_token(K_CALL);
3122
+ new->expr = read_sql_stmt();
3164
3123
  new->is_call = true;
3165
3124
 
3166
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3125
+ /* Remember we may need a procedure resource owner */
3126
+ plpgsql_curr_compile->requires_procedure_resowner = true;
3127
+
3128
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3167
3129
 
3168
3130
  ;}
3169
3131
  break;
3170
3132
 
3171
- case 88:
3172
- #line 937 "pl_gram.y"
3133
+ case 87:
3134
+ #line 932 "pl_gram.y"
3173
3135
  {
3174
3136
  /* use the same structures as for CALL, for simplicity */
3175
3137
  PLpgSQL_stmt_call *new;
@@ -3178,40 +3140,68 @@ yyreduce:
3178
3140
  new->cmd_type = PLPGSQL_STMT_CALL;
3179
3141
  new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
3180
3142
  new->stmtid = ++plpgsql_curr_compile->nstatements;
3181
- new->expr = read_sql_stmt("DO ");
3143
+ plpgsql_push_back_token(K_DO);
3144
+ new->expr = read_sql_stmt();
3182
3145
  new->is_call = false;
3183
3146
 
3184
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3147
+ /* Remember we may need a procedure resource owner */
3148
+ plpgsql_curr_compile->requires_procedure_resowner = true;
3149
+
3150
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3185
3151
 
3186
3152
  ;}
3187
3153
  break;
3188
3154
 
3189
- case 89:
3190
- #line 954 "pl_gram.y"
3155
+ case 88:
3156
+ #line 953 "pl_gram.y"
3191
3157
  {
3192
3158
  PLpgSQL_stmt_assign *new;
3159
+ RawParseMode pmode;
3160
+
3161
+ /* see how many names identify the datum */
3162
+ switch ((yyvsp[(1) - (1)].wdatum).ident ? 1 : list_length((yyvsp[(1) - (1)].wdatum).idents))
3163
+ {
3164
+ case 1:
3165
+ pmode = RAW_PARSE_PLPGSQL_ASSIGN1;
3166
+ break;
3167
+ case 2:
3168
+ pmode = RAW_PARSE_PLPGSQL_ASSIGN2;
3169
+ break;
3170
+ case 3:
3171
+ pmode = RAW_PARSE_PLPGSQL_ASSIGN3;
3172
+ break;
3173
+ default:
3174
+ elog(ERROR, "unexpected number of names");
3175
+ pmode = 0; /* keep compiler quiet */
3176
+ }
3193
3177
 
3178
+ check_assignable((yyvsp[(1) - (1)].wdatum).datum, (yylsp[(1) - (1)]));
3194
3179
  new = palloc0(sizeof(PLpgSQL_stmt_assign));
3195
3180
  new->cmd_type = PLPGSQL_STMT_ASSIGN;
3196
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (3)]));
3181
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
3197
3182
  new->stmtid = ++plpgsql_curr_compile->nstatements;
3198
- new->varno = (yyvsp[(1) - (3)].datum)->dno;
3199
- new->expr = (yyvsp[(3) - (3)].expr);
3183
+ new->varno = (yyvsp[(1) - (1)].wdatum).datum->dno;
3184
+ /* Push back the head name to include it in the stmt */
3185
+ plpgsql_push_back_token(T_DATUM);
3186
+ new->expr = read_sql_construct(';', 0, 0, ";",
3187
+ pmode,
3188
+ false, true,
3189
+ NULL, NULL);
3200
3190
 
3201
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3191
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3202
3192
  ;}
3203
3193
  break;
3204
3194
 
3205
- case 90:
3206
- #line 969 "pl_gram.y"
3195
+ case 89:
3196
+ #line 992 "pl_gram.y"
3207
3197
  {
3208
- PLpgSQL_stmt_getdiag *new;
3209
- ListCell *lc;
3198
+ PLpgSQL_stmt_getdiag *new;
3199
+ ListCell *lc;
3210
3200
 
3211
3201
  new = palloc0(sizeof(PLpgSQL_stmt_getdiag));
3212
3202
  new->cmd_type = PLPGSQL_STMT_GETDIAG;
3213
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (5)]));
3214
- new->stmtid = ++plpgsql_curr_compile->nstatements;
3203
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (5)]));
3204
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3215
3205
  new->is_stacked = (yyvsp[(2) - (5)].boolean);
3216
3206
  new->diag_items = (yyvsp[(4) - (5)].list);
3217
3207
 
@@ -3226,6 +3216,7 @@ yyreduce:
3226
3216
  {
3227
3217
  /* these fields are disallowed in stacked case */
3228
3218
  case PLPGSQL_GETDIAG_ROW_COUNT:
3219
+ case PLPGSQL_GETDIAG_ROUTINE_OID:
3229
3220
  if (new->is_stacked)
3230
3221
  ereport(ERROR,
3231
3222
  (errcode(ERRCODE_SYNTAX_ERROR),
@@ -3261,47 +3252,47 @@ yyreduce:
3261
3252
  }
3262
3253
  }
3263
3254
 
3264
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3255
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3265
3256
  ;}
3266
3257
  break;
3267
3258
 
3268
- case 91:
3269
- #line 1031 "pl_gram.y"
3259
+ case 90:
3260
+ #line 1055 "pl_gram.y"
3270
3261
  {
3271
3262
  (yyval.boolean) = false;
3272
3263
  ;}
3273
3264
  break;
3274
3265
 
3275
- case 92:
3276
- #line 1035 "pl_gram.y"
3266
+ case 91:
3267
+ #line 1059 "pl_gram.y"
3277
3268
  {
3278
3269
  (yyval.boolean) = false;
3279
3270
  ;}
3280
3271
  break;
3281
3272
 
3282
- case 93:
3283
- #line 1039 "pl_gram.y"
3273
+ case 92:
3274
+ #line 1063 "pl_gram.y"
3284
3275
  {
3285
3276
  (yyval.boolean) = true;
3286
3277
  ;}
3287
3278
  break;
3288
3279
 
3289
- case 94:
3290
- #line 1045 "pl_gram.y"
3280
+ case 93:
3281
+ #line 1069 "pl_gram.y"
3291
3282
  {
3292
3283
  (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].diagitem));
3293
3284
  ;}
3294
3285
  break;
3295
3286
 
3296
- case 95:
3297
- #line 1049 "pl_gram.y"
3287
+ case 94:
3288
+ #line 1073 "pl_gram.y"
3298
3289
  {
3299
3290
  (yyval.list) = list_make1((yyvsp[(1) - (1)].diagitem));
3300
3291
  ;}
3301
3292
  break;
3302
3293
 
3303
- case 96:
3304
- #line 1055 "pl_gram.y"
3294
+ case 95:
3295
+ #line 1079 "pl_gram.y"
3305
3296
  {
3306
3297
  PLpgSQL_diag_item *new;
3307
3298
 
@@ -3313,14 +3304,17 @@ yyreduce:
3313
3304
  ;}
3314
3305
  break;
3315
3306
 
3316
- case 97:
3317
- #line 1067 "pl_gram.y"
3307
+ case 96:
3308
+ #line 1091 "pl_gram.y"
3318
3309
  {
3319
- int tok = yylex();
3310
+ int tok = yylex();
3320
3311
 
3321
3312
  if (tok_is_keyword(tok, &yylval,
3322
3313
  K_ROW_COUNT, "row_count"))
3323
3314
  (yyval.ival) = PLPGSQL_GETDIAG_ROW_COUNT;
3315
+ else if (tok_is_keyword(tok, &yylval,
3316
+ K_PG_ROUTINE_OID, "pg_routine_oid"))
3317
+ (yyval.ival) = PLPGSQL_GETDIAG_ROUTINE_OID;
3324
3318
  else if (tok_is_keyword(tok, &yylval,
3325
3319
  K_PG_CONTEXT, "pg_context"))
3326
3320
  (yyval.ival) = PLPGSQL_GETDIAG_CONTEXT;
@@ -3359,127 +3353,108 @@ yyreduce:
3359
3353
  ;}
3360
3354
  break;
3361
3355
 
3362
- case 98:
3363
- #line 1112 "pl_gram.y"
3356
+ case 97:
3357
+ #line 1139 "pl_gram.y"
3364
3358
  {
3365
- if ((yyvsp[(1) - (1)].datum)->dtype == PLPGSQL_DTYPE_ROW ||
3366
- (yyvsp[(1) - (1)].datum)->dtype == PLPGSQL_DTYPE_REC)
3359
+ /*
3360
+ * In principle we should support a getdiag_target
3361
+ * that is an array element, but for now we don't, so
3362
+ * just throw an error if next token is '['.
3363
+ */
3364
+ if ((yyvsp[(1) - (1)].wdatum).datum->dtype == PLPGSQL_DTYPE_ROW ||
3365
+ (yyvsp[(1) - (1)].wdatum).datum->dtype == PLPGSQL_DTYPE_REC ||
3366
+ plpgsql_peek() == '[')
3367
3367
  ereport(ERROR,
3368
3368
  (errcode(ERRCODE_SYNTAX_ERROR),
3369
3369
  errmsg("\"%s\" is not a scalar variable",
3370
- ((PLpgSQL_variable *) (yyvsp[(1) - (1)].datum))->refname),
3370
+ NameOfDatum(&((yyvsp[(1) - (1)].wdatum)))),
3371
3371
  parser_errposition((yylsp[(1) - (1)]))));
3372
- (yyval.datum) = (yyvsp[(1) - (1)].datum);
3372
+ check_assignable((yyvsp[(1) - (1)].wdatum).datum, (yylsp[(1) - (1)]));
3373
+ (yyval.datum) = (yyvsp[(1) - (1)].wdatum).datum;
3373
3374
  ;}
3374
3375
  break;
3375
3376
 
3376
- case 99:
3377
- #line 1123 "pl_gram.y"
3377
+ case 98:
3378
+ #line 1157 "pl_gram.y"
3378
3379
  {
3379
3380
  /* just to give a better message than "syntax error" */
3380
3381
  word_is_not_variable(&((yyvsp[(1) - (1)].word)), (yylsp[(1) - (1)]));
3381
3382
  ;}
3382
3383
  break;
3383
3384
 
3384
- case 100:
3385
- #line 1128 "pl_gram.y"
3385
+ case 99:
3386
+ #line 1162 "pl_gram.y"
3386
3387
  {
3387
3388
  /* just to give a better message than "syntax error" */
3388
3389
  cword_is_not_variable(&((yyvsp[(1) - (1)].cword)), (yylsp[(1) - (1)]));
3389
3390
  ;}
3390
3391
  break;
3391
3392
 
3392
- case 101:
3393
- #line 1136 "pl_gram.y"
3394
- {
3395
- check_assignable((yyvsp[(1) - (1)].wdatum).datum, (yylsp[(1) - (1)]));
3396
- (yyval.datum) = (yyvsp[(1) - (1)].wdatum).datum;
3397
- ;}
3398
- break;
3399
-
3400
- case 102:
3401
- #line 1141 "pl_gram.y"
3402
- {
3403
- PLpgSQL_arrayelem *new;
3404
-
3405
- new = palloc0(sizeof(PLpgSQL_arrayelem));
3406
- new->dtype = PLPGSQL_DTYPE_ARRAYELEM;
3407
- new->subscript = (yyvsp[(3) - (3)].expr);
3408
- new->arrayparentno = (yyvsp[(1) - (3)].datum)->dno;
3409
- /* initialize cached type data to "not valid" */
3410
- new->parenttypoid = InvalidOid;
3411
-
3412
- plpgsql_adddatum((PLpgSQL_datum *) new);
3413
-
3414
- (yyval.datum) = (PLpgSQL_datum *) new;
3415
- ;}
3416
- break;
3417
-
3418
- case 103:
3419
- #line 1158 "pl_gram.y"
3393
+ case 100:
3394
+ #line 1169 "pl_gram.y"
3420
3395
  {
3421
3396
  PLpgSQL_stmt_if *new;
3422
3397
 
3423
3398
  new = palloc0(sizeof(PLpgSQL_stmt_if));
3424
- new->cmd_type = PLPGSQL_STMT_IF;
3425
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (8)]));
3426
- new->stmtid = ++plpgsql_curr_compile->nstatements;
3427
- new->cond = (yyvsp[(2) - (8)].expr);
3428
- new->then_body = (yyvsp[(3) - (8)].list);
3399
+ new->cmd_type = PLPGSQL_STMT_IF;
3400
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (8)]));
3401
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3402
+ new->cond = (yyvsp[(2) - (8)].expr);
3403
+ new->then_body = (yyvsp[(3) - (8)].list);
3429
3404
  new->elsif_list = (yyvsp[(4) - (8)].list);
3430
- new->else_body = (yyvsp[(5) - (8)].list);
3405
+ new->else_body = (yyvsp[(5) - (8)].list);
3431
3406
 
3432
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3407
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3433
3408
  ;}
3434
3409
  break;
3435
3410
 
3436
- case 104:
3437
- #line 1175 "pl_gram.y"
3411
+ case 101:
3412
+ #line 1186 "pl_gram.y"
3438
3413
  {
3439
3414
  (yyval.list) = NIL;
3440
3415
  ;}
3441
3416
  break;
3442
3417
 
3443
- case 105:
3444
- #line 1179 "pl_gram.y"
3418
+ case 102:
3419
+ #line 1190 "pl_gram.y"
3445
3420
  {
3446
3421
  PLpgSQL_if_elsif *new;
3447
3422
 
3448
3423
  new = palloc0(sizeof(PLpgSQL_if_elsif));
3449
3424
  new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3450
- new->cond = (yyvsp[(3) - (4)].expr);
3451
- new->stmts = (yyvsp[(4) - (4)].list);
3425
+ new->cond = (yyvsp[(3) - (4)].expr);
3426
+ new->stmts = (yyvsp[(4) - (4)].list);
3452
3427
 
3453
3428
  (yyval.list) = lappend((yyvsp[(1) - (4)].list), new);
3454
3429
  ;}
3455
3430
  break;
3456
3431
 
3457
- case 106:
3458
- #line 1192 "pl_gram.y"
3432
+ case 103:
3433
+ #line 1203 "pl_gram.y"
3459
3434
  {
3460
3435
  (yyval.list) = NIL;
3461
3436
  ;}
3462
3437
  break;
3463
3438
 
3464
- case 107:
3465
- #line 1196 "pl_gram.y"
3439
+ case 104:
3440
+ #line 1207 "pl_gram.y"
3466
3441
  {
3467
3442
  (yyval.list) = (yyvsp[(2) - (2)].list);
3468
3443
  ;}
3469
3444
  break;
3470
3445
 
3471
- case 108:
3472
- #line 1202 "pl_gram.y"
3446
+ case 105:
3447
+ #line 1213 "pl_gram.y"
3473
3448
  {
3474
3449
  (yyval.stmt) = make_case((yylsp[(1) - (7)]), (yyvsp[(2) - (7)].expr), (yyvsp[(3) - (7)].list), (yyvsp[(4) - (7)].list));
3475
3450
  ;}
3476
3451
  break;
3477
3452
 
3478
- case 109:
3479
- #line 1208 "pl_gram.y"
3453
+ case 106:
3454
+ #line 1219 "pl_gram.y"
3480
3455
  {
3481
3456
  PLpgSQL_expr *expr = NULL;
3482
- int tok = yylex();
3457
+ int tok = yylex();
3483
3458
 
3484
3459
  if (tok != K_WHEN)
3485
3460
  {
@@ -3491,41 +3466,41 @@ yyreduce:
3491
3466
  ;}
3492
3467
  break;
3493
3468
 
3494
- case 110:
3495
- #line 1223 "pl_gram.y"
3469
+ case 107:
3470
+ #line 1234 "pl_gram.y"
3496
3471
  {
3497
3472
  (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].casewhen));
3498
3473
  ;}
3499
3474
  break;
3500
3475
 
3501
- case 111:
3502
- #line 1227 "pl_gram.y"
3476
+ case 108:
3477
+ #line 1238 "pl_gram.y"
3503
3478
  {
3504
3479
  (yyval.list) = list_make1((yyvsp[(1) - (1)].casewhen));
3505
3480
  ;}
3506
3481
  break;
3507
3482
 
3508
- case 112:
3509
- #line 1233 "pl_gram.y"
3483
+ case 109:
3484
+ #line 1244 "pl_gram.y"
3510
3485
  {
3511
3486
  PLpgSQL_case_when *new = palloc(sizeof(PLpgSQL_case_when));
3512
3487
 
3513
3488
  new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (3)]));
3514
- new->expr = (yyvsp[(2) - (3)].expr);
3515
- new->stmts = (yyvsp[(3) - (3)].list);
3489
+ new->expr = (yyvsp[(2) - (3)].expr);
3490
+ new->stmts = (yyvsp[(3) - (3)].list);
3516
3491
  (yyval.casewhen) = new;
3517
3492
  ;}
3518
3493
  break;
3519
3494
 
3520
- case 113:
3521
- #line 1244 "pl_gram.y"
3495
+ case 110:
3496
+ #line 1255 "pl_gram.y"
3522
3497
  {
3523
3498
  (yyval.list) = NIL;
3524
3499
  ;}
3525
3500
  break;
3526
3501
 
3527
- case 114:
3528
- #line 1248 "pl_gram.y"
3502
+ case 111:
3503
+ #line 1259 "pl_gram.y"
3529
3504
  {
3530
3505
  /*
3531
3506
  * proc_sect could return an empty list, but we
@@ -3540,71 +3515,71 @@ yyreduce:
3540
3515
  ;}
3541
3516
  break;
3542
3517
 
3543
- case 115:
3544
- #line 1263 "pl_gram.y"
3518
+ case 112:
3519
+ #line 1274 "pl_gram.y"
3545
3520
  {
3546
3521
  PLpgSQL_stmt_loop *new;
3547
3522
 
3548
3523
  new = palloc0(sizeof(PLpgSQL_stmt_loop));
3549
3524
  new->cmd_type = PLPGSQL_STMT_LOOP;
3550
- new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (3)]));
3551
- new->stmtid = ++plpgsql_curr_compile->nstatements;
3552
- new->label = (yyvsp[(1) - (3)].str);
3553
- new->body = (yyvsp[(3) - (3)].loop_body).stmts;
3525
+ new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (3)]));
3526
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3527
+ new->label = (yyvsp[(1) - (3)].str);
3528
+ new->body = (yyvsp[(3) - (3)].loop_body).stmts;
3554
3529
 
3555
3530
  check_labels((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].loop_body).end_label, (yyvsp[(3) - (3)].loop_body).end_label_location);
3556
3531
  plpgsql_ns_pop();
3557
3532
 
3558
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3533
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3559
3534
  ;}
3560
3535
  break;
3561
3536
 
3562
- case 116:
3563
- #line 1281 "pl_gram.y"
3537
+ case 113:
3538
+ #line 1292 "pl_gram.y"
3564
3539
  {
3565
3540
  PLpgSQL_stmt_while *new;
3566
3541
 
3567
3542
  new = palloc0(sizeof(PLpgSQL_stmt_while));
3568
3543
  new->cmd_type = PLPGSQL_STMT_WHILE;
3569
- new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3570
- new->stmtid = ++plpgsql_curr_compile->nstatements;
3571
- new->label = (yyvsp[(1) - (4)].str);
3572
- new->cond = (yyvsp[(3) - (4)].expr);
3573
- new->body = (yyvsp[(4) - (4)].loop_body).stmts;
3544
+ new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3545
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3546
+ new->label = (yyvsp[(1) - (4)].str);
3547
+ new->cond = (yyvsp[(3) - (4)].expr);
3548
+ new->body = (yyvsp[(4) - (4)].loop_body).stmts;
3574
3549
 
3575
3550
  check_labels((yyvsp[(1) - (4)].str), (yyvsp[(4) - (4)].loop_body).end_label, (yyvsp[(4) - (4)].loop_body).end_label_location);
3576
3551
  plpgsql_ns_pop();
3577
3552
 
3578
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3553
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3579
3554
  ;}
3580
3555
  break;
3581
3556
 
3582
- case 117:
3583
- #line 1300 "pl_gram.y"
3557
+ case 114:
3558
+ #line 1311 "pl_gram.y"
3584
3559
  {
3585
3560
  /* This runs after we've scanned the loop body */
3586
3561
  if ((yyvsp[(3) - (4)].stmt)->cmd_type == PLPGSQL_STMT_FORI)
3587
3562
  {
3588
- PLpgSQL_stmt_fori *new;
3563
+ PLpgSQL_stmt_fori *new;
3589
3564
 
3590
3565
  new = (PLpgSQL_stmt_fori *) (yyvsp[(3) - (4)].stmt);
3591
- new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3592
- new->label = (yyvsp[(1) - (4)].str);
3593
- new->body = (yyvsp[(4) - (4)].loop_body).stmts;
3566
+ new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3567
+ new->label = (yyvsp[(1) - (4)].str);
3568
+ new->body = (yyvsp[(4) - (4)].loop_body).stmts;
3594
3569
  (yyval.stmt) = (PLpgSQL_stmt *) new;
3595
3570
  }
3596
3571
  else
3597
3572
  {
3598
- PLpgSQL_stmt_forq *new;
3573
+ PLpgSQL_stmt_forq *new;
3599
3574
 
3600
3575
  Assert((yyvsp[(3) - (4)].stmt)->cmd_type == PLPGSQL_STMT_FORS ||
3601
3576
  (yyvsp[(3) - (4)].stmt)->cmd_type == PLPGSQL_STMT_FORC ||
3602
3577
  (yyvsp[(3) - (4)].stmt)->cmd_type == PLPGSQL_STMT_DYNFORS);
3603
3578
  /* forq is the common supertype of all three */
3604
3579
  new = (PLpgSQL_stmt_forq *) (yyvsp[(3) - (4)].stmt);
3605
- new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3606
- new->label = (yyvsp[(1) - (4)].str);
3607
- new->body = (yyvsp[(4) - (4)].loop_body).stmts;
3580
+ new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3581
+ new->label = (yyvsp[(1) - (4)].str);
3582
+ new->body = (yyvsp[(4) - (4)].loop_body).stmts;
3608
3583
  (yyval.stmt) = (PLpgSQL_stmt *) new;
3609
3584
  }
3610
3585
 
@@ -3614,8 +3589,8 @@ yyreduce:
3614
3589
  ;}
3615
3590
  break;
3616
3591
 
3617
- case 118:
3618
- #line 1334 "pl_gram.y"
3592
+ case 115:
3593
+ #line 1345 "pl_gram.y"
3619
3594
  {
3620
3595
  int tok = yylex();
3621
3596
  int tokloc = yylloc;
@@ -3623,9 +3598,9 @@ yyreduce:
3623
3598
  if (tok == K_EXECUTE)
3624
3599
  {
3625
3600
  /* EXECUTE means it's a dynamic FOR loop */
3626
- PLpgSQL_stmt_dynfors *new;
3627
- PLpgSQL_expr *expr;
3628
- int term;
3601
+ PLpgSQL_stmt_dynfors *new;
3602
+ PLpgSQL_expr *expr;
3603
+ int term;
3629
3604
 
3630
3605
  expr = read_sql_expression2(K_LOOP, K_USING,
3631
3606
  "LOOP or USING",
@@ -3633,7 +3608,7 @@ yyreduce:
3633
3608
 
3634
3609
  new = palloc0(sizeof(PLpgSQL_stmt_dynfors));
3635
3610
  new->cmd_type = PLPGSQL_STMT_DYNFORS;
3636
- new->stmtid = ++plpgsql_curr_compile->nstatements;
3611
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3637
3612
  if ((yyvsp[(1) - (2)].forvariable).row)
3638
3613
  {
3639
3614
  new->var = (PLpgSQL_variable *) (yyvsp[(1) - (2)].forvariable).row;
@@ -3674,8 +3649,8 @@ yyreduce:
3674
3649
  ((PLpgSQL_var *) yylval.wdatum.datum)->datatype->typoid == REFCURSOROID)
3675
3650
  {
3676
3651
  /* It's FOR var IN cursor */
3677
- PLpgSQL_stmt_forc *new;
3678
- PLpgSQL_var *cursor = (PLpgSQL_var *) yylval.wdatum.datum;
3652
+ PLpgSQL_stmt_forc *new;
3653
+ PLpgSQL_var *cursor = (PLpgSQL_var *) yylval.wdatum.datum;
3679
3654
 
3680
3655
  new = (PLpgSQL_stmt_forc *) palloc0(sizeof(PLpgSQL_stmt_forc));
3681
3656
  new->cmd_type = PLPGSQL_STMT_FORC;
@@ -3698,8 +3673,7 @@ yyreduce:
3698
3673
 
3699
3674
  /* collect cursor's parameters if any */
3700
3675
  new->argquery = read_cursor_args(cursor,
3701
- K_LOOP,
3702
- "LOOP");
3676
+ K_LOOP);
3703
3677
 
3704
3678
  /* create loop's private RECORD variable */
3705
3679
  new->var = (PLpgSQL_variable *)
@@ -3713,9 +3687,9 @@ yyreduce:
3713
3687
  }
3714
3688
  else
3715
3689
  {
3716
- PLpgSQL_expr *expr1;
3717
- int expr1loc;
3718
- bool reverse = false;
3690
+ PLpgSQL_expr *expr1;
3691
+ int expr1loc;
3692
+ bool reverse = false;
3719
3693
 
3720
3694
  /*
3721
3695
  * We have to distinguish between two
@@ -3737,32 +3711,36 @@ yyreduce:
3737
3711
 
3738
3712
  /*
3739
3713
  * Read tokens until we see either a ".."
3740
- * or a LOOP. The text we read may not
3741
- * necessarily be a well-formed SQL
3742
- * statement, so we need to invoke
3743
- * read_sql_construct directly.
3714
+ * or a LOOP. The text we read may be either
3715
+ * an expression or a whole SQL statement, so
3716
+ * we need to invoke read_sql_construct directly,
3717
+ * and tell it not to check syntax yet.
3744
3718
  */
3745
3719
  expr1 = read_sql_construct(DOT_DOT,
3746
3720
  K_LOOP,
3747
3721
  0,
3748
3722
  "LOOP",
3749
- "SELECT ",
3723
+ RAW_PARSE_DEFAULT,
3750
3724
  true,
3751
3725
  false,
3752
- true,
3753
3726
  &expr1loc,
3754
3727
  &tok);
3755
3728
 
3756
3729
  if (tok == DOT_DOT)
3757
3730
  {
3758
3731
  /* Saw "..", so it must be an integer loop */
3759
- PLpgSQL_expr *expr2;
3760
- PLpgSQL_expr *expr_by;
3761
- PLpgSQL_var *fvar;
3762
- PLpgSQL_stmt_fori *new;
3732
+ PLpgSQL_expr *expr2;
3733
+ PLpgSQL_expr *expr_by;
3734
+ PLpgSQL_var *fvar;
3735
+ PLpgSQL_stmt_fori *new;
3763
3736
 
3764
- /* Check first expression is well-formed */
3765
- check_sql_expr(expr1->query, expr1loc, 7);
3737
+ /*
3738
+ * Relabel first expression as an expression;
3739
+ * then we can check its syntax.
3740
+ */
3741
+ expr1->parseMode = RAW_PARSE_PLPGSQL_EXPR;
3742
+ check_sql_expr(expr1->query, expr1->parseMode,
3743
+ expr1loc);
3766
3744
 
3767
3745
  /* Read and check the second one */
3768
3746
  expr2 = read_sql_expression2(K_LOOP, K_BY,
@@ -3795,25 +3773,21 @@ yyreduce:
3795
3773
 
3796
3774
  new = palloc0(sizeof(PLpgSQL_stmt_fori));
3797
3775
  new->cmd_type = PLPGSQL_STMT_FORI;
3798
- new->stmtid = ++plpgsql_curr_compile->nstatements;
3799
- new->var = fvar;
3800
- new->reverse = reverse;
3801
- new->lower = expr1;
3802
- new->upper = expr2;
3803
- new->step = expr_by;
3776
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3777
+ new->var = fvar;
3778
+ new->reverse = reverse;
3779
+ new->lower = expr1;
3780
+ new->upper = expr2;
3781
+ new->step = expr_by;
3804
3782
 
3805
3783
  (yyval.stmt) = (PLpgSQL_stmt *) new;
3806
3784
  }
3807
3785
  else
3808
3786
  {
3809
3787
  /*
3810
- * No "..", so it must be a query loop. We've
3811
- * prefixed an extra SELECT to the query text,
3812
- * so we need to remove that before performing
3813
- * syntax checking.
3788
+ * No "..", so it must be a query loop.
3814
3789
  */
3815
- char *tmp_query;
3816
- PLpgSQL_stmt_fors *new;
3790
+ PLpgSQL_stmt_fors *new;
3817
3791
 
3818
3792
  if (reverse)
3819
3793
  ereport(ERROR,
@@ -3821,12 +3795,9 @@ yyreduce:
3821
3795
  errmsg("cannot specify REVERSE in query FOR loop"),
3822
3796
  parser_errposition(tokloc)));
3823
3797
 
3824
- Assert(strncmp(expr1->query, "SELECT ", 7) == 0);
3825
- tmp_query = pstrdup(expr1->query + 7);
3826
- pfree(expr1->query);
3827
- expr1->query = tmp_query;
3828
-
3829
- check_sql_expr(expr1->query, expr1loc, 0);
3798
+ /* Check syntax as a regular query */
3799
+ check_sql_expr(expr1->query, expr1->parseMode,
3800
+ expr1loc);
3830
3801
 
3831
3802
  new = palloc0(sizeof(PLpgSQL_stmt_fors));
3832
3803
  new->cmd_type = PLPGSQL_STMT_FORS;
@@ -3859,8 +3830,8 @@ yyreduce:
3859
3830
  ;}
3860
3831
  break;
3861
3832
 
3862
- case 119:
3863
- #line 1596 "pl_gram.y"
3833
+ case 116:
3834
+ #line 1603 "pl_gram.y"
3864
3835
  {
3865
3836
  (yyval.forvariable).name = NameOfDatum(&((yyvsp[(1) - (1)].wdatum)));
3866
3837
  (yyval.forvariable).lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
@@ -3888,8 +3859,8 @@ yyreduce:
3888
3859
  ;}
3889
3860
  break;
3890
3861
 
3891
- case 120:
3892
- #line 1622 "pl_gram.y"
3862
+ case 117:
3863
+ #line 1629 "pl_gram.y"
3893
3864
  {
3894
3865
  int tok;
3895
3866
 
@@ -3905,16 +3876,16 @@ yyreduce:
3905
3876
  ;}
3906
3877
  break;
3907
3878
 
3908
- case 121:
3909
- #line 1636 "pl_gram.y"
3879
+ case 118:
3880
+ #line 1643 "pl_gram.y"
3910
3881
  {
3911
3882
  /* just to give a better message than "syntax error" */
3912
3883
  cword_is_not_variable(&((yyvsp[(1) - (1)].cword)), (yylsp[(1) - (1)]));
3913
3884
  ;}
3914
3885
  break;
3915
3886
 
3916
- case 122:
3917
- #line 1643 "pl_gram.y"
3887
+ case 119:
3888
+ #line 1650 "pl_gram.y"
3918
3889
  {
3919
3890
  PLpgSQL_stmt_foreach_a *new;
3920
3891
 
@@ -3952,32 +3923,32 @@ yyreduce:
3952
3923
  ;}
3953
3924
  break;
3954
3925
 
3955
- case 123:
3956
- #line 1681 "pl_gram.y"
3926
+ case 120:
3927
+ #line 1688 "pl_gram.y"
3957
3928
  {
3958
3929
  (yyval.ival) = 0;
3959
3930
  ;}
3960
3931
  break;
3961
3932
 
3962
- case 124:
3963
- #line 1685 "pl_gram.y"
3933
+ case 121:
3934
+ #line 1692 "pl_gram.y"
3964
3935
  {
3965
3936
  (yyval.ival) = (yyvsp[(2) - (2)].ival);
3966
3937
  ;}
3967
3938
  break;
3968
3939
 
3969
- case 125:
3970
- #line 1691 "pl_gram.y"
3940
+ case 122:
3941
+ #line 1698 "pl_gram.y"
3971
3942
  {
3972
3943
  PLpgSQL_stmt_exit *new;
3973
3944
 
3974
3945
  new = palloc0(sizeof(PLpgSQL_stmt_exit));
3975
3946
  new->cmd_type = PLPGSQL_STMT_EXIT;
3976
- new->stmtid = ++plpgsql_curr_compile->nstatements;
3977
- new->is_exit = (yyvsp[(1) - (3)].boolean);
3978
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (3)]));
3979
- new->label = (yyvsp[(2) - (3)].str);
3980
- new->cond = (yyvsp[(3) - (3)].expr);
3947
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3948
+ new->is_exit = (yyvsp[(1) - (3)].boolean);
3949
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (3)]));
3950
+ new->label = (yyvsp[(2) - (3)].str);
3951
+ new->cond = (yyvsp[(3) - (3)].expr);
3981
3952
 
3982
3953
  if ((yyvsp[(2) - (3)].str))
3983
3954
  {
@@ -4016,28 +3987,28 @@ yyreduce:
4016
3987
  parser_errposition((yylsp[(1) - (3)]))));
4017
3988
  }
4018
3989
 
4019
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3990
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4020
3991
  ;}
4021
3992
  break;
4022
3993
 
4023
- case 126:
4024
- #line 1744 "pl_gram.y"
3994
+ case 123:
3995
+ #line 1751 "pl_gram.y"
4025
3996
  {
4026
3997
  (yyval.boolean) = true;
4027
3998
  ;}
4028
3999
  break;
4029
4000
 
4030
- case 127:
4031
- #line 1748 "pl_gram.y"
4001
+ case 124:
4002
+ #line 1755 "pl_gram.y"
4032
4003
  {
4033
4004
  (yyval.boolean) = false;
4034
4005
  ;}
4035
4006
  break;
4036
4007
 
4037
- case 128:
4038
- #line 1754 "pl_gram.y"
4008
+ case 125:
4009
+ #line 1761 "pl_gram.y"
4039
4010
  {
4040
- int tok;
4011
+ int tok;
4041
4012
 
4042
4013
  tok = yylex();
4043
4014
  if (tok == 0)
@@ -4061,22 +4032,22 @@ yyreduce:
4061
4032
  ;}
4062
4033
  break;
4063
4034
 
4064
- case 129:
4065
- #line 1780 "pl_gram.y"
4035
+ case 126:
4036
+ #line 1787 "pl_gram.y"
4066
4037
  {
4067
- PLpgSQL_stmt_raise *new;
4068
- int tok;
4038
+ PLpgSQL_stmt_raise *new;
4039
+ int tok;
4069
4040
 
4070
4041
  new = palloc(sizeof(PLpgSQL_stmt_raise));
4071
4042
 
4072
- new->cmd_type = PLPGSQL_STMT_RAISE;
4073
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4074
- new->stmtid = ++plpgsql_curr_compile->nstatements;
4043
+ new->cmd_type = PLPGSQL_STMT_RAISE;
4044
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4045
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
4075
4046
  new->elog_level = ERROR; /* default */
4076
- new->condname = NULL;
4077
- new->message = NULL;
4078
- new->params = NIL;
4079
- new->options = NIL;
4047
+ new->condname = NULL;
4048
+ new->message = NULL;
4049
+ new->params = NIL;
4050
+ new->options = NIL;
4080
4051
 
4081
4052
  tok = yylex();
4082
4053
  if (tok == 0)
@@ -4156,8 +4127,8 @@ yyreduce:
4156
4127
 
4157
4128
  expr = read_sql_construct(',', ';', K_USING,
4158
4129
  ", or ; or USING",
4159
- "SELECT ",
4160
- true, true, true,
4130
+ RAW_PARSE_PLPGSQL_EXPR,
4131
+ true, true,
4161
4132
  NULL, &tok);
4162
4133
  new->params = lappend(new->params, expr);
4163
4134
  }
@@ -4169,7 +4140,7 @@ yyreduce:
4169
4140
  K_SQLSTATE, "sqlstate"))
4170
4141
  {
4171
4142
  /* next token should be a string literal */
4172
- char *sqlstatestr;
4143
+ char *sqlstatestr;
4173
4144
 
4174
4145
  if (yylex() != SCONST)
4175
4146
  yyerror("syntax error");
@@ -4203,21 +4174,21 @@ yyreduce:
4203
4174
 
4204
4175
  check_raise_parameters(new);
4205
4176
 
4206
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4177
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4207
4178
  ;}
4208
4179
  break;
4209
4180
 
4210
- case 130:
4211
- #line 1925 "pl_gram.y"
4181
+ case 127:
4182
+ #line 1932 "pl_gram.y"
4212
4183
  {
4213
- PLpgSQL_stmt_assert *new;
4214
- int tok;
4184
+ PLpgSQL_stmt_assert *new;
4185
+ int tok;
4215
4186
 
4216
4187
  new = palloc(sizeof(PLpgSQL_stmt_assert));
4217
4188
 
4218
- new->cmd_type = PLPGSQL_STMT_ASSERT;
4219
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4220
- new->stmtid = ++plpgsql_curr_compile->nstatements;
4189
+ new->cmd_type = PLPGSQL_STMT_ASSERT;
4190
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4191
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
4221
4192
 
4222
4193
  new->cond = read_sql_expression2(',', ';',
4223
4194
  ", or ;",
@@ -4232,8 +4203,8 @@ yyreduce:
4232
4203
  ;}
4233
4204
  break;
4234
4205
 
4235
- case 131:
4236
- #line 1949 "pl_gram.y"
4206
+ case 128:
4207
+ #line 1956 "pl_gram.y"
4237
4208
  {
4238
4209
  (yyval.loop_body).stmts = (yyvsp[(1) - (5)].list);
4239
4210
  (yyval.loop_body).end_label = (yyvsp[(4) - (5)].str);
@@ -4241,57 +4212,66 @@ yyreduce:
4241
4212
  ;}
4242
4213
  break;
4243
4214
 
4244
- case 132:
4245
- #line 1967 "pl_gram.y"
4215
+ case 129:
4216
+ #line 1974 "pl_gram.y"
4246
4217
  {
4247
- (yyval.stmt) = make_execsql_stmt(K_IMPORT, (yylsp[(1) - (1)]));
4218
+ (yyval.stmt) = make_execsql_stmt(K_IMPORT, (yylsp[(1) - (1)]), NULL);
4248
4219
  ;}
4249
4220
  break;
4250
4221
 
4251
- case 133:
4252
- #line 1971 "pl_gram.y"
4222
+ case 130:
4223
+ #line 1978 "pl_gram.y"
4253
4224
  {
4254
- (yyval.stmt) = make_execsql_stmt(K_INSERT, (yylsp[(1) - (1)]));
4225
+ (yyval.stmt) = make_execsql_stmt(K_INSERT, (yylsp[(1) - (1)]), NULL);
4255
4226
  ;}
4256
4227
  break;
4257
4228
 
4258
- case 134:
4259
- #line 1975 "pl_gram.y"
4229
+ case 131:
4230
+ #line 1982 "pl_gram.y"
4231
+ {
4232
+ (yyval.stmt) = make_execsql_stmt(K_MERGE, (yylsp[(1) - (1)]), NULL);
4233
+ ;}
4234
+ break;
4235
+
4236
+ case 132:
4237
+ #line 1986 "pl_gram.y"
4260
4238
  {
4261
4239
  int tok;
4262
4240
 
4263
4241
  tok = yylex();
4264
4242
  plpgsql_push_back_token(tok);
4265
- if (tok == '=' || tok == COLON_EQUALS || tok == '[')
4243
+ if (tok == '=' || tok == COLON_EQUALS ||
4244
+ tok == '[' || tok == '.')
4266
4245
  word_is_not_variable(&((yyvsp[(1) - (1)].word)), (yylsp[(1) - (1)]));
4267
- (yyval.stmt) = make_execsql_stmt(T_WORD, (yylsp[(1) - (1)]));
4246
+ (yyval.stmt) = make_execsql_stmt(T_WORD, (yylsp[(1) - (1)]), &((yyvsp[(1) - (1)].word)));
4268
4247
  ;}
4269
4248
  break;
4270
4249
 
4271
- case 135:
4272
- #line 1985 "pl_gram.y"
4250
+ case 133:
4251
+ #line 1997 "pl_gram.y"
4273
4252
  {
4274
4253
  int tok;
4275
4254
 
4276
4255
  tok = yylex();
4277
4256
  plpgsql_push_back_token(tok);
4278
- if (tok == '=' || tok == COLON_EQUALS || tok == '[')
4257
+ if (tok == '=' || tok == COLON_EQUALS ||
4258
+ tok == '[' || tok == '.')
4279
4259
  cword_is_not_variable(&((yyvsp[(1) - (1)].cword)), (yylsp[(1) - (1)]));
4280
- (yyval.stmt) = make_execsql_stmt(T_CWORD, (yylsp[(1) - (1)]));
4260
+ (yyval.stmt) = make_execsql_stmt(T_CWORD, (yylsp[(1) - (1)]), NULL);
4281
4261
  ;}
4282
4262
  break;
4283
4263
 
4284
- case 136:
4285
- #line 1997 "pl_gram.y"
4264
+ case 134:
4265
+ #line 2010 "pl_gram.y"
4286
4266
  {
4287
4267
  PLpgSQL_stmt_dynexecute *new;
4288
4268
  PLpgSQL_expr *expr;
4289
- int endtoken;
4269
+ int endtoken;
4290
4270
 
4291
4271
  expr = read_sql_construct(K_INTO, K_USING, ';',
4292
4272
  "INTO or USING or ;",
4293
- "SELECT ",
4294
- true, true, true,
4273
+ RAW_PARSE_PLPGSQL_EXPR,
4274
+ true, true,
4295
4275
  NULL, &endtoken);
4296
4276
 
4297
4277
  new = palloc(sizeof(PLpgSQL_stmt_dynexecute));
@@ -4329,8 +4309,8 @@ yyreduce:
4329
4309
  {
4330
4310
  expr = read_sql_construct(',', ';', K_INTO,
4331
4311
  ", or ; or INTO",
4332
- "SELECT ",
4333
- true, true, true,
4312
+ RAW_PARSE_PLPGSQL_EXPR,
4313
+ true, true,
4334
4314
  NULL, &endtoken);
4335
4315
  new->params = lappend(new->params, expr);
4336
4316
  } while (endtoken == ',');
@@ -4341,15 +4321,15 @@ yyreduce:
4341
4321
  yyerror("syntax error");
4342
4322
  }
4343
4323
 
4344
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4324
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4345
4325
  ;}
4346
4326
  break;
4347
4327
 
4348
- case 137:
4349
- #line 2061 "pl_gram.y"
4328
+ case 135:
4329
+ #line 2074 "pl_gram.y"
4350
4330
  {
4351
4331
  PLpgSQL_stmt_open *new;
4352
- int tok;
4332
+ int tok;
4353
4333
 
4354
4334
  new = palloc0(sizeof(PLpgSQL_stmt_open));
4355
4335
  new->cmd_type = PLPGSQL_STMT_OPEN;
@@ -4386,7 +4366,7 @@ yyreduce:
4386
4366
  tok = yylex();
4387
4367
  if (tok == K_EXECUTE)
4388
4368
  {
4389
- int endtoken;
4369
+ int endtoken;
4390
4370
 
4391
4371
  new->dynquery =
4392
4372
  read_sql_expression2(K_USING, ';',
@@ -4411,21 +4391,21 @@ yyreduce:
4411
4391
  else
4412
4392
  {
4413
4393
  plpgsql_push_back_token(tok);
4414
- new->query = read_sql_stmt("");
4394
+ new->query = read_sql_stmt();
4415
4395
  }
4416
4396
  }
4417
4397
  else
4418
4398
  {
4419
4399
  /* predefined cursor query, so read args */
4420
- new->argquery = read_cursor_args((yyvsp[(2) - (2)].var), ';', ";");
4400
+ new->argquery = read_cursor_args((yyvsp[(2) - (2)].var), ';');
4421
4401
  }
4422
4402
 
4423
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4403
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4424
4404
  ;}
4425
4405
  break;
4426
4406
 
4427
- case 138:
4428
- #line 2139 "pl_gram.y"
4407
+ case 136:
4408
+ #line 2152 "pl_gram.y"
4429
4409
  {
4430
4410
  PLpgSQL_stmt_fetch *fetch = (yyvsp[(2) - (4)].fetch);
4431
4411
  PLpgSQL_variable *target;
@@ -4451,32 +4431,32 @@ yyreduce:
4451
4431
  fetch->curvar = (yyvsp[(3) - (4)].var)->dno;
4452
4432
  fetch->is_move = false;
4453
4433
 
4454
- (yyval.stmt) = (PLpgSQL_stmt *)fetch;
4434
+ (yyval.stmt) = (PLpgSQL_stmt *) fetch;
4455
4435
  ;}
4456
4436
  break;
4457
4437
 
4458
- case 139:
4459
- #line 2169 "pl_gram.y"
4438
+ case 137:
4439
+ #line 2182 "pl_gram.y"
4460
4440
  {
4461
4441
  PLpgSQL_stmt_fetch *fetch = (yyvsp[(2) - (4)].fetch);
4462
4442
 
4463
4443
  fetch->lineno = plpgsql_location_to_lineno((yylsp[(1) - (4)]));
4464
- fetch->curvar = (yyvsp[(3) - (4)].var)->dno;
4465
- fetch->is_move = true;
4444
+ fetch->curvar = (yyvsp[(3) - (4)].var)->dno;
4445
+ fetch->is_move = true;
4466
4446
 
4467
- (yyval.stmt) = (PLpgSQL_stmt *)fetch;
4447
+ (yyval.stmt) = (PLpgSQL_stmt *) fetch;
4468
4448
  ;}
4469
4449
  break;
4470
4450
 
4471
- case 140:
4472
- #line 2181 "pl_gram.y"
4451
+ case 138:
4452
+ #line 2194 "pl_gram.y"
4473
4453
  {
4474
4454
  (yyval.fetch) = read_fetch_direction();
4475
4455
  ;}
4476
4456
  break;
4477
4457
 
4478
- case 141:
4479
- #line 2187 "pl_gram.y"
4458
+ case 139:
4459
+ #line 2200 "pl_gram.y"
4480
4460
  {
4481
4461
  PLpgSQL_stmt_close *new;
4482
4462
 
@@ -4486,20 +4466,20 @@ yyreduce:
4486
4466
  new->stmtid = ++plpgsql_curr_compile->nstatements;
4487
4467
  new->curvar = (yyvsp[(2) - (3)].var)->dno;
4488
4468
 
4489
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4469
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4490
4470
  ;}
4491
4471
  break;
4492
4472
 
4493
- case 142:
4494
- #line 2201 "pl_gram.y"
4473
+ case 140:
4474
+ #line 2214 "pl_gram.y"
4495
4475
  {
4496
4476
  /* We do not bother building a node for NULL */
4497
4477
  (yyval.stmt) = NULL;
4498
4478
  ;}
4499
4479
  break;
4500
4480
 
4501
- case 143:
4502
- #line 2208 "pl_gram.y"
4481
+ case 141:
4482
+ #line 2221 "pl_gram.y"
4503
4483
  {
4504
4484
  PLpgSQL_stmt_commit *new;
4505
4485
 
@@ -4509,12 +4489,12 @@ yyreduce:
4509
4489
  new->stmtid = ++plpgsql_curr_compile->nstatements;
4510
4490
  new->chain = (yyvsp[(2) - (3)].ival);
4511
4491
 
4512
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4492
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4513
4493
  ;}
4514
4494
  break;
4515
4495
 
4516
- case 144:
4517
- #line 2222 "pl_gram.y"
4496
+ case 142:
4497
+ #line 2235 "pl_gram.y"
4518
4498
  {
4519
4499
  PLpgSQL_stmt_rollback *new;
4520
4500
 
@@ -4524,58 +4504,27 @@ yyreduce:
4524
4504
  new->stmtid = ++plpgsql_curr_compile->nstatements;
4525
4505
  new->chain = (yyvsp[(2) - (3)].ival);
4526
4506
 
4527
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4507
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4528
4508
  ;}
4529
4509
  break;
4530
4510
 
4531
- case 145:
4532
- #line 2236 "pl_gram.y"
4511
+ case 143:
4512
+ #line 2249 "pl_gram.y"
4533
4513
  { (yyval.ival) = true; ;}
4534
4514
  break;
4535
4515
 
4536
- case 146:
4537
- #line 2237 "pl_gram.y"
4516
+ case 144:
4517
+ #line 2250 "pl_gram.y"
4538
4518
  { (yyval.ival) = false; ;}
4539
4519
  break;
4540
4520
 
4541
- case 147:
4542
- #line 2238 "pl_gram.y"
4521
+ case 145:
4522
+ #line 2251 "pl_gram.y"
4543
4523
  { (yyval.ival) = false; ;}
4544
4524
  break;
4545
4525
 
4546
- case 148:
4547
- #line 2242 "pl_gram.y"
4548
- {
4549
- PLpgSQL_stmt_set *new;
4550
-
4551
- new = palloc0(sizeof(PLpgSQL_stmt_set));
4552
- new->cmd_type = PLPGSQL_STMT_SET;
4553
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4554
- new->stmtid = ++plpgsql_curr_compile->nstatements;
4555
-
4556
- new->expr = read_sql_stmt("SET ");
4557
-
4558
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4559
- ;}
4560
- break;
4561
-
4562
- case 149:
4563
- #line 2255 "pl_gram.y"
4564
- {
4565
- PLpgSQL_stmt_set *new;
4566
-
4567
- new = palloc0(sizeof(PLpgSQL_stmt_set));
4568
- new->cmd_type = PLPGSQL_STMT_SET;
4569
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4570
- new->stmtid = ++plpgsql_curr_compile->nstatements;
4571
- new->expr = read_sql_stmt("RESET ");
4572
-
4573
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4574
- ;}
4575
- break;
4576
-
4577
- case 150:
4578
- #line 2270 "pl_gram.y"
4526
+ case 146:
4527
+ #line 2256 "pl_gram.y"
4579
4528
  {
4580
4529
  /*
4581
4530
  * In principle we should support a cursor_variable
@@ -4599,29 +4548,29 @@ yyreduce:
4599
4548
  ;}
4600
4549
  break;
4601
4550
 
4602
- case 151:
4603
- #line 2292 "pl_gram.y"
4551
+ case 147:
4552
+ #line 2278 "pl_gram.y"
4604
4553
  {
4605
4554
  /* just to give a better message than "syntax error" */
4606
4555
  word_is_not_variable(&((yyvsp[(1) - (1)].word)), (yylsp[(1) - (1)]));
4607
4556
  ;}
4608
4557
  break;
4609
4558
 
4610
- case 152:
4611
- #line 2297 "pl_gram.y"
4559
+ case 148:
4560
+ #line 2283 "pl_gram.y"
4612
4561
  {
4613
4562
  /* just to give a better message than "syntax error" */
4614
4563
  cword_is_not_variable(&((yyvsp[(1) - (1)].cword)), (yylsp[(1) - (1)]));
4615
4564
  ;}
4616
4565
  break;
4617
4566
 
4618
- case 153:
4619
- #line 2304 "pl_gram.y"
4567
+ case 149:
4568
+ #line 2290 "pl_gram.y"
4620
4569
  { (yyval.exception_block) = NULL; ;}
4621
4570
  break;
4622
4571
 
4623
- case 154:
4624
- #line 2306 "pl_gram.y"
4572
+ case 150:
4573
+ #line 2292 "pl_gram.y"
4625
4574
  {
4626
4575
  /*
4627
4576
  * We use a mid-rule action to add these
@@ -4656,8 +4605,8 @@ yyreduce:
4656
4605
  ;}
4657
4606
  break;
4658
4607
 
4659
- case 155:
4660
- #line 2339 "pl_gram.y"
4608
+ case 151:
4609
+ #line 2325 "pl_gram.y"
4661
4610
  {
4662
4611
  PLpgSQL_exception_block *new = (yyvsp[(2) - (3)].exception_block);
4663
4612
  new->exc_list = (yyvsp[(3) - (3)].list);
@@ -4666,22 +4615,22 @@ yyreduce:
4666
4615
  ;}
4667
4616
  break;
4668
4617
 
4669
- case 156:
4670
- #line 2348 "pl_gram.y"
4618
+ case 152:
4619
+ #line 2334 "pl_gram.y"
4671
4620
  {
4672
4621
  (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].exception));
4673
4622
  ;}
4674
4623
  break;
4675
4624
 
4676
- case 157:
4677
- #line 2352 "pl_gram.y"
4625
+ case 153:
4626
+ #line 2338 "pl_gram.y"
4678
4627
  {
4679
4628
  (yyval.list) = list_make1((yyvsp[(1) - (1)].exception));
4680
4629
  ;}
4681
4630
  break;
4682
4631
 
4683
- case 158:
4684
- #line 2358 "pl_gram.y"
4632
+ case 154:
4633
+ #line 2344 "pl_gram.y"
4685
4634
  {
4686
4635
  PLpgSQL_exception *new;
4687
4636
 
@@ -4694,8 +4643,8 @@ yyreduce:
4694
4643
  ;}
4695
4644
  break;
4696
4645
 
4697
- case 159:
4698
- #line 2371 "pl_gram.y"
4646
+ case 155:
4647
+ #line 2357 "pl_gram.y"
4699
4648
  {
4700
4649
  PLpgSQL_condition *old;
4701
4650
 
@@ -4706,15 +4655,15 @@ yyreduce:
4706
4655
  ;}
4707
4656
  break;
4708
4657
 
4709
- case 160:
4710
- #line 2380 "pl_gram.y"
4658
+ case 156:
4659
+ #line 2366 "pl_gram.y"
4711
4660
  {
4712
4661
  (yyval.condition) = (yyvsp[(1) - (1)].condition);
4713
4662
  ;}
4714
4663
  break;
4715
4664
 
4716
- case 161:
4717
- #line 2386 "pl_gram.y"
4665
+ case 157:
4666
+ #line 2372 "pl_gram.y"
4718
4667
  {
4719
4668
  if (strcmp((yyvsp[(1) - (1)].str), "sqlstate") != 0)
4720
4669
  {
@@ -4750,99 +4699,94 @@ yyreduce:
4750
4699
  ;}
4751
4700
  break;
4752
4701
 
4753
- case 162:
4754
- #line 2422 "pl_gram.y"
4702
+ case 158:
4703
+ #line 2408 "pl_gram.y"
4755
4704
  { (yyval.expr) = read_sql_expression(';', ";"); ;}
4756
4705
  break;
4757
4706
 
4758
- case 163:
4759
- #line 2426 "pl_gram.y"
4760
- { (yyval.expr) = read_sql_expression(']', "]"); ;}
4761
- break;
4762
-
4763
- case 164:
4764
- #line 2430 "pl_gram.y"
4707
+ case 159:
4708
+ #line 2412 "pl_gram.y"
4765
4709
  { (yyval.expr) = read_sql_expression(K_THEN, "THEN"); ;}
4766
4710
  break;
4767
4711
 
4768
- case 165:
4769
- #line 2434 "pl_gram.y"
4712
+ case 160:
4713
+ #line 2416 "pl_gram.y"
4770
4714
  { (yyval.expr) = read_sql_expression(K_LOOP, "LOOP"); ;}
4771
4715
  break;
4772
4716
 
4773
- case 166:
4774
- #line 2438 "pl_gram.y"
4717
+ case 161:
4718
+ #line 2420 "pl_gram.y"
4775
4719
  {
4776
4720
  plpgsql_ns_push(NULL, PLPGSQL_LABEL_BLOCK);
4777
4721
  (yyval.str) = NULL;
4778
4722
  ;}
4779
4723
  break;
4780
4724
 
4781
- case 167:
4782
- #line 2443 "pl_gram.y"
4725
+ case 162:
4726
+ #line 2425 "pl_gram.y"
4783
4727
  {
4784
4728
  plpgsql_ns_push((yyvsp[(2) - (3)].str), PLPGSQL_LABEL_BLOCK);
4785
4729
  (yyval.str) = (yyvsp[(2) - (3)].str);
4786
4730
  ;}
4787
4731
  break;
4788
4732
 
4789
- case 168:
4790
- #line 2450 "pl_gram.y"
4733
+ case 163:
4734
+ #line 2432 "pl_gram.y"
4791
4735
  {
4792
4736
  plpgsql_ns_push(NULL, PLPGSQL_LABEL_LOOP);
4793
4737
  (yyval.str) = NULL;
4794
4738
  ;}
4795
4739
  break;
4796
4740
 
4797
- case 169:
4798
- #line 2455 "pl_gram.y"
4741
+ case 164:
4742
+ #line 2437 "pl_gram.y"
4799
4743
  {
4800
4744
  plpgsql_ns_push((yyvsp[(2) - (3)].str), PLPGSQL_LABEL_LOOP);
4801
4745
  (yyval.str) = (yyvsp[(2) - (3)].str);
4802
4746
  ;}
4803
4747
  break;
4804
4748
 
4805
- case 170:
4806
- #line 2462 "pl_gram.y"
4749
+ case 165:
4750
+ #line 2444 "pl_gram.y"
4807
4751
  {
4808
4752
  (yyval.str) = NULL;
4809
4753
  ;}
4810
4754
  break;
4811
4755
 
4812
- case 171:
4813
- #line 2466 "pl_gram.y"
4756
+ case 166:
4757
+ #line 2448 "pl_gram.y"
4814
4758
  {
4815
4759
  /* label validity will be checked by outer production */
4816
4760
  (yyval.str) = (yyvsp[(1) - (1)].str);
4817
4761
  ;}
4818
4762
  break;
4819
4763
 
4820
- case 172:
4821
- #line 2473 "pl_gram.y"
4764
+ case 167:
4765
+ #line 2455 "pl_gram.y"
4822
4766
  { (yyval.expr) = NULL; ;}
4823
4767
  break;
4824
4768
 
4825
- case 173:
4826
- #line 2475 "pl_gram.y"
4769
+ case 168:
4770
+ #line 2457 "pl_gram.y"
4827
4771
  { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
4828
4772
  break;
4829
4773
 
4830
- case 174:
4831
- #line 2482 "pl_gram.y"
4774
+ case 169:
4775
+ #line 2464 "pl_gram.y"
4832
4776
  {
4833
4777
  (yyval.str) = (yyvsp[(1) - (1)].word).ident;
4834
4778
  ;}
4835
4779
  break;
4836
4780
 
4837
- case 175:
4838
- #line 2486 "pl_gram.y"
4781
+ case 170:
4782
+ #line 2468 "pl_gram.y"
4839
4783
  {
4840
4784
  (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword));
4841
4785
  ;}
4842
4786
  break;
4843
4787
 
4844
- case 176:
4845
- #line 2490 "pl_gram.y"
4788
+ case 171:
4789
+ #line 2472 "pl_gram.y"
4846
4790
  {
4847
4791
  if ((yyvsp[(1) - (1)].wdatum).ident == NULL) /* composite name not OK */
4848
4792
  yyerror("syntax error");
@@ -4852,7 +4796,7 @@ yyreduce:
4852
4796
 
4853
4797
 
4854
4798
  /* Line 1267 of yacc.c. */
4855
- #line 4803 "pl_gram.c"
4799
+ #line 4747 "pl_gram.c"
4856
4800
  default: break;
4857
4801
  }
4858
4802
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -5072,7 +5016,7 @@ yyreturn:
5072
5016
  }
5073
5017
 
5074
5018
 
5075
- #line 2582 "pl_gram.y"
5019
+ #line 2564 "pl_gram.y"
5076
5020
 
5077
5021
 
5078
5022
  /*
@@ -5150,7 +5094,8 @@ static PLpgSQL_expr *
5150
5094
  read_sql_expression(int until, const char *expected)
5151
5095
  {
5152
5096
  return read_sql_construct(until, 0, 0, expected,
5153
- "SELECT ", true, true, true, NULL, NULL);
5097
+ RAW_PARSE_PLPGSQL_EXPR,
5098
+ true, true, NULL, NULL);
5154
5099
  }
5155
5100
 
5156
5101
  /* Convenience routine to read an expression with two possible terminators */
@@ -5159,15 +5104,17 @@ read_sql_expression2(int until, int until2, const char *expected,
5159
5104
  int *endtoken)
5160
5105
  {
5161
5106
  return read_sql_construct(until, until2, 0, expected,
5162
- "SELECT ", true, true, true, NULL, endtoken);
5107
+ RAW_PARSE_PLPGSQL_EXPR,
5108
+ true, true, NULL, endtoken);
5163
5109
  }
5164
5110
 
5165
5111
  /* Convenience routine to read a SQL statement that must end with ';' */
5166
5112
  static PLpgSQL_expr *
5167
- read_sql_stmt(const char *sqlstart)
5113
+ read_sql_stmt(void)
5168
5114
  {
5169
5115
  return read_sql_construct(';', 0, 0, ";",
5170
- sqlstart, false, true, true, NULL, NULL);
5116
+ RAW_PARSE_DEFAULT,
5117
+ false, true, NULL, NULL);
5171
5118
  }
5172
5119
 
5173
5120
  /*
@@ -5177,10 +5124,9 @@ read_sql_stmt(const char *sqlstart)
5177
5124
  * until2: token code for alternate terminator (pass 0 if none)
5178
5125
  * until3: token code for another alternate terminator (pass 0 if none)
5179
5126
  * expected: text to use in complaining that terminator was not found
5180
- * sqlstart: text to prefix to the accumulated SQL text
5127
+ * parsemode: raw_parser() mode to use
5181
5128
  * isexpression: whether to say we're reading an "expression" or a "statement"
5182
- * valid_sql: whether to check the syntax of the expr (prefixed with sqlstart)
5183
- * trim: trim trailing whitespace
5129
+ * valid_sql: whether to check the syntax of the expr
5184
5130
  * startloc: if not NULL, location of first token is stored at *startloc
5185
5131
  * endtoken: if not NULL, ending token is stored at *endtoken
5186
5132
  * (this is only interesting if until2 or until3 isn't zero)
@@ -5190,22 +5136,21 @@ read_sql_construct(int until,
5190
5136
  int until2,
5191
5137
  int until3,
5192
5138
  const char *expected,
5193
- const char *sqlstart,
5139
+ RawParseMode parsemode,
5194
5140
  bool isexpression,
5195
5141
  bool valid_sql,
5196
- bool trim,
5197
5142
  int *startloc,
5198
5143
  int *endtoken)
5199
5144
  {
5200
- int tok;
5201
- StringInfoData ds;
5202
- IdentifierLookup save_IdentifierLookup;
5203
- int startlocation = -1;
5204
- int parenlevel = 0;
5205
- PLpgSQL_expr *expr;
5145
+ int tok;
5146
+ StringInfoData ds;
5147
+ IdentifierLookup save_IdentifierLookup;
5148
+ int startlocation = -1;
5149
+ int endlocation = -1;
5150
+ int parenlevel = 0;
5151
+ PLpgSQL_expr *expr;
5206
5152
 
5207
5153
  initStringInfo(&ds);
5208
- appendStringInfoString(&ds, sqlstart);
5209
5154
 
5210
5155
  /* special lookup mode for identifiers within the SQL text */
5211
5156
  save_IdentifierLookup = plpgsql_IdentifierLookup;
@@ -5252,6 +5197,8 @@ read_sql_construct(int until,
5252
5197
  expected),
5253
5198
  parser_errposition(yylloc)));
5254
5199
  }
5200
+ /* Remember end+1 location of last accepted token */
5201
+ endlocation = yylloc + plpgsql_token_length();
5255
5202
  }
5256
5203
 
5257
5204
  plpgsql_IdentifierLookup = save_IdentifierLookup;
@@ -5262,7 +5209,7 @@ read_sql_construct(int until,
5262
5209
  *endtoken = tok;
5263
5210
 
5264
5211
  /* give helpful complaint about empty input */
5265
- if (startlocation >= yylloc)
5212
+ if (startlocation >= endlocation)
5266
5213
  {
5267
5214
  if (isexpression)
5268
5215
  yyerror("missing expression");
@@ -5270,37 +5217,42 @@ read_sql_construct(int until,
5270
5217
  yyerror("missing SQL statement");
5271
5218
  }
5272
5219
 
5273
- plpgsql_append_source_text(&ds, startlocation, yylloc);
5274
-
5275
- /* trim any trailing whitespace, for neatness */
5276
- if (trim)
5277
- {
5278
- while (ds.len > 0 && scanner_isspace(ds.data[ds.len - 1]))
5279
- ds.data[--ds.len] = '\0';
5280
- }
5220
+ /*
5221
+ * We save only the text from startlocation to endlocation-1. This
5222
+ * suppresses the "until" token as well as any whitespace or comments
5223
+ * following the last accepted token. (We used to strip such trailing
5224
+ * whitespace by hand, but that causes problems if there's a "-- comment"
5225
+ * in front of said whitespace.)
5226
+ */
5227
+ plpgsql_append_source_text(&ds, startlocation, endlocation);
5281
5228
 
5282
5229
  expr = palloc0(sizeof(PLpgSQL_expr));
5283
- expr->query = pstrdup(ds.data);
5284
- expr->plan = NULL;
5285
- expr->paramnos = NULL;
5286
- expr->rwparam = -1;
5287
- expr->ns = plpgsql_ns_top();
5230
+ expr->query = pstrdup(ds.data);
5231
+ expr->parseMode = parsemode;
5232
+ expr->plan = NULL;
5233
+ expr->paramnos = NULL;
5234
+ expr->target_param = -1;
5235
+ expr->ns = plpgsql_ns_top();
5288
5236
  pfree(ds.data);
5289
5237
 
5290
5238
  if (valid_sql)
5291
- check_sql_expr(expr->query, startlocation, strlen(sqlstart));
5239
+ check_sql_expr(expr->query, expr->parseMode, startlocation);
5292
5240
 
5293
5241
  return expr;
5294
5242
  }
5295
5243
 
5244
+ /*
5245
+ * Read a datatype declaration, consuming the current lookahead token if any.
5246
+ * Returns a PLpgSQL_type struct.
5247
+ */
5296
5248
  static PLpgSQL_type *
5297
5249
  read_datatype(int tok)
5298
5250
  {
5299
- StringInfoData ds;
5300
- char *type_name;
5301
- int startlocation;
5302
- PLpgSQL_type *result;
5303
- int parenlevel = 0;
5251
+ StringInfoData ds;
5252
+ char *type_name;
5253
+ int startlocation;
5254
+ PLpgSQL_type *result = NULL;
5255
+ int parenlevel = 0;
5304
5256
 
5305
5257
  /* Should only be called while parsing DECLARE sections */
5306
5258
  Assert(plpgsql_IdentifierLookup == IDENTIFIER_LOOKUP_DECLARE);
@@ -5309,15 +5261,16 @@ read_datatype(int tok)
5309
5261
  if (tok == YYEMPTY)
5310
5262
  tok = yylex();
5311
5263
 
5264
+ /* The current token is the start of what we'll pass to parse_datatype */
5312
5265
  startlocation = yylloc;
5313
5266
 
5314
5267
  /*
5315
- * If we have a simple or composite identifier, check for %TYPE
5316
- * and %ROWTYPE constructs.
5268
+ * If we have a simple or composite identifier, check for %TYPE and
5269
+ * %ROWTYPE constructs.
5317
5270
  */
5318
5271
  if (tok == T_WORD)
5319
5272
  {
5320
- char *dtname = yylval.word.ident;
5273
+ char *dtname = yylval.word.ident;
5321
5274
 
5322
5275
  tok = yylex();
5323
5276
  if (tok == '%')
@@ -5325,23 +5278,15 @@ read_datatype(int tok)
5325
5278
  tok = yylex();
5326
5279
  if (tok_is_keyword(tok, &yylval,
5327
5280
  K_TYPE, "type"))
5328
- {
5329
5281
  result = plpgsql_parse_wordtype(dtname);
5330
- if (result)
5331
- return result;
5332
- }
5333
5282
  else if (tok_is_keyword(tok, &yylval,
5334
5283
  K_ROWTYPE, "rowtype"))
5335
- {
5336
5284
  result = plpgsql_parse_wordrowtype(dtname);
5337
- if (result)
5338
- return result;
5339
- }
5340
5285
  }
5341
5286
  }
5342
5287
  else if (plpgsql_token_is_unreserved_keyword(tok))
5343
5288
  {
5344
- char *dtname = pstrdup(yylval.keyword);
5289
+ char *dtname = pstrdup(yylval.keyword);
5345
5290
 
5346
5291
  tok = yylex();
5347
5292
  if (tok == '%')
@@ -5349,23 +5294,15 @@ read_datatype(int tok)
5349
5294
  tok = yylex();
5350
5295
  if (tok_is_keyword(tok, &yylval,
5351
5296
  K_TYPE, "type"))
5352
- {
5353
5297
  result = plpgsql_parse_wordtype(dtname);
5354
- if (result)
5355
- return result;
5356
- }
5357
5298
  else if (tok_is_keyword(tok, &yylval,
5358
5299
  K_ROWTYPE, "rowtype"))
5359
- {
5360
5300
  result = plpgsql_parse_wordrowtype(dtname);
5361
- if (result)
5362
- return result;
5363
- }
5364
5301
  }
5365
5302
  }
5366
5303
  else if (tok == T_CWORD)
5367
5304
  {
5368
- List *dtnames = yylval.cword.idents;
5305
+ List *dtnames = yylval.cword.idents;
5369
5306
 
5370
5307
  tok = yylex();
5371
5308
  if (tok == '%')
@@ -5373,21 +5310,56 @@ read_datatype(int tok)
5373
5310
  tok = yylex();
5374
5311
  if (tok_is_keyword(tok, &yylval,
5375
5312
  K_TYPE, "type"))
5376
- {
5377
5313
  result = plpgsql_parse_cwordtype(dtnames);
5378
- if (result)
5379
- return result;
5380
- }
5381
5314
  else if (tok_is_keyword(tok, &yylval,
5382
5315
  K_ROWTYPE, "rowtype"))
5383
- {
5384
5316
  result = plpgsql_parse_cwordrowtype(dtnames);
5385
- if (result)
5386
- return result;
5387
- }
5388
5317
  }
5389
5318
  }
5390
5319
 
5320
+ /*
5321
+ * If we recognized a %TYPE or %ROWTYPE construct, see if it is followed
5322
+ * by array decoration: [ ARRAY ] [ '[' [ iconst ] ']' [ ... ] ]
5323
+ *
5324
+ * Like the core parser, we ignore the specific numbers and sizes of
5325
+ * dimensions; arrays of different dimensionality are still the same type
5326
+ * in Postgres.
5327
+ */
5328
+ if (result)
5329
+ {
5330
+ bool is_array = false;
5331
+
5332
+ tok = yylex();
5333
+ if (tok_is_keyword(tok, &yylval,
5334
+ K_ARRAY, "array"))
5335
+ {
5336
+ is_array = true;
5337
+ tok = yylex();
5338
+ }
5339
+ while (tok == '[')
5340
+ {
5341
+ is_array = true;
5342
+ tok = yylex();
5343
+ if (tok == ICONST)
5344
+ tok = yylex();
5345
+ if (tok != ']')
5346
+ yyerror("syntax error, expected \"]\"");
5347
+ tok = yylex();
5348
+ }
5349
+ plpgsql_push_back_token(tok);
5350
+
5351
+ if (is_array)
5352
+ result = plpgsql_build_datatype_arrayof(result);
5353
+
5354
+ return result;
5355
+ }
5356
+
5357
+ /*
5358
+ * Not %TYPE or %ROWTYPE, so scan to the end of the datatype declaration,
5359
+ * which could include typmod or array decoration. We are not very picky
5360
+ * here, instead relying on parse_datatype to complain about garbage. But
5361
+ * we must count parens to handle typmods within cursor_arg correctly.
5362
+ */
5391
5363
  while (tok != ';')
5392
5364
  {
5393
5365
  if (tok == 0)
@@ -5429,23 +5401,35 @@ read_datatype(int tok)
5429
5401
  return result;
5430
5402
  }
5431
5403
 
5404
+ /*
5405
+ * Read a generic SQL statement. We have already read its first token;
5406
+ * firsttoken is that token's code and location its starting location.
5407
+ * If firsttoken == T_WORD, pass its yylval value as "word", else pass NULL.
5408
+ */
5432
5409
  static PLpgSQL_stmt *
5433
- make_execsql_stmt(int firsttoken, int location)
5410
+ make_execsql_stmt(int firsttoken, int location, PLword *word)
5434
5411
  {
5435
- StringInfoData ds;
5436
- IdentifierLookup save_IdentifierLookup;
5412
+ StringInfoData ds;
5413
+ IdentifierLookup save_IdentifierLookup;
5437
5414
  PLpgSQL_stmt_execsql *execsql;
5438
- PLpgSQL_expr *expr;
5439
- PLpgSQL_variable *target = NULL;
5440
- int tok;
5441
- int prev_tok;
5442
- bool have_into = false;
5443
- bool have_strict = false;
5444
- int into_start_loc = -1;
5445
- int into_end_loc = -1;
5415
+ PLpgSQL_expr *expr;
5416
+ PLpgSQL_variable *target = NULL;
5417
+ int tok;
5418
+ int prev_tok;
5419
+ bool have_into = false;
5420
+ bool have_strict = false;
5421
+ int into_start_loc = -1;
5422
+ int into_end_loc = -1;
5423
+ int paren_depth = 0;
5424
+ int begin_depth = 0;
5425
+ bool in_routine_definition = false;
5426
+ int token_count = 0;
5427
+ char tokens[4]; /* records the first few tokens */
5446
5428
 
5447
5429
  initStringInfo(&ds);
5448
5430
 
5431
+ memset(tokens, 0, sizeof(tokens));
5432
+
5449
5433
  /* special lookup mode for identifiers within the SQL text */
5450
5434
  save_IdentifierLookup = plpgsql_IdentifierLookup;
5451
5435
  plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_EXPR;
@@ -5454,6 +5438,12 @@ make_execsql_stmt(int firsttoken, int location)
5454
5438
  * Scan to the end of the SQL command. Identify any INTO-variables
5455
5439
  * clause lurking within it, and parse that via read_into_target().
5456
5440
  *
5441
+ * The end of the statement is defined by a semicolon ... except that
5442
+ * semicolons within parentheses or BEGIN/END blocks don't terminate a
5443
+ * statement. We follow psql's lead in not recognizing BEGIN/END except
5444
+ * after CREATE [OR REPLACE] {FUNCTION|PROCEDURE}. END can also appear
5445
+ * within a CASE construct, so we treat CASE/END like BEGIN/END.
5446
+ *
5457
5447
  * Because INTO is sometimes used in the main SQL grammar, we have to be
5458
5448
  * careful not to take any such usage of INTO as a PL/pgSQL INTO clause.
5459
5449
  * There are currently three such cases:
@@ -5479,13 +5469,50 @@ make_execsql_stmt(int firsttoken, int location)
5479
5469
  * break this logic again ... beware!
5480
5470
  */
5481
5471
  tok = firsttoken;
5472
+ if (tok == T_WORD && strcmp(word->ident, "create") == 0)
5473
+ tokens[token_count] = 'c';
5474
+ token_count++;
5475
+
5482
5476
  for (;;)
5483
5477
  {
5484
5478
  prev_tok = tok;
5485
5479
  tok = yylex();
5486
5480
  if (have_into && into_end_loc < 0)
5487
5481
  into_end_loc = yylloc; /* token after the INTO part */
5488
- if (tok == ';')
5482
+ /* Detect CREATE [OR REPLACE] {FUNCTION|PROCEDURE} */
5483
+ if (tokens[0] == 'c' && token_count < sizeof(tokens))
5484
+ {
5485
+ if (tok == K_OR)
5486
+ tokens[token_count] = 'o';
5487
+ else if (tok == T_WORD &&
5488
+ strcmp(yylval.word.ident, "replace") == 0)
5489
+ tokens[token_count] = 'r';
5490
+ else if (tok == T_WORD &&
5491
+ strcmp(yylval.word.ident, "function") == 0)
5492
+ tokens[token_count] = 'f';
5493
+ else if (tok == T_WORD &&
5494
+ strcmp(yylval.word.ident, "procedure") == 0)
5495
+ tokens[token_count] = 'f'; /* treat same as "function" */
5496
+ if (tokens[1] == 'f' ||
5497
+ (tokens[1] == 'o' && tokens[2] == 'r' && tokens[3] == 'f'))
5498
+ in_routine_definition = true;
5499
+ token_count++;
5500
+ }
5501
+ /* Track paren nesting (needed for CREATE RULE syntax) */
5502
+ if (tok == '(')
5503
+ paren_depth++;
5504
+ else if (tok == ')' && paren_depth > 0)
5505
+ paren_depth--;
5506
+ /* We need track BEGIN/END nesting only in a routine definition */
5507
+ if (in_routine_definition && paren_depth == 0)
5508
+ {
5509
+ if (tok == K_BEGIN || tok == K_CASE)
5510
+ begin_depth++;
5511
+ else if (tok == K_END && begin_depth > 0)
5512
+ begin_depth--;
5513
+ }
5514
+ /* Command-ending semicolon? */
5515
+ if (tok == ';' && paren_depth == 0 && begin_depth == 0)
5489
5516
  break;
5490
5517
  if (tok == 0)
5491
5518
  yyerror("unexpected end of function definition");
@@ -5493,6 +5520,8 @@ make_execsql_stmt(int firsttoken, int location)
5493
5520
  {
5494
5521
  if (prev_tok == K_INSERT)
5495
5522
  continue; /* INSERT INTO is not an INTO-target */
5523
+ if (prev_tok == K_MERGE)
5524
+ continue; /* MERGE INTO is not an INTO-target */
5496
5525
  if (firsttoken == K_IMPORT)
5497
5526
  continue; /* IMPORT ... INTO is not an INTO-target */
5498
5527
  if (have_into)
@@ -5526,23 +5555,24 @@ make_execsql_stmt(int firsttoken, int location)
5526
5555
  ds.data[--ds.len] = '\0';
5527
5556
 
5528
5557
  expr = palloc0(sizeof(PLpgSQL_expr));
5529
- expr->query = pstrdup(ds.data);
5530
- expr->plan = NULL;
5531
- expr->paramnos = NULL;
5532
- expr->rwparam = -1;
5533
- expr->ns = plpgsql_ns_top();
5558
+ expr->query = pstrdup(ds.data);
5559
+ expr->parseMode = RAW_PARSE_DEFAULT;
5560
+ expr->plan = NULL;
5561
+ expr->paramnos = NULL;
5562
+ expr->target_param = -1;
5563
+ expr->ns = plpgsql_ns_top();
5534
5564
  pfree(ds.data);
5535
5565
 
5536
- check_sql_expr(expr->query, location, 0);
5566
+ check_sql_expr(expr->query, expr->parseMode, location);
5537
5567
 
5538
5568
  execsql = palloc0(sizeof(PLpgSQL_stmt_execsql));
5539
5569
  execsql->cmd_type = PLPGSQL_STMT_EXECSQL;
5540
- execsql->lineno = plpgsql_location_to_lineno(location);
5541
- execsql->stmtid = ++plpgsql_curr_compile->nstatements;
5570
+ execsql->lineno = plpgsql_location_to_lineno(location);
5571
+ execsql->stmtid = ++plpgsql_curr_compile->nstatements;
5542
5572
  execsql->sqlstmt = expr;
5543
- execsql->into = have_into;
5544
- execsql->strict = have_strict;
5545
- execsql->target = target;
5573
+ execsql->into = have_into;
5574
+ execsql->strict = have_strict;
5575
+ execsql->target = target;
5546
5576
 
5547
5577
  return (PLpgSQL_stmt *) execsql;
5548
5578
  }
@@ -5564,11 +5594,11 @@ read_fetch_direction(void)
5564
5594
  */
5565
5595
  fetch = (PLpgSQL_stmt_fetch *) palloc0(sizeof(PLpgSQL_stmt_fetch));
5566
5596
  fetch->cmd_type = PLPGSQL_STMT_FETCH;
5567
- fetch->stmtid = ++plpgsql_curr_compile->nstatements;
5597
+ fetch->stmtid = ++plpgsql_curr_compile->nstatements;
5568
5598
  /* set direction defaults: */
5569
5599
  fetch->direction = FETCH_FORWARD;
5570
- fetch->how_many = 1;
5571
- fetch->expr = NULL;
5600
+ fetch->how_many = 1;
5601
+ fetch->expr = NULL;
5572
5602
  fetch->returns_multiple_rows = false;
5573
5603
 
5574
5604
  tok = yylex();
@@ -5646,11 +5676,11 @@ read_fetch_direction(void)
5646
5676
  {
5647
5677
  /*
5648
5678
  * Assume it's a count expression with no preceding keyword.
5649
- * Note: we allow this syntax because core SQL does, but we don't
5650
- * document it because of the ambiguity with the omitted-direction
5651
- * case. For instance, "MOVE n IN c" will fail if n is a variable.
5652
- * Perhaps this can be improved someday, but it's hardly worth a
5653
- * lot of work.
5679
+ * Note: we allow this syntax because core SQL does, but it's
5680
+ * ambiguous with the case of an omitted direction clause; for
5681
+ * instance, "MOVE n IN c" will fail if n is a variable, because the
5682
+ * preceding else-arm will trigger. Perhaps this can be improved
5683
+ * someday, but it hardly seems worth a lot of work.
5654
5684
  */
5655
5685
  plpgsql_push_back_token(tok);
5656
5686
  fetch->expr = read_sql_expression2(K_FROM, K_IN,
@@ -5749,11 +5779,11 @@ make_return_next_stmt(int location)
5749
5779
  parser_errposition(location)));
5750
5780
 
5751
5781
  new = palloc0(sizeof(PLpgSQL_stmt_return_next));
5752
- new->cmd_type = PLPGSQL_STMT_RETURN_NEXT;
5753
- new->lineno = plpgsql_location_to_lineno(location);
5754
- new->stmtid = ++plpgsql_curr_compile->nstatements;
5755
- new->expr = NULL;
5756
- new->retvarno = -1;
5782
+ new->cmd_type = PLPGSQL_STMT_RETURN_NEXT;
5783
+ new->lineno = plpgsql_location_to_lineno(location);
5784
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
5785
+ new->expr = NULL;
5786
+ new->retvarno = -1;
5757
5787
 
5758
5788
  if (plpgsql_curr_compile->out_param_varno >= 0)
5759
5789
  {
@@ -5770,7 +5800,7 @@ make_return_next_stmt(int location)
5770
5800
  * We want to special-case simple variable references for efficiency.
5771
5801
  * So peek ahead to see if that's what we have.
5772
5802
  */
5773
- int tok = yylex();
5803
+ int tok = yylex();
5774
5804
 
5775
5805
  if (tok == T_DATUM && plpgsql_peek() == ';' &&
5776
5806
  (yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_VAR ||
@@ -5822,12 +5852,12 @@ make_return_query_stmt(int location)
5822
5852
  {
5823
5853
  /* ordinary static query */
5824
5854
  plpgsql_push_back_token(tok);
5825
- new->query = read_sql_stmt("");
5855
+ new->query = read_sql_stmt();
5826
5856
  }
5827
5857
  else
5828
5858
  {
5829
5859
  /* dynamic SQL */
5830
- int term;
5860
+ int term;
5831
5861
 
5832
5862
  new->dynquery = read_sql_expression2(';', K_USING, "; or USING",
5833
5863
  &term);
@@ -5880,11 +5910,6 @@ check_assignable(PLpgSQL_datum *datum, int location)
5880
5910
  check_assignable(plpgsql_Datums[((PLpgSQL_recfield *) datum)->recparentno],
5881
5911
  location);
5882
5912
  break;
5883
- case PLPGSQL_DTYPE_ARRAYELEM:
5884
- /* assignable if parent array is */
5885
- check_assignable(plpgsql_Datums[((PLpgSQL_arrayelem *) datum)->arrayparentno],
5886
- location);
5887
- break;
5888
5913
  default:
5889
5914
  elog(ERROR, "unrecognized dtype: %d", datum->dtype);
5890
5915
  break;
@@ -5960,16 +5985,16 @@ read_into_scalar_list(char *initial_name,
5960
5985
  PLpgSQL_datum *initial_datum,
5961
5986
  int initial_location)
5962
5987
  {
5963
- int nfields;
5964
- char *fieldnames[1024];
5965
- int varnos[1024];
5966
- PLpgSQL_row *row;
5967
- int tok;
5988
+ int nfields;
5989
+ char *fieldnames[1024];
5990
+ int varnos[1024];
5991
+ PLpgSQL_row *row;
5992
+ int tok;
5968
5993
 
5969
5994
  check_assignable(initial_datum, initial_location);
5970
5995
  fieldnames[0] = initial_name;
5971
- varnos[0] = initial_datum->dno;
5972
- nfields = 1;
5996
+ varnos[0] = initial_datum->dno;
5997
+ nfields = 1;
5973
5998
 
5974
5999
  while ((tok = yylex()) == ',')
5975
6000
  {
@@ -6022,7 +6047,7 @@ read_into_scalar_list(char *initial_name,
6022
6047
  row->varnos[nfields] = varnos[nfields];
6023
6048
  }
6024
6049
 
6025
- plpgsql_adddatum((PLpgSQL_datum *)row);
6050
+ plpgsql_adddatum((PLpgSQL_datum *) row);
6026
6051
 
6027
6052
  return row;
6028
6053
  }
@@ -6039,7 +6064,7 @@ make_scalar_list1(char *initial_name,
6039
6064
  PLpgSQL_datum *initial_datum,
6040
6065
  int lineno, int location)
6041
6066
  {
6042
- PLpgSQL_row *row;
6067
+ PLpgSQL_row *row;
6043
6068
 
6044
6069
  check_assignable(initial_datum, location);
6045
6070
 
@@ -6054,7 +6079,7 @@ make_scalar_list1(char *initial_name,
6054
6079
  row->fieldnames[0] = initial_name;
6055
6080
  row->varnos[0] = initial_datum->dno;
6056
6081
 
6057
- plpgsql_adddatum((PLpgSQL_datum *)row);
6082
+ plpgsql_adddatum((PLpgSQL_datum *) row);
6058
6083
 
6059
6084
  return row;
6060
6085
  }
@@ -6077,13 +6102,12 @@ make_scalar_list1(char *initial_name,
6077
6102
  * borders. So it is best to bail out as early as we can.
6078
6103
  *
6079
6104
  * It is assumed that "stmt" represents a copy of the function source text
6080
- * beginning at offset "location", with leader text of length "leaderlen"
6081
- * (typically "SELECT ") prefixed to the source text. We use this assumption
6082
- * to transpose any error cursor position back to the function source text.
6105
+ * beginning at offset "location". We use this assumption to transpose
6106
+ * any error cursor position back to the function source text.
6083
6107
  * If no error cursor is provided, we'll just point at "location".
6084
6108
  */
6085
6109
  static void
6086
- check_sql_expr(const char *stmt, int location, int leaderlen)
6110
+ check_sql_expr(const char *stmt, RawParseMode parseMode, int location)
6087
6111
  {
6088
6112
  sql_error_callback_arg cbarg;
6089
6113
  ErrorContextCallback syntax_errcontext;
@@ -6093,7 +6117,6 @@ check_sql_expr(const char *stmt, int location, int leaderlen)
6093
6117
  return;
6094
6118
 
6095
6119
  cbarg.location = location;
6096
- cbarg.leaderlen = leaderlen;
6097
6120
 
6098
6121
  syntax_errcontext.callback = plpgsql_sql_error_callback;
6099
6122
  syntax_errcontext.arg = &cbarg;
@@ -6101,7 +6124,7 @@ check_sql_expr(const char *stmt, int location, int leaderlen)
6101
6124
  error_context_stack = &syntax_errcontext;
6102
6125
 
6103
6126
  oldCxt = MemoryContextSwitchTo(plpgsql_compile_tmp_cxt);
6104
- (void) raw_parser(stmt);
6127
+ (void) raw_parser(stmt, parseMode);
6105
6128
  MemoryContextSwitchTo(oldCxt);
6106
6129
 
6107
6130
  /* Restore former ereport callback */
@@ -6126,12 +6149,12 @@ plpgsql_sql_error_callback(void *arg)
6126
6149
  * Note we are dealing with 1-based character numbers at this point.
6127
6150
  */
6128
6151
  errpos = geterrposition();
6129
- if (errpos > cbarg->leaderlen)
6152
+ if (errpos > 0)
6130
6153
  {
6131
- int myerrpos = getinternalerrposition();
6154
+ int myerrpos = getinternalerrposition();
6132
6155
 
6133
6156
  if (myerrpos > 0) /* safety check */
6134
- internalerrposition(myerrpos + errpos - cbarg->leaderlen - 1);
6157
+ internalerrposition(myerrpos + errpos - 1);
6135
6158
  }
6136
6159
 
6137
6160
  /* In any case, flush errposition --- we want internalerrposition only */
@@ -6147,7 +6170,30 @@ plpgsql_sql_error_callback(void *arg)
6147
6170
  * This is handled the same as in check_sql_expr(), and we likewise
6148
6171
  * expect that the given string is a copy from the source text.
6149
6172
  */
6150
- static PLpgSQL_type * parse_datatype(const char *string, int location) { PLpgSQL_type *typ; typ = (PLpgSQL_type *) palloc0(sizeof(PLpgSQL_type)); typ->typname = pstrdup(string); typ->ttype = strcmp(string, "RECORD") == 0 ? PLPGSQL_TTYPE_REC : PLPGSQL_TTYPE_SCALAR; return typ; }
6173
+
6174
+ #include "catalog/pg_collation_d.h"
6175
+ static PLpgSQL_type * parse_datatype(const char *string, int location) {
6176
+ PLpgSQL_type *typ;
6177
+
6178
+ /* Ignore trailing spaces */
6179
+ size_t len = strlen(string);
6180
+ while (len > 0 && scanner_isspace(string[len - 1])) --len;
6181
+
6182
+ typ = (PLpgSQL_type *) palloc0(sizeof(PLpgSQL_type));
6183
+ typ->typname = pstrdup(string);
6184
+ typ->ttype = pg_strncasecmp(string, "RECORD", len) == 0 ? PLPGSQL_TTYPE_REC : PLPGSQL_TTYPE_SCALAR;
6185
+ if (pg_strncasecmp(string, "REFCURSOR", len) == 0 || pg_strncasecmp(string, "CURSOR", len) == 0)
6186
+ {
6187
+ typ->typoid = REFCURSOROID;
6188
+ }
6189
+ else if (pg_strncasecmp(string, "TEXT", len) == 0)
6190
+ {
6191
+ typ->typoid = TEXTOID;
6192
+ typ->collation = DEFAULT_COLLATION_OID;
6193
+ }
6194
+ return typ;
6195
+ }
6196
+
6151
6197
 
6152
6198
 
6153
6199
  /*
@@ -6185,7 +6231,7 @@ check_labels(const char *start_label, const char *end_label, int end_location)
6185
6231
  * parens).
6186
6232
  */
6187
6233
  static PLpgSQL_expr *
6188
- read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6234
+ read_cursor_args(PLpgSQL_var *cursor, int until)
6189
6235
  {
6190
6236
  PLpgSQL_expr *expr;
6191
6237
  PLpgSQL_row *row;
@@ -6193,7 +6239,6 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6193
6239
  int argc;
6194
6240
  char **argv;
6195
6241
  StringInfoData ds;
6196
- char *sqlstart = "SELECT ";
6197
6242
  bool any_named = false;
6198
6243
 
6199
6244
  tok = yylex();
@@ -6230,11 +6275,11 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6230
6275
  for (argc = 0; argc < row->nfields; argc++)
6231
6276
  {
6232
6277
  PLpgSQL_expr *item;
6233
- int endtoken;
6234
- int argpos;
6235
- int tok1,
6236
- tok2;
6237
- int arglocation;
6278
+ int endtoken;
6279
+ int argpos;
6280
+ int tok1,
6281
+ tok2;
6282
+ int arglocation;
6238
6283
 
6239
6284
  /* Check if it's a named parameter: "param := value" */
6240
6285
  plpgsql_peek2(&tok1, &tok2, &arglocation, NULL);
@@ -6287,19 +6332,15 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6287
6332
  * Read the value expression. To provide the user with meaningful
6288
6333
  * parse error positions, we check the syntax immediately, instead of
6289
6334
  * checking the final expression that may have the arguments
6290
- * reordered. Trailing whitespace must not be trimmed, because
6291
- * otherwise input of the form (param -- comment\n, param) would be
6292
- * translated into a form where the second parameter is commented
6293
- * out.
6335
+ * reordered.
6294
6336
  */
6295
6337
  item = read_sql_construct(',', ')', 0,
6296
6338
  ",\" or \")",
6297
- sqlstart,
6339
+ RAW_PARSE_PLPGSQL_EXPR,
6298
6340
  true, true,
6299
- false, /* do not trim */
6300
6341
  NULL, &endtoken);
6301
6342
 
6302
- argv[argpos] = item->query + strlen(sqlstart);
6343
+ argv[argpos] = item->query;
6303
6344
 
6304
6345
  if (endtoken == ')' && !(argc == row->nfields - 1))
6305
6346
  ereport(ERROR,
@@ -6318,7 +6359,6 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6318
6359
 
6319
6360
  /* Make positional argument list */
6320
6361
  initStringInfo(&ds);
6321
- appendStringInfoString(&ds, sqlstart);
6322
6362
  for (argc = 0; argc < row->nfields; argc++)
6323
6363
  {
6324
6364
  Assert(argv[argc] != NULL);
@@ -6334,14 +6374,14 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6334
6374
  if (argc < row->nfields - 1)
6335
6375
  appendStringInfoString(&ds, ", ");
6336
6376
  }
6337
- appendStringInfoChar(&ds, ';');
6338
6377
 
6339
6378
  expr = palloc0(sizeof(PLpgSQL_expr));
6340
- expr->query = pstrdup(ds.data);
6341
- expr->plan = NULL;
6342
- expr->paramnos = NULL;
6343
- expr->rwparam = -1;
6344
- expr->ns = plpgsql_ns_top();
6379
+ expr->query = pstrdup(ds.data);
6380
+ expr->parseMode = RAW_PARSE_PLPGSQL_EXPR;
6381
+ expr->plan = NULL;
6382
+ expr->paramnos = NULL;
6383
+ expr->target_param = -1;
6384
+ expr->ns = plpgsql_ns_top();
6345
6385
  pfree(ds.data);
6346
6386
 
6347
6387
  /* Next we'd better find the until token */
@@ -6363,7 +6403,7 @@ read_raise_options(void)
6363
6403
  for (;;)
6364
6404
  {
6365
6405
  PLpgSQL_raise_option *opt;
6366
- int tok;
6406
+ int tok;
6367
6407
 
6368
6408
  if ((tok = yylex()) == 0)
6369
6409
  yyerror("unexpected end of function definition");
@@ -6457,7 +6497,7 @@ static PLpgSQL_stmt *
6457
6497
  make_case(int location, PLpgSQL_expr *t_expr,
6458
6498
  List *case_when_list, List *else_stmts)
6459
6499
  {
6460
- PLpgSQL_stmt_case *new;
6500
+ PLpgSQL_stmt_case *new;
6461
6501
 
6462
6502
  new = palloc(sizeof(PLpgSQL_stmt_case));
6463
6503
  new->cmd_type = PLPGSQL_STMT_CASE;
@@ -6483,9 +6523,9 @@ make_case(int location, PLpgSQL_expr *t_expr,
6483
6523
  */
6484
6524
  if (t_expr)
6485
6525
  {
6486
- char varname[32];
6526
+ char varname[32];
6487
6527
  PLpgSQL_var *t_var;
6488
- ListCell *l;
6528
+ ListCell *l;
6489
6529
 
6490
6530
  /* use a name unlikely to collide with any user names */
6491
6531
  snprintf(varname, sizeof(varname), "__Case__Variable_%d__",
@@ -6508,16 +6548,16 @@ make_case(int location, PLpgSQL_expr *t_expr,
6508
6548
  {
6509
6549
  PLpgSQL_case_when *cwt = (PLpgSQL_case_when *) lfirst(l);
6510
6550
  PLpgSQL_expr *expr = cwt->expr;
6511
- StringInfoData ds;
6551
+ StringInfoData ds;
6512
6552
 
6513
- /* copy expression query without SELECT keyword (expr->query + 7) */
6514
- Assert(strncmp(expr->query, "SELECT ", 7) == 0);
6553
+ /* We expect to have expressions not statements */
6554
+ Assert(expr->parseMode == RAW_PARSE_PLPGSQL_EXPR);
6515
6555
 
6516
- /* And do the string hacking */
6556
+ /* Do the string hacking */
6517
6557
  initStringInfo(&ds);
6518
6558
 
6519
- appendStringInfo(&ds, "SELECT \"%s\" IN (%s)",
6520
- varname, expr->query + 7);
6559
+ appendStringInfo(&ds, "\"%s\" IN (%s)",
6560
+ varname, expr->query);
6521
6561
 
6522
6562
  pfree(expr->query);
6523
6563
  expr->query = pstrdup(ds.data);