pg_query 2.2.1 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (466) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -1
  3. data/README.md +29 -33
  4. data/Rakefile +2 -2
  5. data/ext/pg_query/include/access/amapi.h +45 -1
  6. data/ext/pg_query/include/access/attmap.h +1 -1
  7. data/ext/pg_query/include/access/attnum.h +2 -2
  8. data/ext/pg_query/include/access/clog.h +4 -2
  9. data/ext/pg_query/include/access/commit_ts.h +6 -9
  10. data/ext/pg_query/include/access/detoast.h +1 -11
  11. data/ext/pg_query/include/access/genam.h +15 -12
  12. data/ext/pg_query/include/access/gin.h +2 -2
  13. data/ext/pg_query/include/access/htup.h +1 -1
  14. data/ext/pg_query/include/access/htup_details.h +75 -87
  15. data/ext/pg_query/include/access/itup.h +7 -1
  16. data/ext/pg_query/include/access/parallel.h +2 -2
  17. data/ext/pg_query/include/access/printtup.h +1 -1
  18. data/ext/pg_query/include/access/relation.h +1 -1
  19. data/ext/pg_query/include/access/relscan.h +17 -2
  20. data/ext/pg_query/include/access/rmgr.h +30 -3
  21. data/ext/pg_query/include/access/rmgrlist.h +23 -23
  22. data/ext/pg_query/include/access/sdir.h +1 -1
  23. data/ext/pg_query/include/access/skey.h +1 -1
  24. data/ext/pg_query/include/access/stratnum.h +4 -2
  25. data/ext/pg_query/include/access/sysattr.h +1 -1
  26. data/ext/pg_query/include/access/table.h +2 -1
  27. data/ext/pg_query/include/access/tableam.h +272 -20
  28. data/ext/pg_query/include/access/toast_compression.h +73 -0
  29. data/ext/pg_query/include/access/transam.h +123 -13
  30. data/ext/pg_query/include/access/tupconvert.h +1 -1
  31. data/ext/pg_query/include/access/tupdesc.h +1 -1
  32. data/ext/pg_query/include/access/tupmacs.h +3 -3
  33. data/ext/pg_query/include/access/twophase.h +3 -1
  34. data/ext/pg_query/include/access/xact.h +73 -19
  35. data/ext/pg_query/include/access/xlog.h +60 -155
  36. data/ext/pg_query/include/access/xlog_internal.h +40 -13
  37. data/ext/pg_query/include/access/xlogdefs.h +8 -16
  38. data/ext/pg_query/include/access/xlogprefetcher.h +55 -0
  39. data/ext/pg_query/include/access/xlogreader.h +145 -39
  40. data/ext/pg_query/include/access/xlogrecord.h +18 -9
  41. data/ext/pg_query/include/access/xlogrecovery.h +157 -0
  42. data/ext/pg_query/include/c.h +101 -44
  43. data/ext/pg_query/include/catalog/catalog.h +3 -1
  44. data/ext/pg_query/include/catalog/catversion.h +2 -2
  45. data/ext/pg_query/include/catalog/dependency.h +8 -16
  46. data/ext/pg_query/include/catalog/genbki.h +83 -5
  47. data/ext/pg_query/include/catalog/index.h +18 -3
  48. data/ext/pg_query/include/catalog/indexing.h +12 -324
  49. data/ext/pg_query/include/catalog/namespace.h +4 -2
  50. data/ext/pg_query/include/catalog/objectaccess.h +70 -2
  51. data/ext/pg_query/include/catalog/objectaddress.h +11 -6
  52. data/ext/pg_query/include/catalog/pg_aggregate.h +14 -10
  53. data/ext/pg_query/include/catalog/pg_aggregate_d.h +2 -1
  54. data/ext/pg_query/include/catalog/pg_am.h +4 -1
  55. data/ext/pg_query/include/catalog/pg_am_d.h +3 -1
  56. data/ext/pg_query/include/catalog/pg_attribute.h +27 -10
  57. data/ext/pg_query/include/catalog/pg_attribute_d.h +21 -18
  58. data/ext/pg_query/include/catalog/pg_authid.h +7 -2
  59. data/ext/pg_query/include/catalog/pg_authid_d.h +17 -9
  60. data/ext/pg_query/include/catalog/pg_class.h +44 -14
  61. data/ext/pg_query/include/catalog/pg_class_d.h +30 -1
  62. data/ext/pg_query/include/catalog/pg_collation.h +33 -8
  63. data/ext/pg_query/include/catalog/pg_collation_d.h +20 -3
  64. data/ext/pg_query/include/catalog/pg_constraint.h +38 -12
  65. data/ext/pg_query/include/catalog/pg_constraint_d.h +10 -4
  66. data/ext/pg_query/include/catalog/pg_control.h +3 -5
  67. data/ext/pg_query/include/catalog/pg_conversion.h +7 -4
  68. data/ext/pg_query/include/catalog/pg_conversion_d.h +4 -1
  69. data/ext/pg_query/include/catalog/pg_depend.h +11 -7
  70. data/ext/pg_query/include/catalog/pg_depend_d.h +3 -1
  71. data/ext/pg_query/include/catalog/pg_event_trigger.h +9 -3
  72. data/ext/pg_query/include/catalog/pg_event_trigger_d.h +3 -1
  73. data/ext/pg_query/include/catalog/pg_index.h +17 -7
  74. data/ext/pg_query/include/catalog/pg_index_d.h +20 -17
  75. data/ext/pg_query/include/catalog/pg_language.h +10 -5
  76. data/ext/pg_query/include/catalog/pg_language_d.h +3 -1
  77. data/ext/pg_query/include/catalog/pg_namespace.h +7 -2
  78. data/ext/pg_query/include/catalog/pg_namespace_d.h +3 -1
  79. data/ext/pg_query/include/catalog/pg_opclass.h +8 -5
  80. data/ext/pg_query/include/catalog/pg_opclass_d.h +3 -1
  81. data/ext/pg_query/include/catalog/pg_operator.h +18 -15
  82. data/ext/pg_query/include/catalog/pg_operator_d.h +37 -1
  83. data/ext/pg_query/include/catalog/pg_opfamily.h +6 -3
  84. data/ext/pg_query/include/catalog/pg_opfamily_d.h +3 -1
  85. data/ext/pg_query/include/catalog/pg_parameter_acl.h +60 -0
  86. data/ext/pg_query/include/catalog/pg_parameter_acl_d.h +34 -0
  87. data/ext/pg_query/include/catalog/pg_partitioned_table.h +20 -9
  88. data/ext/pg_query/include/catalog/pg_partitioned_table_d.h +2 -1
  89. data/ext/pg_query/include/catalog/pg_proc.h +20 -11
  90. data/ext/pg_query/include/catalog/pg_proc_d.h +10 -8
  91. data/ext/pg_query/include/catalog/pg_publication.h +50 -7
  92. data/ext/pg_query/include/catalog/pg_publication_d.h +3 -1
  93. data/ext/pg_query/include/catalog/pg_replication_origin.h +6 -1
  94. data/ext/pg_query/include/catalog/pg_replication_origin_d.h +5 -1
  95. data/ext/pg_query/include/catalog/pg_statistic.h +19 -12
  96. data/ext/pg_query/include/catalog/pg_statistic_d.h +2 -1
  97. data/ext/pg_query/include/catalog/pg_statistic_ext.h +19 -5
  98. data/ext/pg_query/include/catalog/pg_statistic_ext_d.h +7 -2
  99. data/ext/pg_query/include/catalog/pg_transform.h +8 -5
  100. data/ext/pg_query/include/catalog/pg_transform_d.h +3 -1
  101. data/ext/pg_query/include/catalog/pg_trigger.h +24 -8
  102. data/ext/pg_query/include/catalog/pg_trigger_d.h +4 -1
  103. data/ext/pg_query/include/catalog/pg_ts_config.h +6 -3
  104. data/ext/pg_query/include/catalog/pg_ts_config_d.h +3 -1
  105. data/ext/pg_query/include/catalog/pg_ts_dict.h +8 -3
  106. data/ext/pg_query/include/catalog/pg_ts_dict_d.h +3 -1
  107. data/ext/pg_query/include/catalog/pg_ts_parser.h +6 -3
  108. data/ext/pg_query/include/catalog/pg_ts_parser_d.h +3 -1
  109. data/ext/pg_query/include/catalog/pg_ts_template.h +6 -3
  110. data/ext/pg_query/include/catalog/pg_ts_template_d.h +3 -1
  111. data/ext/pg_query/include/catalog/pg_type.h +55 -24
  112. data/ext/pg_query/include/catalog/pg_type_d.h +70 -31
  113. data/ext/pg_query/include/catalog/storage.h +5 -3
  114. data/ext/pg_query/include/commands/async.h +3 -4
  115. data/ext/pg_query/include/commands/dbcommands.h +2 -1
  116. data/ext/pg_query/include/commands/defrem.h +11 -24
  117. data/ext/pg_query/include/commands/event_trigger.h +2 -2
  118. data/ext/pg_query/include/commands/explain.h +1 -1
  119. data/ext/pg_query/include/commands/prepare.h +1 -1
  120. data/ext/pg_query/include/commands/tablespace.h +2 -2
  121. data/ext/pg_query/include/commands/trigger.h +18 -16
  122. data/ext/pg_query/include/commands/user.h +2 -2
  123. data/ext/pg_query/include/commands/vacuum.h +88 -41
  124. data/ext/pg_query/include/commands/variable.h +1 -1
  125. data/ext/pg_query/include/common/file_perm.h +4 -4
  126. data/ext/pg_query/include/common/hashfn.h +1 -1
  127. data/ext/pg_query/include/common/ip.h +1 -7
  128. data/ext/pg_query/include/common/keywords.h +2 -6
  129. data/ext/pg_query/include/common/kwlookup.h +1 -1
  130. data/ext/pg_query/include/common/pg_prng.h +60 -0
  131. data/ext/pg_query/include/common/relpath.h +2 -2
  132. data/ext/pg_query/include/common/string.h +24 -1
  133. data/ext/pg_query/include/common/unicode_combining_table.h +114 -2
  134. data/ext/pg_query/include/common/unicode_east_asian_fw_table.h +125 -0
  135. data/ext/pg_query/include/datatype/timestamp.h +40 -1
  136. data/ext/pg_query/include/executor/execdesc.h +1 -1
  137. data/ext/pg_query/include/executor/executor.h +65 -22
  138. data/ext/pg_query/include/executor/functions.h +17 -3
  139. data/ext/pg_query/include/executor/instrument.h +33 -16
  140. data/ext/pg_query/include/executor/spi.h +41 -3
  141. data/ext/pg_query/include/executor/tablefunc.h +1 -1
  142. data/ext/pg_query/include/executor/tuptable.h +1 -1
  143. data/ext/pg_query/include/fmgr.h +13 -7
  144. data/ext/pg_query/include/funcapi.h +16 -4
  145. data/ext/pg_query/include/getaddrinfo.h +1 -1
  146. data/ext/pg_query/include/jit/jit.h +11 -11
  147. data/ext/pg_query/include/kwlist_d.h +517 -494
  148. data/ext/pg_query/include/lib/dshash.h +112 -0
  149. data/ext/pg_query/include/lib/ilist.h +20 -1
  150. data/ext/pg_query/include/lib/pairingheap.h +1 -1
  151. data/ext/pg_query/include/lib/simplehash.h +140 -15
  152. data/ext/pg_query/include/lib/sort_template.h +432 -0
  153. data/ext/pg_query/include/lib/stringinfo.h +1 -1
  154. data/ext/pg_query/include/libpq/auth.h +6 -4
  155. data/ext/pg_query/include/libpq/crypt.h +5 -4
  156. data/ext/pg_query/include/libpq/hba.h +43 -4
  157. data/ext/pg_query/include/libpq/libpq-be.h +23 -6
  158. data/ext/pg_query/include/libpq/libpq.h +30 -20
  159. data/ext/pg_query/include/libpq/pqcomm.h +17 -31
  160. data/ext/pg_query/include/libpq/pqformat.h +1 -1
  161. data/ext/pg_query/include/libpq/pqsignal.h +4 -4
  162. data/ext/pg_query/include/mb/pg_wchar.h +105 -23
  163. data/ext/pg_query/include/mb/stringinfo_mb.h +1 -1
  164. data/ext/pg_query/include/miscadmin.h +47 -41
  165. data/ext/pg_query/include/nodes/bitmapset.h +1 -1
  166. data/ext/pg_query/include/nodes/execnodes.h +270 -78
  167. data/ext/pg_query/include/nodes/extensible.h +4 -2
  168. data/ext/pg_query/include/nodes/lockoptions.h +1 -1
  169. data/ext/pg_query/include/nodes/makefuncs.h +7 -6
  170. data/ext/pg_query/include/nodes/memnodes.h +5 -3
  171. data/ext/pg_query/include/nodes/nodeFuncs.h +1 -1
  172. data/ext/pg_query/include/nodes/nodes.h +30 -11
  173. data/ext/pg_query/include/nodes/params.h +1 -1
  174. data/ext/pg_query/include/nodes/parsenodes.h +322 -90
  175. data/ext/pg_query/include/nodes/pathnodes.h +243 -66
  176. data/ext/pg_query/include/nodes/pg_list.h +75 -69
  177. data/ext/pg_query/include/nodes/plannodes.h +111 -28
  178. data/ext/pg_query/include/nodes/primnodes.h +99 -47
  179. data/ext/pg_query/include/nodes/print.h +1 -1
  180. data/ext/pg_query/include/nodes/tidbitmap.h +1 -1
  181. data/ext/pg_query/include/nodes/value.h +58 -39
  182. data/ext/pg_query/include/optimizer/cost.h +9 -2
  183. data/ext/pg_query/include/optimizer/geqo.h +9 -7
  184. data/ext/pg_query/include/optimizer/geqo_gene.h +1 -1
  185. data/ext/pg_query/include/optimizer/optimizer.h +25 -17
  186. data/ext/pg_query/include/optimizer/paths.h +6 -6
  187. data/ext/pg_query/include/optimizer/planmain.h +15 -14
  188. data/ext/pg_query/include/parser/analyze.h +19 -5
  189. data/ext/pg_query/include/parser/gram.h +947 -913
  190. data/ext/pg_query/include/parser/gramparse.h +1 -1
  191. data/ext/pg_query/include/parser/kwlist.h +463 -453
  192. data/ext/pg_query/include/parser/parse_agg.h +2 -7
  193. data/ext/pg_query/include/parser/parse_coerce.h +3 -1
  194. data/ext/pg_query/include/parser/parse_expr.h +2 -3
  195. data/ext/pg_query/include/parser/parse_func.h +2 -1
  196. data/ext/pg_query/include/parser/parse_node.h +21 -9
  197. data/ext/pg_query/include/parser/parse_oper.h +1 -3
  198. data/ext/pg_query/include/parser/parse_relation.h +5 -4
  199. data/ext/pg_query/include/parser/parse_type.h +1 -1
  200. data/ext/pg_query/include/parser/parser.h +31 -4
  201. data/ext/pg_query/include/parser/parsetree.h +1 -1
  202. data/ext/pg_query/include/parser/scanner.h +1 -1
  203. data/ext/pg_query/include/parser/scansup.h +2 -5
  204. data/ext/pg_query/include/partitioning/partdefs.h +1 -1
  205. data/ext/pg_query/include/pg_config.h +83 -41
  206. data/ext/pg_query/include/pg_config_manual.h +74 -21
  207. data/ext/pg_query/include/pg_getopt.h +6 -6
  208. data/ext/pg_query/include/pg_query.h +5 -4
  209. data/ext/pg_query/include/pg_query_enum_defs.c +358 -241
  210. data/ext/pg_query/include/pg_query_fingerprint_conds.c +44 -7
  211. data/ext/pg_query/include/pg_query_fingerprint_defs.c +939 -113
  212. data/ext/pg_query/include/pg_query_outfuncs_conds.c +43 -13
  213. data/ext/pg_query/include/pg_query_outfuncs_defs.c +151 -26
  214. data/ext/pg_query/include/pg_query_readfuncs_conds.c +11 -2
  215. data/ext/pg_query/include/pg_query_readfuncs_defs.c +173 -30
  216. data/ext/pg_query/include/pg_trace.h +1 -1
  217. data/ext/pg_query/include/pgstat.h +449 -1238
  218. data/ext/pg_query/include/pgtime.h +14 -4
  219. data/ext/pg_query/include/pl_gram.h +126 -128
  220. data/ext/pg_query/include/pl_reserved_kwlist.h +1 -1
  221. data/ext/pg_query/include/pl_reserved_kwlist_d.h +10 -10
  222. data/ext/pg_query/include/pl_unreserved_kwlist.h +2 -3
  223. data/ext/pg_query/include/pl_unreserved_kwlist_d.h +54 -56
  224. data/ext/pg_query/include/plerrcodes.h +9 -1
  225. data/ext/pg_query/include/plpgsql.h +52 -54
  226. data/ext/pg_query/include/port/atomics/arch-arm.h +7 -1
  227. data/ext/pg_query/include/port/atomics/arch-ppc.h +1 -1
  228. data/ext/pg_query/include/port/atomics/arch-x86.h +1 -1
  229. data/ext/pg_query/include/port/atomics/fallback.h +1 -1
  230. data/ext/pg_query/include/port/atomics/generic-gcc.h +3 -3
  231. data/ext/pg_query/include/port/atomics/generic.h +1 -1
  232. data/ext/pg_query/include/port/atomics.h +1 -1
  233. data/ext/pg_query/include/port/pg_bitutils.h +40 -10
  234. data/ext/pg_query/include/port/pg_bswap.h +1 -1
  235. data/ext/pg_query/include/port/pg_crc32c.h +1 -1
  236. data/ext/pg_query/include/port.h +71 -46
  237. data/ext/pg_query/include/portability/instr_time.h +1 -1
  238. data/ext/pg_query/include/postgres.h +60 -16
  239. data/ext/pg_query/include/postmaster/autovacuum.h +17 -17
  240. data/ext/pg_query/include/postmaster/auxprocess.h +20 -0
  241. data/ext/pg_query/include/postmaster/bgworker.h +2 -1
  242. data/ext/pg_query/include/postmaster/bgworker_internals.h +2 -2
  243. data/ext/pg_query/include/postmaster/bgwriter.h +5 -5
  244. data/ext/pg_query/include/postmaster/fork_process.h +1 -1
  245. data/ext/pg_query/include/postmaster/interrupt.h +1 -1
  246. data/ext/pg_query/include/postmaster/pgarch.h +42 -8
  247. data/ext/pg_query/include/postmaster/postmaster.h +18 -17
  248. data/ext/pg_query/include/postmaster/startup.h +39 -0
  249. data/ext/pg_query/include/postmaster/syslogger.h +15 -10
  250. data/ext/pg_query/include/postmaster/walwriter.h +3 -3
  251. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +1419 -914
  252. data/ext/pg_query/include/protobuf/pg_query.pb.h +43678 -32769
  253. data/ext/pg_query/include/regex/regex.h +18 -16
  254. data/ext/pg_query/include/replication/logicallauncher.h +3 -5
  255. data/ext/pg_query/include/replication/logicalproto.h +161 -17
  256. data/ext/pg_query/include/replication/logicalworker.h +1 -1
  257. data/ext/pg_query/include/replication/origin.h +7 -7
  258. data/ext/pg_query/include/replication/reorderbuffer.h +259 -42
  259. data/ext/pg_query/include/replication/slot.h +22 -11
  260. data/ext/pg_query/include/replication/syncrep.h +5 -5
  261. data/ext/pg_query/include/replication/walreceiver.h +145 -13
  262. data/ext/pg_query/include/replication/walsender.h +8 -8
  263. data/ext/pg_query/include/rewrite/prs2lock.h +1 -1
  264. data/ext/pg_query/include/rewrite/rewriteHandler.h +1 -3
  265. data/ext/pg_query/include/rewrite/rewriteManip.h +1 -1
  266. data/ext/pg_query/include/rewrite/rewriteSupport.h +1 -1
  267. data/ext/pg_query/include/storage/backendid.h +3 -3
  268. data/ext/pg_query/include/storage/block.h +4 -10
  269. data/ext/pg_query/include/storage/buf.h +1 -1
  270. data/ext/pg_query/include/storage/bufmgr.h +19 -14
  271. data/ext/pg_query/include/storage/bufpage.h +6 -8
  272. data/ext/pg_query/include/storage/condition_variable.h +13 -2
  273. data/ext/pg_query/include/storage/dsm.h +4 -1
  274. data/ext/pg_query/include/storage/dsm_impl.h +3 -2
  275. data/ext/pg_query/include/storage/fd.h +33 -3
  276. data/ext/pg_query/include/storage/fileset.h +40 -0
  277. data/ext/pg_query/include/storage/ipc.h +4 -1
  278. data/ext/pg_query/include/storage/item.h +1 -1
  279. data/ext/pg_query/include/storage/itemid.h +1 -1
  280. data/ext/pg_query/include/storage/itemptr.h +3 -1
  281. data/ext/pg_query/include/storage/large_object.h +2 -2
  282. data/ext/pg_query/include/storage/latch.h +9 -13
  283. data/ext/pg_query/include/storage/lmgr.h +2 -1
  284. data/ext/pg_query/include/storage/lock.h +11 -8
  285. data/ext/pg_query/include/storage/lockdefs.h +2 -2
  286. data/ext/pg_query/include/storage/lwlock.h +5 -32
  287. data/ext/pg_query/include/storage/lwlocknames.h +0 -1
  288. data/ext/pg_query/include/storage/off.h +1 -1
  289. data/ext/pg_query/include/storage/pg_sema.h +1 -1
  290. data/ext/pg_query/include/storage/pg_shmem.h +9 -7
  291. data/ext/pg_query/include/storage/pmsignal.h +15 -4
  292. data/ext/pg_query/include/storage/predicate.h +4 -4
  293. data/ext/pg_query/include/storage/proc.h +173 -59
  294. data/ext/pg_query/include/storage/procarray.h +98 -0
  295. data/ext/pg_query/include/storage/proclist_types.h +1 -1
  296. data/ext/pg_query/include/storage/procsignal.h +3 -7
  297. data/ext/pg_query/include/storage/relfilenode.h +1 -1
  298. data/ext/pg_query/include/storage/s_lock.h +60 -21
  299. data/ext/pg_query/include/storage/sharedfileset.h +3 -11
  300. data/ext/pg_query/include/storage/shm_mq.h +5 -4
  301. data/ext/pg_query/include/storage/shm_toc.h +1 -1
  302. data/ext/pg_query/include/storage/shmem.h +1 -1
  303. data/ext/pg_query/include/storage/sinval.h +3 -3
  304. data/ext/pg_query/include/storage/sinvaladt.h +1 -1
  305. data/ext/pg_query/include/storage/smgr.h +10 -8
  306. data/ext/pg_query/include/storage/spin.h +2 -2
  307. data/ext/pg_query/include/storage/standby.h +13 -6
  308. data/ext/pg_query/include/storage/standbydefs.h +2 -2
  309. data/ext/pg_query/include/storage/sync.h +7 -3
  310. data/ext/pg_query/include/tcop/cmdtag.h +1 -1
  311. data/ext/pg_query/include/tcop/cmdtaglist.h +3 -2
  312. data/ext/pg_query/include/tcop/deparse_utility.h +1 -1
  313. data/ext/pg_query/include/tcop/dest.h +1 -1
  314. data/ext/pg_query/include/tcop/fastpath.h +1 -2
  315. data/ext/pg_query/include/tcop/pquery.h +1 -1
  316. data/ext/pg_query/include/tcop/tcopprot.h +19 -11
  317. data/ext/pg_query/include/tcop/utility.h +7 -3
  318. data/ext/pg_query/include/tsearch/ts_cache.h +2 -2
  319. data/ext/pg_query/include/utils/acl.h +24 -3
  320. data/ext/pg_query/include/utils/aclchk_internal.h +1 -1
  321. data/ext/pg_query/include/utils/array.h +7 -2
  322. data/ext/pg_query/include/utils/backend_progress.h +44 -0
  323. data/ext/pg_query/include/utils/backend_status.h +321 -0
  324. data/ext/pg_query/include/utils/builtins.h +10 -11
  325. data/ext/pg_query/include/utils/bytea.h +3 -2
  326. data/ext/pg_query/include/utils/catcache.h +1 -1
  327. data/ext/pg_query/include/utils/date.h +1 -1
  328. data/ext/pg_query/include/utils/datetime.h +8 -7
  329. data/ext/pg_query/include/utils/datum.h +9 -1
  330. data/ext/pg_query/include/utils/dsa.h +1 -1
  331. data/ext/pg_query/include/utils/dynahash.h +4 -3
  332. data/ext/pg_query/include/utils/elog.h +52 -21
  333. data/ext/pg_query/include/utils/errcodes.h +2 -0
  334. data/ext/pg_query/include/utils/expandeddatum.h +1 -1
  335. data/ext/pg_query/include/utils/expandedrecord.h +1 -1
  336. data/ext/pg_query/include/utils/float.h +7 -7
  337. data/ext/pg_query/include/utils/fmgroids.h +1300 -696
  338. data/ext/pg_query/include/utils/fmgrprotos.h +199 -16
  339. data/ext/pg_query/include/utils/fmgrtab.h +6 -5
  340. data/ext/pg_query/include/utils/guc.h +69 -43
  341. data/ext/pg_query/include/utils/guc_tables.h +23 -19
  342. data/ext/pg_query/include/utils/hsearch.h +15 -11
  343. data/ext/pg_query/include/utils/inval.h +4 -1
  344. data/ext/pg_query/include/utils/lsyscache.h +11 -1
  345. data/ext/pg_query/include/utils/memdebug.h +1 -1
  346. data/ext/pg_query/include/utils/memutils.h +8 -3
  347. data/ext/pg_query/include/utils/numeric.h +19 -5
  348. data/ext/pg_query/include/utils/palloc.h +25 -3
  349. data/ext/pg_query/include/utils/partcache.h +1 -1
  350. data/ext/pg_query/include/utils/pg_locale.h +17 -9
  351. data/ext/pg_query/include/utils/pg_lsn.h +1 -1
  352. data/ext/pg_query/include/utils/pgstat_internal.h +784 -0
  353. data/ext/pg_query/include/utils/pidfile.h +1 -1
  354. data/ext/pg_query/include/utils/plancache.h +6 -5
  355. data/ext/pg_query/include/utils/portal.h +10 -12
  356. data/ext/pg_query/include/utils/ps_status.h +1 -1
  357. data/ext/pg_query/include/utils/queryenvironment.h +1 -1
  358. data/ext/pg_query/include/utils/queryjumble.h +88 -0
  359. data/ext/pg_query/include/utils/regproc.h +14 -3
  360. data/ext/pg_query/include/utils/rel.h +71 -19
  361. data/ext/pg_query/include/utils/relcache.h +8 -5
  362. data/ext/pg_query/include/utils/reltrigger.h +1 -1
  363. data/ext/pg_query/include/utils/resowner.h +1 -1
  364. data/ext/pg_query/include/utils/rls.h +2 -2
  365. data/ext/pg_query/include/utils/ruleutils.h +4 -1
  366. data/ext/pg_query/include/utils/sharedtuplestore.h +1 -1
  367. data/ext/pg_query/include/utils/snapmgr.h +34 -14
  368. data/ext/pg_query/include/utils/snapshot.h +14 -1
  369. data/ext/pg_query/include/utils/sortsupport.h +117 -2
  370. data/ext/pg_query/include/utils/syscache.h +6 -1
  371. data/ext/pg_query/include/utils/timeout.h +11 -4
  372. data/ext/pg_query/include/utils/timestamp.h +6 -5
  373. data/ext/pg_query/include/utils/tuplesort.h +25 -11
  374. data/ext/pg_query/include/utils/tuplestore.h +2 -2
  375. data/ext/pg_query/include/utils/typcache.h +24 -17
  376. data/ext/pg_query/include/utils/tzparser.h +1 -1
  377. data/ext/pg_query/include/utils/varlena.h +5 -3
  378. data/ext/pg_query/include/utils/wait_event.h +289 -0
  379. data/ext/pg_query/include/utils/xml.h +4 -4
  380. data/ext/pg_query/pg_query.pb-c.c +4302 -2304
  381. data/ext/pg_query/pg_query_deparse.c +1106 -373
  382. data/ext/pg_query/pg_query_fingerprint.c +30 -10
  383. data/ext/pg_query/pg_query_json_plpgsql.c +0 -25
  384. data/ext/pg_query/pg_query_normalize.c +1 -1
  385. data/ext/pg_query/pg_query_outfuncs_json.c +54 -16
  386. data/ext/pg_query/pg_query_outfuncs_protobuf.c +70 -10
  387. data/ext/pg_query/pg_query_parse.c +1 -1
  388. data/ext/pg_query/pg_query_readfuncs_protobuf.c +42 -8
  389. data/ext/pg_query/pg_query_scan.c +2 -1
  390. data/ext/pg_query/pg_query_split.c +3 -2
  391. data/ext/pg_query/src_backend_catalog_namespace.c +20 -9
  392. data/ext/pg_query/src_backend_catalog_pg_proc.c +4 -1
  393. data/ext/pg_query/src_backend_commands_define.c +11 -1
  394. data/ext/pg_query/src_backend_nodes_bitmapset.c +3 -1
  395. data/ext/pg_query/src_backend_nodes_copyfuncs.c +401 -76
  396. data/ext/pg_query/src_backend_nodes_equalfuncs.c +290 -46
  397. data/ext/pg_query/src_backend_nodes_extensible.c +1 -1
  398. data/ext/pg_query/src_backend_nodes_list.c +74 -11
  399. data/ext/pg_query/src_backend_nodes_makefuncs.c +5 -4
  400. data/ext/pg_query/src_backend_nodes_nodeFuncs.c +55 -12
  401. data/ext/pg_query/src_backend_nodes_value.c +28 -19
  402. data/ext/pg_query/src_backend_parser_gram.c +33874 -31261
  403. data/ext/pg_query/src_backend_parser_parser.c +26 -7
  404. data/ext/pg_query/src_backend_parser_scan.c +172 -209
  405. data/ext/pg_query/src_backend_parser_scansup.c +4 -28
  406. data/ext/pg_query/src_backend_postmaster_postmaster.c +77 -106
  407. data/ext/pg_query/src_backend_storage_ipc_ipc.c +13 -4
  408. data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +5 -4
  409. data/ext/pg_query/src_backend_tcop_postgres.c +62 -23
  410. data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +140 -0
  411. data/ext/pg_query/src_backend_utils_adt_datum.c +13 -1
  412. data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
  413. data/ext/pg_query/src_backend_utils_adt_format_type.c +6 -2
  414. data/ext/pg_query/src_backend_utils_adt_ruleutils.c +71 -5
  415. data/ext/pg_query/src_backend_utils_error_assert.c +16 -14
  416. data/ext/pg_query/src_backend_utils_error_elog.c +172 -99
  417. data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +12 -17
  418. data/ext/pg_query/src_backend_utils_hash_dynahash.c +40 -10
  419. data/ext/pg_query/src_backend_utils_init_globals.c +5 -5
  420. data/ext/pg_query/src_backend_utils_mb_mbutils.c +55 -66
  421. data/ext/pg_query/src_backend_utils_misc_guc.c +206 -45
  422. data/ext/pg_query/src_backend_utils_mmgr_aset.c +7 -5
  423. data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +123 -35
  424. data/ext/pg_query/src_common_encnames.c +1 -1
  425. data/ext/pg_query/src_common_hashfn.c +3 -3
  426. data/ext/pg_query/src_common_keywords.c +15 -2
  427. data/ext/pg_query/src_common_kwlist_d.h +517 -494
  428. data/ext/pg_query/src_common_kwlookup.c +1 -1
  429. data/ext/pg_query/src_common_pg_prng.c +152 -0
  430. data/ext/pg_query/src_common_psprintf.c +1 -1
  431. data/ext/pg_query/src_common_string.c +7 -1
  432. data/ext/pg_query/src_common_stringinfo.c +1 -1
  433. data/ext/pg_query/src_common_wchar.c +701 -109
  434. data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +45 -20
  435. data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +1 -18
  436. data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1233 -1259
  437. data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
  438. data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +10 -10
  439. data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +2 -2
  440. data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +54 -56
  441. data/ext/pg_query/src_port_pg_bitutils.c +41 -31
  442. data/ext/pg_query/src_port_pgsleep.c +1 -1
  443. data/ext/pg_query/src_port_pgstrcasecmp.c +1 -1
  444. data/ext/pg_query/src_port_qsort.c +12 -224
  445. data/ext/pg_query/src_port_snprintf.c +37 -13
  446. data/ext/pg_query/src_port_strerror.c +9 -19
  447. data/ext/pg_query/src_port_strnlen.c +1 -1
  448. data/lib/pg_query/filter_columns.rb +1 -1
  449. data/lib/pg_query/fingerprint.rb +5 -1
  450. data/lib/pg_query/node.rb +2 -2
  451. data/lib/pg_query/param_refs.rb +1 -1
  452. data/lib/pg_query/parse.rb +18 -8
  453. data/lib/pg_query/pg_query_pb.rb +1108 -942
  454. data/lib/pg_query/truncate.rb +1 -1
  455. data/lib/pg_query/version.rb +1 -1
  456. metadata +28 -18
  457. data/ext/pg_query/include/access/xloginsert.h +0 -64
  458. data/ext/pg_query/include/bootstrap/bootstrap.h +0 -62
  459. data/ext/pg_query/include/parser/parse_clause.h +0 -54
  460. data/ext/pg_query/include/parser/parse_collate.h +0 -27
  461. data/ext/pg_query/include/parser/parse_target.h +0 -46
  462. data/ext/pg_query/pg_query_ruby_freebsd.sym +0 -2
  463. data/ext/pg_query/src_backend_libpq_pqcomm.c +0 -659
  464. data/ext/pg_query/src_backend_parser_parse_expr.c +0 -313
  465. data/ext/pg_query/src_port_erand48.c +0 -127
  466. data/ext/pg_query/src_port_random.c +0 -31
@@ -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,29 +204,29 @@
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,
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_PRINT_STRICT_PARAMS = 357,
226
+ K_PRIOR = 358,
227
+ K_QUERY = 359,
228
+ K_RAISE = 360,
229
+ K_RELATIVE = 361,
230
230
  K_RETURN = 362,
231
231
  K_RETURNED_SQLSTATE = 363,
232
232
  K_REVERSE = 364,
@@ -236,23 +236,22 @@
236
236
  K_SCHEMA = 368,
237
237
  K_SCHEMA_NAME = 369,
238
238
  K_SCROLL = 370,
239
- K_SET = 371,
240
- K_SLICE = 372,
241
- K_SQLSTATE = 373,
242
- K_STACKED = 374,
243
- K_STRICT = 375,
244
- K_TABLE = 376,
245
- K_TABLE_NAME = 377,
246
- K_THEN = 378,
247
- K_TO = 379,
248
- K_TYPE = 380,
249
- K_USE_COLUMN = 381,
250
- K_USE_VARIABLE = 382,
251
- K_USING = 383,
252
- K_VARIABLE_CONFLICT = 384,
253
- K_WARNING = 385,
254
- K_WHEN = 386,
255
- K_WHILE = 387
239
+ K_SLICE = 371,
240
+ K_SQLSTATE = 372,
241
+ K_STACKED = 373,
242
+ K_STRICT = 374,
243
+ K_TABLE = 375,
244
+ K_TABLE_NAME = 376,
245
+ K_THEN = 377,
246
+ K_TO = 378,
247
+ K_TYPE = 379,
248
+ K_USE_COLUMN = 380,
249
+ K_USE_VARIABLE = 381,
250
+ K_USING = 382,
251
+ K_VARIABLE_CONFLICT = 383,
252
+ K_WARNING = 384,
253
+ K_WHEN = 385,
254
+ K_WHILE = 386
256
255
  };
257
256
  #endif
258
257
  /* Tokens. */
@@ -337,29 +336,29 @@
337
336
  #define K_LAST 336
338
337
  #define K_LOG 337
339
338
  #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
339
+ #define K_MERGE 339
340
+ #define K_MESSAGE 340
341
+ #define K_MESSAGE_TEXT 341
342
+ #define K_MOVE 342
343
+ #define K_NEXT 343
344
+ #define K_NO 344
345
+ #define K_NOT 345
346
+ #define K_NOTICE 346
347
+ #define K_NULL 347
348
+ #define K_OPEN 348
349
+ #define K_OPTION 349
350
+ #define K_OR 350
351
+ #define K_PERFORM 351
352
+ #define K_PG_CONTEXT 352
353
+ #define K_PG_DATATYPE_NAME 353
354
+ #define K_PG_EXCEPTION_CONTEXT 354
355
+ #define K_PG_EXCEPTION_DETAIL 355
356
+ #define K_PG_EXCEPTION_HINT 356
357
+ #define K_PRINT_STRICT_PARAMS 357
358
+ #define K_PRIOR 358
359
+ #define K_QUERY 359
360
+ #define K_RAISE 360
361
+ #define K_RELATIVE 361
363
362
  #define K_RETURN 362
364
363
  #define K_RETURNED_SQLSTATE 363
365
364
  #define K_REVERSE 364
@@ -369,23 +368,22 @@
369
368
  #define K_SCHEMA 368
370
369
  #define K_SCHEMA_NAME 369
371
370
  #define K_SCROLL 370
372
- #define K_SET 371
373
- #define K_SLICE 372
374
- #define K_SQLSTATE 373
375
- #define K_STACKED 374
376
- #define K_STRICT 375
377
- #define K_TABLE 376
378
- #define K_TABLE_NAME 377
379
- #define K_THEN 378
380
- #define K_TO 379
381
- #define K_TYPE 380
382
- #define K_USE_COLUMN 381
383
- #define K_USE_VARIABLE 382
384
- #define K_USING 383
385
- #define K_VARIABLE_CONFLICT 384
386
- #define K_WARNING 385
387
- #define K_WHEN 386
388
- #define K_WHILE 387
371
+ #define K_SLICE 371
372
+ #define K_SQLSTATE 372
373
+ #define K_STACKED 373
374
+ #define K_STRICT 374
375
+ #define K_TABLE 375
376
+ #define K_TABLE_NAME 376
377
+ #define K_THEN 377
378
+ #define K_TO 378
379
+ #define K_TYPE 379
380
+ #define K_USE_COLUMN 380
381
+ #define K_USE_VARIABLE 381
382
+ #define K_USING 382
383
+ #define K_VARIABLE_CONFLICT 383
384
+ #define K_WARNING 384
385
+ #define K_WHEN 385
386
+ #define K_WHILE 386
389
387
 
390
388
 
391
389
 
@@ -397,7 +395,7 @@
397
395
  *
398
396
  * pl_gram.y - Parser for the PL/pgSQL procedural language
399
397
  *
400
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
398
+ * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
401
399
  * Portions Copyright (c) 1994, Regents of the University of California
402
400
  *
403
401
  *
@@ -445,7 +443,6 @@
445
443
  typedef struct
446
444
  {
447
445
  int location;
448
- int leaderlen;
449
446
  } sql_error_callback_arg;
450
447
 
451
448
  #define parser_errposition(pos) plpgsql_scanner_errposition(pos)
@@ -461,7 +458,7 @@ static PLpgSQL_expr *read_sql_construct(int until,
461
458
  int until2,
462
459
  int until3,
463
460
  const char *expected,
464
- const char *sqlstart,
461
+ RawParseMode parsemode,
465
462
  bool isexpression,
466
463
  bool valid_sql,
467
464
  bool trim,
@@ -472,7 +469,7 @@ static PLpgSQL_expr *read_sql_expression(int until,
472
469
  static PLpgSQL_expr *read_sql_expression2(int until, int until2,
473
470
  const char *expected,
474
471
  int *endtoken);
475
- static PLpgSQL_expr *read_sql_stmt(const char *sqlstart);
472
+ static PLpgSQL_expr *read_sql_stmt(void);
476
473
  static PLpgSQL_type *read_datatype(int tok);
477
474
  static PLpgSQL_stmt *make_execsql_stmt(int firsttoken, int location);
478
475
  static PLpgSQL_stmt_fetch *read_fetch_direction(void);
@@ -493,15 +490,15 @@ static PLpgSQL_row *read_into_scalar_list(char *initial_name,
493
490
  static PLpgSQL_row *make_scalar_list1(char *initial_name,
494
491
  PLpgSQL_datum *initial_datum,
495
492
  int lineno, int location);
496
- static void check_sql_expr(const char *stmt, int location,
497
- int leaderlen);
493
+ static void check_sql_expr(const char *stmt,
494
+ RawParseMode parseMode, int location);
498
495
  static void plpgsql_sql_error_callback(void *arg);
499
496
  static PLpgSQL_type *parse_datatype(const char *string, int location);
500
497
  static void check_labels(const char *start_label,
501
498
  const char *end_label,
502
499
  int end_location);
503
500
  static PLpgSQL_expr *read_cursor_args(PLpgSQL_var *cursor,
504
- int until, const char *expected);
501
+ int until);
505
502
  static List *read_raise_options(void);
506
503
  static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
507
504
 
@@ -529,57 +526,57 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
529
526
  typedef union YYSTYPE
530
527
  #line 120 "pl_gram.y"
531
528
  {
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;
529
+ core_YYSTYPE core_yystype;
530
+ /* these fields must match core_YYSTYPE: */
531
+ int ival;
532
+ char *str;
533
+ const char *keyword;
534
+
535
+ PLword word;
536
+ PLcword cword;
537
+ PLwdatum wdatum;
538
+ bool boolean;
539
+ Oid oid;
540
+ struct
541
+ {
542
+ char *name;
543
+ int lineno;
544
+ } varname;
545
+ struct
546
+ {
547
+ char *name;
548
+ int lineno;
549
+ PLpgSQL_datum *scalar;
550
+ PLpgSQL_datum *row;
551
+ } forvariable;
552
+ struct
553
+ {
554
+ char *label;
555
+ int n_initvars;
556
+ int *initvarnos;
557
+ } declhdr;
558
+ struct
559
+ {
560
+ List *stmts;
561
+ char *end_label;
562
+ int end_label_location;
563
+ } loop_body;
564
+ List *list;
565
+ PLpgSQL_type *dtype;
566
+ PLpgSQL_datum *datum;
567
+ PLpgSQL_var *var;
568
+ PLpgSQL_expr *expr;
569
+ PLpgSQL_stmt *stmt;
570
+ PLpgSQL_condition *condition;
571
+ PLpgSQL_exception *exception;
572
+ PLpgSQL_exception_block *exception_block;
573
+ PLpgSQL_nsitem *nsitem;
574
+ PLpgSQL_diag_item *diagitem;
575
+ PLpgSQL_stmt_fetch *fetch;
576
+ PLpgSQL_case_when *casewhen;
580
577
  }
581
578
  /* Line 193 of yacc.c. */
582
- #line 534 "pl_gram.c"
579
+ #line 531 "pl_gram.c"
583
580
  YYSTYPE;
584
581
  # define yystype YYSTYPE /* obsolescent; will be withdrawn */
585
582
  # define YYSTYPE_IS_DECLARED 1
@@ -604,7 +601,7 @@ typedef struct YYLTYPE
604
601
 
605
602
 
606
603
  /* Line 216 of yacc.c. */
607
- #line 559 "pl_gram.c"
604
+ #line 556 "pl_gram.c"
608
605
 
609
606
  #ifdef short
610
607
  # undef short
@@ -821,20 +818,20 @@ union yyalloc
821
818
  /* YYFINAL -- State number of the termination state. */
822
819
  #define YYFINAL 3
823
820
  /* YYLAST -- Last index in YYTABLE. */
824
- #define YYLAST 1465
821
+ #define YYLAST 1382
825
822
 
826
823
  /* YYNTOKENS -- Number of terminals. */
827
- #define YYNTOKENS 140
824
+ #define YYNTOKENS 138
828
825
  /* YYNNTS -- Number of nonterminals. */
829
- #define YYNNTS 90
826
+ #define YYNNTS 87
830
827
  /* YYNRULES -- Number of rules. */
831
- #define YYNRULES 258
828
+ #define YYNRULES 252
832
829
  /* YYNRULES -- Number of states. */
833
- #define YYNSTATES 342
830
+ #define YYNSTATES 333
834
831
 
835
832
  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
836
833
  #define YYUNDEFTOK 2
837
- #define YYMAXUTOK 387
834
+ #define YYMAXUTOK 386
838
835
 
839
836
  #define YYTRANSLATE(YYX) \
840
837
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -845,13 +842,13 @@ static const yytype_uint8 yytranslate[] =
845
842
  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
846
843
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
847
844
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
848
- 2, 2, 2, 2, 2, 133, 2, 2, 2, 2,
849
- 135, 136, 2, 2, 137, 2, 2, 2, 2, 2,
850
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 134,
851
- 2, 138, 2, 2, 2, 2, 2, 2, 2, 2,
845
+ 2, 2, 2, 2, 2, 132, 2, 2, 2, 2,
846
+ 134, 135, 2, 2, 136, 2, 2, 2, 2, 2,
847
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 133,
848
+ 2, 137, 2, 2, 2, 2, 2, 2, 2, 2,
849
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
852
850
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
853
851
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
854
- 2, 139, 2, 2, 2, 2, 2, 2, 2, 2,
855
852
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
856
853
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
857
854
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -880,7 +877,7 @@ static const yytype_uint8 yytranslate[] =
880
877
  95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
881
878
  105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
882
879
  115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
883
- 125, 126, 127, 128, 129, 130, 131, 132
880
+ 125, 126, 127, 128, 129, 130, 131
884
881
  };
885
882
 
886
883
  #if YYDEBUG
@@ -896,123 +893,121 @@ static const yytype_uint16 yyprhs[] =
896
893
  137, 140, 141, 144, 146, 148, 150, 152, 154, 156,
897
894
  157, 160, 163, 165, 167, 169, 171, 173, 175, 177,
898
895
  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
896
+ 199, 201, 203, 205, 207, 209, 211, 213, 215, 217,
897
+ 223, 224, 226, 228, 232, 234, 238, 239, 241, 243,
898
+ 245, 254, 255, 260, 261, 264, 272, 273, 276, 278,
899
+ 282, 283, 286, 290, 295, 300, 303, 305, 307, 309,
900
+ 318, 319, 322, 326, 328, 330, 332, 334, 336, 342,
901
+ 344, 346, 348, 350, 352, 354, 357, 362, 367, 368,
902
+ 372, 375, 379, 383, 386, 390, 391, 393, 395, 397,
903
+ 398, 399, 403, 406, 408, 413, 417, 419, 421, 422,
904
+ 423, 424, 425, 429, 430, 434, 435, 437, 439, 442,
905
+ 444, 446, 448, 450, 452, 454, 456, 458, 460, 462,
906
+ 464, 466, 468, 470, 472, 474, 476, 478, 480, 482,
907
+ 484, 486, 488, 490, 492, 494, 496, 498, 500, 502,
908
+ 504, 506, 508, 510, 512, 514, 516, 518, 520, 522,
909
+ 524, 526, 528, 530, 532, 534, 536, 538, 540, 542,
910
+ 544, 546, 548, 550, 552, 554, 556, 558, 560, 562,
911
+ 564, 566, 568, 570, 572, 574, 576, 578, 580, 582,
912
+ 584, 586, 588, 590, 592, 594, 596, 598, 600, 602,
913
+ 604, 606, 608
917
914
  };
918
915
 
919
916
  /* YYRHS -- A `-1'-separated list of the rules' RHS. */
920
917
  static const yytype_int16 yyrhs[] =
921
918
  {
922
- 141, 0, -1, 142, 146, 145, -1, -1, 142, 143,
923
- -1, 133, 93, 57, -1, 133, 101, 144, -1, 133,
924
- 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
919
+ 139, 0, -1, 140, 144, 143, -1, -1, 140, 141,
920
+ -1, 132, 94, 57, -1, 132, 102, 142, -1, 132,
921
+ 128, 62, -1, 132, 128, 126, -1, 132, 128, 125,
922
+ -1, 22, -1, 224, -1, -1, 133, -1, 145, 34,
923
+ 166, 210, 60, 221, -1, 219, -1, 219, 146, -1,
924
+ 219, 146, 147, -1, 52, -1, 147, 148, -1, 148,
925
+ -1, 149, -1, 52, -1, 25, 223, 26, -1, 158,
926
+ 159, 160, 161, 162, 163, -1, 158, 28, 68, 157,
927
+ 133, -1, -1, 158, 151, 49, 150, 153, 156, 152,
928
+ -1, -1, 89, 115, -1, 115, -1, -1, -1, 134,
929
+ 154, 135, -1, 155, -1, 154, 136, 155, -1, 158,
930
+ 160, -1, 80, -1, 68, -1, 22, -1, 224, -1,
931
+ 23, -1, 22, -1, 224, -1, -1, 44, -1, -1,
932
+ -1, 40, 22, -1, 40, 224, -1, 40, 23, -1,
933
+ -1, 90, 92, -1, 133, -1, 164, -1, 165, -1,
934
+ 53, -1, 137, -1, 15, -1, -1, 166, 167, -1,
935
+ 144, 133, -1, 170, -1, 177, -1, 180, -1, 185,
936
+ -1, 186, -1, 187, -1, 190, -1, 192, -1, 194,
937
+ -1, 195, -1, 196, -1, 198, -1, 199, -1, 168,
938
+ -1, 169, -1, 171, -1, 200, -1, 201, -1, 202,
939
+ -1, 204, -1, 205, -1, 206, -1, 207, -1, 96,
940
+ -1, 36, -1, 56, -1, 24, -1, 72, 172, 55,
941
+ 173, 133, -1, -1, 48, -1, 118, -1, 173, 136,
942
+ 174, -1, 174, -1, 176, 165, 175, -1, -1, 24,
943
+ -1, 22, -1, 23, -1, 74, 217, 166, 178, 179,
944
+ 60, 74, 133, -1, -1, 178, 59, 217, 166, -1,
945
+ -1, 58, 166, -1, 37, 181, 182, 184, 60, 37,
946
+ 133, -1, -1, 182, 183, -1, 183, -1, 130, 217,
947
+ 166, -1, -1, 58, 166, -1, 220, 83, 197, -1,
948
+ 220, 131, 218, 197, -1, 220, 68, 188, 197, -1,
949
+ 189, 76, -1, 24, -1, 22, -1, 23, -1, 220,
950
+ 69, 189, 191, 76, 31, 218, 197, -1, -1, 116,
951
+ 11, -1, 193, 221, 222, -1, 65, -1, 47, -1,
952
+ 107, -1, 105, -1, 32, -1, 166, 60, 83, 221,
953
+ 133, -1, 75, -1, 78, -1, 84, -1, 22, -1,
954
+ 23, -1, 64, -1, 93, 209, -1, 66, 203, 209,
955
+ 79, -1, 87, 203, 209, 133, -1, -1, 39, 209,
956
+ 133, -1, 92, 133, -1, 43, 208, 133, -1, 110,
957
+ 208, 133, -1, 30, 38, -1, 30, 89, 38, -1,
958
+ -1, 24, -1, 22, -1, 23, -1, -1, -1, 63,
959
+ 211, 212, -1, 212, 213, -1, 213, -1, 130, 214,
960
+ 122, 166, -1, 214, 95, 215, -1, 215, -1, 223,
961
+ -1, -1, -1, -1, -1, 25, 223, 26, -1, -1,
962
+ 25, 223, 26, -1, -1, 223, -1, 133, -1, 130,
963
+ 216, -1, 22, -1, 224, -1, 24, -1, 27, -1,
964
+ 28, -1, 30, -1, 31, -1, 32, -1, 33, -1,
965
+ 36, -1, 38, -1, 39, -1, 40, -1, 41, -1,
966
+ 42, -1, 43, -1, 44, -1, 45, -1, 46, -1,
967
+ 47, -1, 48, -1, 49, -1, 50, -1, 51, -1,
968
+ 53, -1, 54, -1, 55, -1, 56, -1, 57, -1,
969
+ 59, -1, 61, -1, 62, -1, 63, -1, 65, -1,
970
+ 66, -1, 67, -1, 70, -1, 72, -1, 73, -1,
971
+ 75, -1, 77, -1, 78, -1, 80, -1, 81, -1,
972
+ 82, -1, 84, -1, 85, -1, 86, -1, 87, -1,
973
+ 88, -1, 89, -1, 91, -1, 93, -1, 94, -1,
974
+ 96, -1, 97, -1, 98, -1, 99, -1, 100, -1,
975
+ 101, -1, 102, -1, 103, -1, 104, -1, 105, -1,
976
+ 106, -1, 107, -1, 108, -1, 109, -1, 110, -1,
977
+ 111, -1, 112, -1, 113, -1, 114, -1, 115, -1,
978
+ 116, -1, 117, -1, 118, -1, 120, -1, 121, -1,
979
+ 124, -1, 125, -1, 126, -1, 128, -1, 129, -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, 362, 362, 368, 369, 372, 376, 385, 389, 393,
986
+ 399, 403, 408, 409, 412, 435, 443, 450, 459, 471,
987
+ 472, 475, 476, 480, 493, 531, 537, 536, 590, 593,
988
+ 597, 604, 610, 613, 644, 648, 654, 662, 663, 665,
989
+ 680, 695, 723, 751, 782, 783, 788, 799, 800, 805,
990
+ 810, 817, 818, 822, 824, 830, 831, 839, 840, 844,
991
+ 845, 855, 857, 859, 861, 863, 865, 867, 869, 871,
992
+ 873, 875, 877, 879, 881, 883, 885, 887, 889, 891,
993
+ 893, 895, 897, 899, 901, 905, 941, 959, 980, 1019,
994
+ 1082, 1085, 1089, 1095, 1099, 1105, 1118, 1162, 1180, 1185,
995
+ 1192, 1210, 1213, 1227, 1230, 1236, 1243, 1257, 1261, 1267,
996
+ 1279, 1282, 1297, 1315, 1334, 1368, 1627, 1653, 1667, 1674,
997
+ 1713, 1716, 1722, 1775, 1779, 1785, 1811, 1956, 1980, 1998,
998
+ 2002, 2006, 2010, 2021, 2034, 2098, 2176, 2206, 2219, 2224,
999
+ 2238, 2245, 2259, 2274, 2275, 2276, 2280, 2302, 2307, 2315,
1000
+ 2317, 2316, 2358, 2362, 2368, 2381, 2390, 2396, 2433, 2437,
1001
+ 2441, 2445, 2449, 2457, 2461, 2469, 2472, 2479, 2481, 2488,
1002
+ 2492, 2496, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512,
1003
+ 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522,
1004
+ 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532,
1005
+ 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542,
1006
+ 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552,
1007
+ 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562,
1008
+ 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572,
1009
+ 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582,
1010
+ 2583, 2584, 2585
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
1037
  "K_PRINT_STRICT_PARAMS", "K_PRIOR", "K_QUERY", "K_RAISE", "K_RELATIVE",
1043
- "K_RESET", "K_RETURN", "K_RETURNED_SQLSTATE", "K_REVERSE", "K_ROLLBACK",
1038
+ "K_RETURN", "K_RETURNED_SQLSTATE", "K_REVERSE", "K_ROLLBACK",
1044
1039
  "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",
1040
+ "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, 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, 138, 139, 140, 140, 141, 141, 141, 141, 141,
1095
+ 142, 142, 143, 143, 144, 145, 145, 145, 146, 147,
1096
+ 147, 148, 148, 148, 149, 149, 150, 149, 151, 151,
1097
+ 151, 152, 153, 153, 154, 154, 155, 156, 156, 157,
1098
+ 157, 157, 158, 158, 159, 159, 160, 161, 161, 161,
1099
+ 161, 162, 162, 163, 163, 164, 164, 165, 165, 166,
1100
+ 166, 167, 167, 167, 167, 167, 167, 167, 167, 167,
1101
+ 167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
1102
+ 167, 167, 167, 167, 167, 168, 169, 169, 170, 171,
1103
+ 172, 172, 172, 173, 173, 174, 175, 176, 176, 176,
1104
+ 177, 178, 178, 179, 179, 180, 181, 182, 182, 183,
1105
+ 184, 184, 185, 186, 187, 188, 189, 189, 189, 190,
1106
+ 191, 191, 192, 193, 193, 194, 195, 196, 197, 198,
1107
+ 198, 198, 198, 198, 199, 200, 201, 202, 203, 204,
1108
+ 205, 206, 207, 208, 208, 208, 209, 209, 209, 210,
1109
+ 211, 210, 212, 212, 213, 214, 214, 215, 216, 217,
1110
+ 218, 219, 219, 220, 220, 221, 221, 222, 222, 223,
1111
+ 223, 223, 224, 224, 224, 224, 224, 224, 224, 224,
1112
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1113
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1114
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1115
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1116
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1117
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1118
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1119
+ 224, 224, 224
1125
1120
  };
1126
1121
 
1127
1122
  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -1135,16 +1130,16 @@ 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,
1142
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1148
1143
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1149
1144
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1150
1145
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -1152,467 +1147,448 @@ static const yytype_uint8 yyr2[] =
1152
1147
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1153
1148
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1154
1149
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1155
- 1, 1, 1, 1, 1, 1, 1, 1, 1
1150
+ 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, 0, 170, 0, 0, 0, 13, 2,
1168
+ 59, 18, 16, 162, 5, 10, 6, 11, 7, 9,
1169
+ 8, 163, 42, 0, 22, 17, 20, 21, 44, 43,
1170
+ 132, 133, 88, 0, 127, 86, 106, 0, 145, 124,
1171
+ 87, 150, 134, 123, 138, 90, 159, 129, 130, 131,
1172
+ 138, 0, 0, 85, 126, 125, 145, 0, 60, 75,
1173
+ 76, 62, 77, 63, 64, 65, 66, 67, 68, 69,
1174
+ 165, 70, 71, 72, 73, 74, 78, 79, 80, 81,
1175
+ 82, 83, 84, 0, 0, 0, 19, 0, 45, 0,
1176
+ 30, 0, 46, 0, 0, 147, 148, 146, 0, 0,
1177
+ 0, 0, 0, 91, 92, 0, 59, 0, 140, 135,
1178
+ 0, 61, 0, 166, 165, 0, 0, 59, 160, 23,
1179
+ 0, 29, 26, 47, 164, 159, 110, 108, 139, 143,
1180
+ 0, 141, 0, 151, 153, 0, 0, 163, 0, 142,
1181
+ 158, 167, 122, 14, 117, 118, 116, 59, 0, 120,
1182
+ 163, 112, 59, 39, 41, 0, 40, 32, 0, 51,
1183
+ 59, 59, 107, 0, 144, 0, 156, 157, 152, 136,
1184
+ 98, 99, 97, 0, 94, 0, 103, 137, 168, 114,
1185
+ 115, 0, 0, 0, 113, 25, 0, 0, 48, 50,
1186
+ 49, 0, 0, 163, 163, 0, 0, 59, 89, 0,
1187
+ 58, 57, 96, 59, 159, 0, 121, 0, 165, 0,
1188
+ 34, 46, 38, 37, 31, 52, 56, 53, 24, 54,
1189
+ 55, 0, 155, 163, 93, 95, 163, 59, 0, 160,
1190
+ 0, 33, 0, 36, 27, 105, 163, 0, 59, 128,
1191
+ 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, 106, 99, 147, 8, 102, 115,
1198
+ 116, 117, 247, 181, 324, 277, 299, 300, 304, 245,
1199
+ 118, 182, 213, 249, 282, 308, 309, 292, 240, 148,
1200
+ 149, 150, 151, 152, 195, 263, 264, 315, 265, 153,
1201
+ 266, 295, 154, 184, 216, 217, 253, 155, 156, 157,
1202
+ 237, 238, 158, 272, 159, 160, 161, 162, 163, 241,
1203
+ 164, 165, 166, 167, 168, 192, 169, 170, 171, 172,
1204
+ 190, 188, 173, 191, 223, 224, 255, 256, 268, 196,
1205
+ 242, 9, 174, 202, 232, 203, 94
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 -253
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
+ -253, 36, -20, -253, 353, -49, -253, -87, 14, -2,
1214
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1215
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1216
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1217
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1218
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1219
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1220
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1221
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1222
+ -253, -253, -253, 26, -253, -3, 674, -40, -253, -253,
1223
+ -253, -253, 245, -253, -253, -253, -253, -253, -253, -253,
1224
+ -253, 1041, -253, 353, -253, 245, -253, -253, -7, -253,
1225
+ -253, -253, -253, 353, -253, -253, -253, 49, 38, -253,
1226
+ -253, -253, -253, -253, -253, -38, -253, -253, -253, -253,
1227
+ -253, -59, 49, -253, -253, -253, 38, -34, -253, -253,
1228
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1229
+ 353, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1230
+ -253, -253, -253, 34, -50, 80, -253, 27, -253, -5,
1231
+ -253, 58, -253, 85, -17, -253, -253, -253, -19, 1,
1232
+ -16, -14, 49, -253, -253, 63, -253, 49, -253, -253,
1233
+ -11, -253, -98, -253, 353, 69, 69, -253, -253, -253,
1234
+ 461, -253, -253, 83, -8, -253, -41, -253, -253, -253,
1235
+ 88, -253, 353, -14, -253, 48, 81, 887, -1, -253,
1236
+ -253, -253, -253, -253, -253, -253, -253, -253, 52, 13,
1237
+ 1118, -253, -253, -253, -253, 0, -253, 2, 569, 40,
1238
+ -253, -253, -253, 71, -253, -64, -253, -253, -253, -253,
1239
+ -253, -253, -253, -72, -253, -12, 18, -253, -253, -253,
1240
+ -253, 123, 59, 54, -253, -253, 779, -39, -253, -253,
1241
+ -253, 46, -13, -9, 1195, 102, 353, -253, -253, 81,
1242
+ -253, -253, -253, -253, -253, 82, -253, 109, 353, -76,
1243
+ -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
1244
+ -253, 8, -253, 124, -253, -253, 1272, -253, 70, -253,
1245
+ 10, -253, 779, -253, -253, -253, 964, 12, -253, -253,
1246
+ -253, -253, -253
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
+ -253, -253, -253, -253, -253, -253, 148, -253, -253, -253,
1253
+ 37, -253, -253, -253, -253, -253, -253, -171, -253, -253,
1254
+ -252, -253, -144, -253, -253, -253, -253, -123, -96, -253,
1255
+ -253, -253, -253, -253, -253, -253, -127, -253, -253, -253,
1256
+ -253, -253, -253, -253, -253, -52, -253, -253, -253, -253,
1257
+ -253, -37, -253, -253, -253, -253, -253, -253, -253, -231,
1258
+ -253, -253, -253, -253, -253, 25, -253, -253, -253, -253,
1259
+ 20, -130, -253, -253, -253, -55, -253, -116, -253, -206,
1260
+ -147, -253, -253, -196, -253, -4, -95
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,
1305
- 0, 114, 0, 12, 13, 0, 14, 15, 16, 17,
1306
- 0, 0, 18, 268, 19, 20, 21, 22, 23, 24,
1307
- 25, 26, 27, 28, 29, 30, 31, 32, 115, 33,
1308
- 34, 35, 36, 37, 0, 38, 0, 39, 40, 41,
1309
- 0, 42, 43, 44, 0, 0, 45, 0, 46, 47,
1310
- 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,
1313
- 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
1314
- 81, 82, 83, 84, 85, 86, 0, 87, 88, 0,
1315
- 0, 89, 90, 91, 0, 92, 93, 10, 0, 11,
1316
- 0, 0, 12, 13, 0, 14, 15, 16, 17, 0,
1317
- 0, 18, 0, 19, 20, 21, 22, 23, 24, 25,
1318
- 26, 27, 28, 29, 30, 31, 32, 0, 33, 34,
1270
+ 93, 107, 290, 290, 111, 4, 269, 119, 233, 250,
1271
+ 193, 274, 199, 120, 121, 122, 123, 251, 205, 206,
1272
+ 119, 177, 108, 124, 301, -161, -162, 125, 126, 302,
1273
+ 127, 286, 230, 207, 128, 231, 3, 178, 129, 219,
1274
+ 306, 303, -28, -161, -162, 95, 98, 130, 100, -109,
1275
+ 101, -109, 103, 96, 104, 132, 133, 134, 287, 321,
1276
+ 322, 288, 225, 135, 289, 136, 137, 228, 189, 138,
1277
+ 301, 185, 186, 187, 198, 139, 293, 294, 140, 97,
1278
+ 194, 208, 179, 141, 142, 109, 110, 143, 317, 215,
1279
+ 220, 234, 235, 236, 204, 210, 144, 332, 145, 201,
1280
+ 227, 146, 320, 260, 261, 262, 209, 212, 180, 175,
1281
+ 211, 214, 5, 215, 218, 246, 222, 221, 226, 183,
1282
+ 307, -109, 229, 248, 291, 291, 254, 259, 270, 271,
1283
+ 281, 285, 267, 275, 296, 297, 276, 298, 305, 311,
1284
+ 319, 325, 318, 329, 327, 331, 120, 121, 122, 123,
1285
+ 7, 330, 176, 280, 283, 284, 124, 323, -161, 310,
1286
+ 125, 126, 314, 127, 252, 197, 200, 128, 258, 239,
1287
+ 312, 129, 328, 0, 0, 0, -161, 0, 0, 0,
1288
+ 130, 119, 0, 0, -154, 0, 0, 0, 132, 133,
1289
+ 134, 313, 0, 0, 0, 0, 135, 316, 136, 137,
1290
+ 0, 0, 138, 0, 0, 0, 0, 0, 139, 0,
1291
+ 0, 140, 0, 0, 0, 0, 141, 142, 257, 0,
1292
+ 143, 326, 0, 0, 0, 0, 0, 119, 0, 144,
1293
+ 0, 145, 0, 0, 146, 0, 0, 0, 0, 0,
1294
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1295
+ 0, 0, 0, 0, -154, 0, 0, 0, 0, 0,
1296
+ 0, 0, 0, 0, 0, 0, 0, 112, 0, 0,
1297
+ 113, 0, 12, 13, 0, 14, 15, 16, 17, 0,
1298
+ 0, 18, 257, 19, 20, 21, 22, 23, 24, 25,
1299
+ 26, 27, 28, 29, 30, 31, 32, 114, 33, 34,
1319
1300
  35, 36, 37, 0, 38, 0, 39, 40, 41, 0,
1320
1301
  42, 43, 44, 0, 0, 45, 0, 46, 47, 0,
1321
1302
  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,
1303
+ 55, 56, 57, 58, 59, 0, 60, 0, 61, 62,
1304
+ 0, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1324
1305
  72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1325
- 82, 83, 84, 85, 86, 0, 87, 88, 0, 0,
1326
- 89, 90, 91, 0, 92, 93, 254, 255, 0, 0,
1327
- 0, 12, 13, 0, 14, 15, 16, 17, 0, 0,
1328
- 18, 0, 19, 20, 21, 22, 23, 24, 25, 26,
1329
- 27, 28, 29, 30, 31, 32, 0, 33, 34, 35,
1330
- 36, 37, 0, 38, 0, 39, 40, 41, 0, 42,
1331
- 43, 44, 0, 0, 45, 0, 46, 47, 0, 48,
1332
- 0, 49, 50, 0, 51, 52, 53, 0, 54, 55,
1333
- 56, 57, 58, 0, 59, 0, 60, 61, 0, 62,
1334
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1335
- 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
1336
- 83, 84, 85, 86, 0, 87, 88, 0, 0, 89,
1337
- 90, 91, 0, 92, 93, 289, 290, 0, 0, 0,
1306
+ 82, 83, 84, 85, 0, 86, 87, 0, 0, 88,
1307
+ 89, 90, 0, 91, 92, 10, 0, 11, 0, 0,
1338
1308
  12, 13, 0, 14, 15, 16, 17, 0, 0, 18,
1339
1309
  0, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1340
1310
  28, 29, 30, 31, 32, 0, 33, 34, 35, 36,
1341
1311
  37, 0, 38, 0, 39, 40, 41, 0, 42, 43,
1342
1312
  44, 0, 0, 45, 0, 46, 47, 0, 48, 0,
1343
1313
  49, 50, 0, 51, 52, 53, 0, 54, 55, 56,
1344
- 57, 58, 0, 59, 0, 60, 61, 0, 62, 63,
1314
+ 57, 58, 59, 0, 60, 0, 61, 62, 0, 63,
1345
1315
  64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
1346
1316
  74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
1347
- 84, 85, 86, 0, 87, 88, 0, 0, 89, 90,
1348
- 91, 106, 92, 93, 0, 0, 12, 13, 0, 14,
1317
+ 84, 85, 0, 86, 87, 0, 0, 88, 89, 90,
1318
+ 0, 91, 92, 243, 244, 0, 0, 0, 12, 13,
1319
+ 0, 14, 15, 16, 17, 0, 0, 18, 0, 19,
1320
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1321
+ 30, 31, 32, 0, 33, 34, 35, 36, 37, 0,
1322
+ 38, 0, 39, 40, 41, 0, 42, 43, 44, 0,
1323
+ 0, 45, 0, 46, 47, 0, 48, 0, 49, 50,
1324
+ 0, 51, 52, 53, 0, 54, 55, 56, 57, 58,
1325
+ 59, 0, 60, 0, 61, 62, 0, 63, 64, 65,
1326
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
1327
+ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1328
+ 0, 86, 87, 0, 0, 88, 89, 90, 0, 91,
1329
+ 92, 278, 279, 0, 0, 0, 12, 13, 0, 14,
1349
1330
  15, 16, 17, 0, 0, 18, 0, 19, 20, 21,
1350
1331
  22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1351
1332
  32, 0, 33, 34, 35, 36, 37, 0, 38, 0,
1352
1333
  39, 40, 41, 0, 42, 43, 44, 0, 0, 45,
1353
1334
  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,
1335
+ 52, 53, 0, 54, 55, 56, 57, 58, 59, 0,
1336
+ 60, 0, 61, 62, 0, 63, 64, 65, 66, 67,
1356
1337
  68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
1357
- 78, 79, 80, 81, 82, 83, 84, 85, 86, 0,
1358
- 87, 88, 0, 0, 89, 90, 91, 113, 92, 93,
1359
- 0, 0, 12, 13, 0, 14, 15, 16, 17, 0,
1360
- 0, 18, 0, 19, 20, 21, 22, 23, 24, 25,
1361
- 26, 27, 28, 29, 30, 31, 32, 0, 33, 34,
1362
- 35, 36, 37, 0, 38, 0, 39, 40, 41, 0,
1363
- 42, 43, 44, 0, 0, 45, 0, 46, 47, 0,
1364
- 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,
1367
- 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1368
- 82, 83, 84, 85, 86, 0, 87, 88, 0, 0,
1369
- 89, 90, 91, 0, 92, 93, 121, 122, 123, 124,
1370
- 0, 0, 0, 0, 0, 0, 125, 0, -166, 0,
1371
- 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,
1374
- 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,
1338
+ 78, 79, 80, 81, 82, 83, 84, 85, 0, 86,
1339
+ 87, 0, 0, 88, 89, 90, 105, 91, 92, 0,
1340
+ 0, 12, 13, 0, 14, 15, 16, 17, 0, 0,
1341
+ 18, 0, 19, 20, 21, 22, 23, 24, 25, 26,
1342
+ 27, 28, 29, 30, 31, 32, 0, 33, 34, 35,
1343
+ 36, 37, 0, 38, 0, 39, 40, 41, 0, 42,
1344
+ 43, 44, 0, 0, 45, 0, 46, 47, 0, 48,
1345
+ 0, 49, 50, 0, 51, 52, 53, 0, 54, 55,
1346
+ 56, 57, 58, 59, 0, 60, 0, 61, 62, 0,
1347
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1348
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
1349
+ 83, 84, 85, 0, 86, 87, 0, 0, 88, 89,
1350
+ 90, 112, 91, 92, 0, 0, 12, 13, 0, 14,
1351
+ 15, 16, 17, 0, 0, 18, 0, 19, 20, 21,
1352
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1353
+ 32, 0, 33, 34, 35, 36, 37, 0, 38, 0,
1354
+ 39, 40, 41, 0, 42, 43, 44, 0, 0, 45,
1355
+ 0, 46, 47, 0, 48, 0, 49, 50, 0, 51,
1356
+ 52, 53, 0, 54, 55, 56, 57, 58, 59, 0,
1357
+ 60, 0, 61, 62, 0, 63, 64, 65, 66, 67,
1358
+ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
1359
+ 78, 79, 80, 81, 82, 83, 84, 85, 0, 86,
1360
+ 87, 0, 0, 88, 89, 90, 0, 91, 92, 120,
1361
+ 121, 122, 123, 0, 0, 0, 0, 0, 0, 124,
1362
+ 0, -161, 0, 125, 126, 0, 127, 0, 0, 0,
1363
+ 128, 0, 0, 0, 129, 0, 0, 0, 0, -161,
1364
+ 0, 0, 0, 130, 0, -101, -101, -101, 0, 0,
1365
+ 0, 132, 133, 134, 0, 0, 0, 0, 0, 135,
1366
+ 0, 136, 137, 0, 0, 138, 0, 0, 0, 0,
1367
+ 0, 139, 0, 0, 140, 0, 0, 0, 0, 141,
1368
+ 142, 0, 0, 143, 0, 0, 120, 121, 122, 123,
1369
+ 0, 0, 144, 0, 145, 0, 124, 146, -161, 0,
1370
+ 125, 126, 0, 127, 0, 0, 0, 128, 0, 0,
1371
+ 0, 129, 0, 0, 0, 0, -161, 0, 0, 0,
1372
+ 130, 0, -102, -102, -102, 0, 0, 0, 132, 133,
1373
+ 134, 0, 0, 0, 0, 0, 135, 0, 136, 137,
1374
+ 0, 0, 138, 0, 0, 0, 0, 0, 139, 0,
1375
+ 0, 140, 0, 0, 0, 0, 141, 142, 0, 0,
1376
+ 143, 0, 0, 120, 121, 122, 123, 0, 0, 144,
1377
+ 0, 145, 0, 124, 146, -161, 0, 125, 126, 0,
1378
+ 127, 0, 0, 0, 128, 0, 0, 0, 129, 0,
1379
+ 0, 0, 0, -161, 0, 0, 0, 130, 0, 0,
1380
+ 0, -149, 0, 0, 131, 132, 133, 134, 0, 0,
1381
+ 0, 0, 0, 135, 0, 136, 137, 0, 0, 138,
1382
+ 0, 0, 0, 0, 0, 139, 0, 0, 140, 0,
1383
+ 0, 0, 0, 141, 142, 0, 0, 143, 0, 0,
1384
+ 120, 121, 122, 123, 0, 0, 144, 0, 145, 0,
1385
+ 124, 146, -161, 0, 125, 126, 0, 127, 0, 0,
1386
+ 0, 128, 0, 0, 0, 129, 0, 0, 0, 0,
1387
+ -161, 0, 0, 0, 130, 0, 0, 0, 273, 0,
1388
+ 0, 0, 132, 133, 134, 0, 0, 0, 0, 0,
1389
+ 135, 0, 136, 137, 0, 0, 138, 0, 0, 0,
1390
+ 0, 0, 139, 0, 0, 140, 0, 0, 0, 0,
1391
+ 141, 142, 0, 0, 143, 0, 0, 120, 121, 122,
1392
+ 123, 0, 0, 144, 0, 145, 0, 124, 146, -161,
1393
+ 0, 125, 126, 0, 127, 0, 0, 0, 128, 0,
1394
+ 0, 0, 129, 0, 0, 0, 0, -161, 0, 0,
1395
+ 0, 130, 0, 0, 0, -111, 0, 0, 0, 132,
1396
+ 133, 134, 0, 0, 0, 0, 0, 135, 0, 136,
1397
+ 137, 0, 0, 138, 0, 0, 0, 0, 0, 139,
1398
+ 0, 0, 140, 0, 0, 0, 0, 141, 142, 0,
1399
+ 0, 143, 0, 0, 120, 121, 122, 123, 0, 0,
1400
+ 144, 0, 145, 0, 124, 146, -161, 0, 125, 126,
1401
+ 0, 127, 0, 0, 0, 128, 0, 0, 0, 129,
1402
+ 0, 0, 0, 0, -161, 0, 0, 0, 130, 0,
1403
+ 0, 0, -104, 0, 0, 0, 132, 133, 134, 0,
1404
+ 0, 0, 0, 0, 135, 0, 136, 137, 0, 0,
1405
+ 138, 0, 0, 0, 0, 0, 139, 0, 0, 140,
1385
1406
  0, 0, 0, 0, 141, 142, 0, 0, 143, 0,
1386
1407
  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,
1410
- 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
1408
+ 0, 0, 146
1424
1409
  };
1425
1410
 
1426
1411
  static const yytype_int16 yycheck[] =
1427
1412
  {
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,
1456
- -1, 25, -1, 27, 28, -1, 30, 31, 32, 33,
1457
- -1, -1, 36, 297, 38, 39, 40, 41, 42, 43,
1458
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
1459
- 54, 55, 56, 57, -1, 59, -1, 61, 62, 63,
1460
- -1, 65, 66, 67, -1, -1, 70, -1, 72, 73,
1461
- -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,
1464
- 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
1465
- 114, 115, 116, 117, 118, 119, -1, 121, 122, -1,
1466
- -1, 125, 126, 127, -1, 129, 130, 22, -1, 24,
1467
- -1, -1, 27, 28, -1, 30, 31, 32, 33, -1,
1468
- -1, 36, -1, 38, 39, 40, 41, 42, 43, 44,
1469
- 45, 46, 47, 48, 49, 50, 51, -1, 53, 54,
1413
+ 4, 96, 15, 15, 100, 25, 237, 102, 204, 215,
1414
+ 48, 242, 142, 22, 23, 24, 25, 58, 68, 69,
1415
+ 115, 28, 62, 32, 276, 34, 34, 36, 37, 68,
1416
+ 39, 95, 130, 83, 43, 133, 0, 44, 47, 38,
1417
+ 53, 80, 49, 52, 52, 94, 133, 56, 34, 58,
1418
+ 52, 60, 26, 102, 57, 64, 65, 66, 122, 135,
1419
+ 136, 133, 192, 72, 136, 74, 75, 197, 30, 78,
1420
+ 322, 22, 23, 24, 133, 84, 58, 59, 87, 128,
1421
+ 118, 131, 89, 92, 93, 125, 126, 96, 294, 130,
1422
+ 89, 22, 23, 24, 60, 68, 105, 328, 107, 133,
1423
+ 196, 110, 298, 22, 23, 24, 26, 49, 115, 113,
1424
+ 115, 26, 132, 130, 133, 210, 130, 133, 55, 123,
1425
+ 133, 130, 133, 40, 137, 137, 38, 79, 76, 116,
1426
+ 90, 60, 133, 133, 11, 76, 134, 83, 92, 37,
1427
+ 31, 133, 60, 133, 74, 133, 22, 23, 24, 25,
1428
+ 2, 322, 115, 248, 250, 251, 32, 301, 34, 282,
1429
+ 36, 37, 289, 39, 216, 140, 146, 43, 223, 206,
1430
+ 286, 47, 319, -1, -1, -1, 52, -1, -1, -1,
1431
+ 56, 276, -1, -1, 60, -1, -1, -1, 64, 65,
1432
+ 66, 287, -1, -1, -1, -1, 72, 293, 74, 75,
1433
+ -1, -1, 78, -1, -1, -1, -1, -1, 84, -1,
1434
+ -1, 87, -1, -1, -1, -1, 92, 93, 222, -1,
1435
+ 96, 317, -1, -1, -1, -1, -1, 322, -1, 105,
1436
+ -1, 107, -1, -1, 110, -1, -1, -1, -1, -1,
1437
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1438
+ -1, -1, -1, -1, 130, -1, -1, -1, -1, -1,
1439
+ -1, -1, -1, -1, -1, -1, -1, 22, -1, -1,
1440
+ 25, -1, 27, 28, -1, 30, 31, 32, 33, -1,
1441
+ -1, 36, 286, 38, 39, 40, 41, 42, 43, 44,
1442
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1470
1443
  55, 56, 57, -1, 59, -1, 61, 62, 63, -1,
1471
1444
  65, 66, 67, -1, -1, 70, -1, 72, 73, -1,
1472
1445
  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,
1446
+ 85, 86, 87, 88, 89, -1, 91, -1, 93, 94,
1447
+ -1, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1475
1448
  105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1476
- 115, 116, 117, 118, 119, -1, 121, 122, -1, -1,
1477
- 125, 126, 127, -1, 129, 130, 22, 23, -1, -1,
1478
- -1, 27, 28, -1, 30, 31, 32, 33, -1, -1,
1479
- 36, -1, 38, 39, 40, 41, 42, 43, 44, 45,
1480
- 46, 47, 48, 49, 50, 51, -1, 53, 54, 55,
1481
- 56, 57, -1, 59, -1, 61, 62, 63, -1, 65,
1482
- 66, 67, -1, -1, 70, -1, 72, 73, -1, 75,
1483
- -1, 77, 78, -1, 80, 81, 82, -1, 84, 85,
1484
- 86, 87, 88, -1, 90, -1, 92, 93, -1, 95,
1485
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1486
- 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
1487
- 116, 117, 118, 119, -1, 121, 122, -1, -1, 125,
1488
- 126, 127, -1, 129, 130, 22, 23, -1, -1, -1,
1449
+ 115, 116, 117, 118, -1, 120, 121, -1, -1, 124,
1450
+ 125, 126, -1, 128, 129, 22, -1, 24, -1, -1,
1489
1451
  27, 28, -1, 30, 31, 32, 33, -1, -1, 36,
1490
1452
  -1, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1491
1453
  47, 48, 49, 50, 51, -1, 53, 54, 55, 56,
1492
1454
  57, -1, 59, -1, 61, 62, 63, -1, 65, 66,
1493
1455
  67, -1, -1, 70, -1, 72, 73, -1, 75, -1,
1494
1456
  77, 78, -1, 80, 81, 82, -1, 84, 85, 86,
1495
- 87, 88, -1, 90, -1, 92, 93, -1, 95, 96,
1457
+ 87, 88, 89, -1, 91, -1, 93, 94, -1, 96,
1496
1458
  97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1497
1459
  107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1498
- 117, 118, 119, -1, 121, 122, -1, -1, 125, 126,
1499
- 127, 22, 129, 130, -1, -1, 27, 28, -1, 30,
1460
+ 117, 118, -1, 120, 121, -1, -1, 124, 125, 126,
1461
+ -1, 128, 129, 22, 23, -1, -1, -1, 27, 28,
1462
+ -1, 30, 31, 32, 33, -1, -1, 36, -1, 38,
1463
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1464
+ 49, 50, 51, -1, 53, 54, 55, 56, 57, -1,
1465
+ 59, -1, 61, 62, 63, -1, 65, 66, 67, -1,
1466
+ -1, 70, -1, 72, 73, -1, 75, -1, 77, 78,
1467
+ -1, 80, 81, 82, -1, 84, 85, 86, 87, 88,
1468
+ 89, -1, 91, -1, 93, 94, -1, 96, 97, 98,
1469
+ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
1470
+ 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
1471
+ -1, 120, 121, -1, -1, 124, 125, 126, -1, 128,
1472
+ 129, 22, 23, -1, -1, -1, 27, 28, -1, 30,
1500
1473
  31, 32, 33, -1, -1, 36, -1, 38, 39, 40,
1501
1474
  41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1502
1475
  51, -1, 53, 54, 55, 56, 57, -1, 59, -1,
1503
1476
  61, 62, 63, -1, 65, 66, 67, -1, -1, 70,
1504
1477
  -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,
1478
+ 81, 82, -1, 84, 85, 86, 87, 88, 89, -1,
1479
+ 91, -1, 93, 94, -1, 96, 97, 98, 99, 100,
1507
1480
  101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
1508
- 111, 112, 113, 114, 115, 116, 117, 118, 119, -1,
1509
- 121, 122, -1, -1, 125, 126, 127, 22, 129, 130,
1510
- -1, -1, 27, 28, -1, 30, 31, 32, 33, -1,
1511
- -1, 36, -1, 38, 39, 40, 41, 42, 43, 44,
1512
- 45, 46, 47, 48, 49, 50, 51, -1, 53, 54,
1513
- 55, 56, 57, -1, 59, -1, 61, 62, 63, -1,
1514
- 65, 66, 67, -1, -1, 70, -1, 72, 73, -1,
1515
- 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,
1518
- 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1519
- 115, 116, 117, 118, 119, -1, 121, 122, -1, -1,
1520
- 125, 126, 127, -1, 129, 130, 22, 23, 24, 25,
1521
- -1, -1, -1, -1, -1, -1, 32, -1, 34, -1,
1481
+ 111, 112, 113, 114, 115, 116, 117, 118, -1, 120,
1482
+ 121, -1, -1, 124, 125, 126, 22, 128, 129, -1,
1483
+ -1, 27, 28, -1, 30, 31, 32, 33, -1, -1,
1484
+ 36, -1, 38, 39, 40, 41, 42, 43, 44, 45,
1485
+ 46, 47, 48, 49, 50, 51, -1, 53, 54, 55,
1486
+ 56, 57, -1, 59, -1, 61, 62, 63, -1, 65,
1487
+ 66, 67, -1, -1, 70, -1, 72, 73, -1, 75,
1488
+ -1, 77, 78, -1, 80, 81, 82, -1, 84, 85,
1489
+ 86, 87, 88, 89, -1, 91, -1, 93, 94, -1,
1490
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1491
+ 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
1492
+ 116, 117, 118, -1, 120, 121, -1, -1, 124, 125,
1493
+ 126, 22, 128, 129, -1, -1, 27, 28, -1, 30,
1494
+ 31, 32, 33, -1, -1, 36, -1, 38, 39, 40,
1495
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1496
+ 51, -1, 53, 54, 55, 56, 57, -1, 59, -1,
1497
+ 61, 62, 63, -1, 65, 66, 67, -1, -1, 70,
1498
+ -1, 72, 73, -1, 75, -1, 77, 78, -1, 80,
1499
+ 81, 82, -1, 84, 85, 86, 87, 88, 89, -1,
1500
+ 91, -1, 93, 94, -1, 96, 97, 98, 99, 100,
1501
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
1502
+ 111, 112, 113, 114, 115, 116, 117, 118, -1, 120,
1503
+ 121, -1, -1, 124, 125, 126, -1, 128, 129, 22,
1504
+ 23, 24, 25, -1, -1, -1, -1, -1, -1, 32,
1505
+ -1, 34, -1, 36, 37, -1, 39, -1, -1, -1,
1506
+ 43, -1, -1, -1, 47, -1, -1, -1, -1, 52,
1507
+ -1, -1, -1, 56, -1, 58, 59, 60, -1, -1,
1508
+ -1, 64, 65, 66, -1, -1, -1, -1, -1, 72,
1509
+ -1, 74, 75, -1, -1, 78, -1, -1, -1, -1,
1510
+ -1, 84, -1, -1, 87, -1, -1, -1, -1, 92,
1511
+ 93, -1, -1, 96, -1, -1, 22, 23, 24, 25,
1512
+ -1, -1, 105, -1, 107, -1, 32, 110, 34, -1,
1522
1513
  36, 37, -1, 39, -1, -1, -1, 43, -1, -1,
1523
1514
  -1, 47, -1, -1, -1, -1, 52, -1, -1, -1,
1524
1515
  56, -1, 58, 59, 60, -1, -1, -1, 64, 65,
1525
1516
  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,
1517
+ -1, -1, 78, -1, -1, -1, -1, -1, 84, -1,
1518
+ -1, 87, -1, -1, -1, -1, 92, 93, -1, -1,
1519
+ 96, -1, -1, 22, 23, 24, 25, -1, -1, 105,
1520
+ -1, 107, -1, 32, 110, 34, -1, 36, 37, -1,
1549
1521
  39, -1, -1, -1, 43, -1, -1, -1, 47, -1,
1550
1522
  -1, -1, -1, 52, -1, -1, -1, 56, -1, -1,
1551
- -1, 60, -1, -1, -1, 64, 65, 66, -1, -1,
1523
+ -1, 60, -1, -1, 63, 64, 65, 66, -1, -1,
1552
1524
  -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,
1560
- 60, -1, -1, -1, 64, 65, 66, -1, -1, -1,
1561
- -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
1525
+ -1, -1, -1, -1, -1, 84, -1, -1, 87, -1,
1526
+ -1, -1, -1, 92, 93, -1, -1, 96, -1, -1,
1527
+ 22, 23, 24, 25, -1, -1, 105, -1, 107, -1,
1528
+ 32, 110, 34, -1, 36, 37, -1, 39, -1, -1,
1529
+ -1, 43, -1, -1, -1, 47, -1, -1, -1, -1,
1530
+ 52, -1, -1, -1, 56, -1, -1, -1, 60, -1,
1531
+ -1, -1, 64, 65, 66, -1, -1, -1, -1, -1,
1532
+ 72, -1, 74, 75, -1, -1, 78, -1, -1, -1,
1533
+ -1, -1, 84, -1, -1, 87, -1, -1, -1, -1,
1534
+ 92, 93, -1, -1, 96, -1, -1, 22, 23, 24,
1535
+ 25, -1, -1, 105, -1, 107, -1, 32, 110, 34,
1536
+ -1, 36, 37, -1, 39, -1, -1, -1, 43, -1,
1537
+ -1, -1, 47, -1, -1, -1, -1, 52, -1, -1,
1538
+ -1, 56, -1, -1, -1, 60, -1, -1, -1, 64,
1539
+ 65, 66, -1, -1, -1, -1, -1, 72, -1, 74,
1540
+ 75, -1, -1, 78, -1, -1, -1, -1, -1, 84,
1541
+ -1, -1, 87, -1, -1, -1, -1, 92, 93, -1,
1542
+ -1, 96, -1, -1, 22, 23, 24, 25, -1, -1,
1543
+ 105, -1, 107, -1, 32, 110, 34, -1, 36, 37,
1544
+ -1, 39, -1, -1, -1, 43, -1, -1, -1, 47,
1545
+ -1, -1, -1, -1, 52, -1, -1, -1, 56, -1,
1546
+ -1, -1, 60, -1, -1, -1, 64, 65, 66, -1,
1547
+ -1, -1, -1, -1, 72, -1, 74, 75, -1, -1,
1548
+ 78, -1, -1, -1, -1, -1, 84, -1, -1, 87,
1549
+ -1, -1, -1, -1, 92, 93, -1, -1, 96, -1,
1550
+ -1, -1, -1, -1, -1, -1, -1, 105, -1, 107,
1551
+ -1, -1, 110
1575
1552
  };
1576
1553
 
1577
1554
  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1578
1555
  symbol of state STATE-NUM. */
1579
1556
  static const yytype_uint8 yystos[] =
1580
1557
  {
1581
- 0, 141, 142, 0, 25, 133, 143, 146, 147, 224,
1558
+ 0, 139, 140, 0, 25, 132, 141, 144, 145, 219,
1582
1559
  22, 24, 27, 28, 30, 31, 32, 33, 36, 38,
1583
1560
  39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1584
1561
  49, 50, 51, 53, 54, 55, 56, 57, 59, 61,
1585
1562
  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,
1563
+ 78, 80, 81, 82, 84, 85, 86, 87, 88, 89,
1564
+ 91, 93, 94, 96, 97, 98, 99, 100, 101, 102,
1588
1565
  103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
1589
- 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,
1594
- 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
1566
+ 113, 114, 115, 116, 117, 118, 120, 121, 124, 125,
1567
+ 126, 128, 129, 223, 224, 94, 102, 128, 133, 143,
1568
+ 34, 52, 146, 26, 57, 22, 142, 224, 62, 125,
1569
+ 126, 166, 22, 25, 52, 147, 148, 149, 158, 224,
1570
+ 22, 23, 24, 25, 32, 36, 37, 39, 43, 47,
1571
+ 56, 63, 64, 65, 66, 72, 74, 75, 78, 84,
1572
+ 87, 92, 93, 96, 105, 107, 110, 144, 167, 168,
1573
+ 169, 170, 171, 177, 180, 185, 186, 187, 190, 192,
1574
+ 193, 194, 195, 196, 198, 199, 200, 201, 202, 204,
1575
+ 205, 206, 207, 210, 220, 223, 148, 28, 44, 89,
1576
+ 115, 151, 159, 223, 181, 22, 23, 24, 209, 30,
1577
+ 208, 211, 203, 48, 118, 172, 217, 203, 133, 209,
1578
+ 208, 133, 221, 223, 60, 68, 69, 83, 131, 26,
1579
+ 68, 115, 49, 160, 26, 130, 182, 183, 133, 38,
1580
+ 89, 133, 130, 212, 213, 209, 55, 166, 209, 133,
1581
+ 130, 133, 222, 221, 22, 23, 24, 188, 189, 189,
1582
+ 166, 197, 218, 22, 23, 157, 224, 150, 40, 161,
1583
+ 217, 58, 183, 184, 38, 214, 215, 223, 213, 79,
1584
+ 22, 23, 24, 173, 174, 176, 178, 133, 216, 197,
1585
+ 76, 116, 191, 60, 197, 133, 134, 153, 22, 23,
1586
+ 224, 90, 162, 166, 166, 60, 95, 122, 133, 136,
1587
+ 15, 137, 165, 58, 59, 179, 11, 76, 83, 154,
1588
+ 155, 158, 68, 80, 156, 92, 53, 133, 163, 164,
1589
+ 165, 37, 215, 166, 174, 175, 166, 217, 60, 31,
1590
+ 221, 135, 136, 160, 152, 133, 166, 74, 218, 133,
1591
+ 155, 133, 197
1616
1592
  };
1617
1593
 
1618
1594
  #define yyerrok (yyerrstatus = 0)
@@ -2453,21 +2429,21 @@ yyreduce:
2453
2429
  switch (yyn)
2454
2430
  {
2455
2431
  case 2:
2456
- #line 365 "pl_gram.y"
2432
+ #line 363 "pl_gram.y"
2457
2433
  {
2458
2434
  plpgsql_parse_result = (PLpgSQL_stmt_block *) (yyvsp[(2) - (3)].stmt);
2459
2435
  ;}
2460
2436
  break;
2461
2437
 
2462
2438
  case 5:
2463
- #line 375 "pl_gram.y"
2439
+ #line 373 "pl_gram.y"
2464
2440
  {
2465
2441
  plpgsql_DumpExecTree = true;
2466
2442
  ;}
2467
2443
  break;
2468
2444
 
2469
2445
  case 6:
2470
- #line 379 "pl_gram.y"
2446
+ #line 377 "pl_gram.y"
2471
2447
  {
2472
2448
  if (strcmp((yyvsp[(3) - (3)].str), "on") == 0)
2473
2449
  plpgsql_curr_compile->print_strict_params = true;
@@ -2479,42 +2455,42 @@ yyreduce:
2479
2455
  break;
2480
2456
 
2481
2457
  case 7:
2482
- #line 388 "pl_gram.y"
2458
+ #line 386 "pl_gram.y"
2483
2459
  {
2484
2460
  plpgsql_curr_compile->resolve_option = PLPGSQL_RESOLVE_ERROR;
2485
2461
  ;}
2486
2462
  break;
2487
2463
 
2488
2464
  case 8:
2489
- #line 392 "pl_gram.y"
2465
+ #line 390 "pl_gram.y"
2490
2466
  {
2491
2467
  plpgsql_curr_compile->resolve_option = PLPGSQL_RESOLVE_VARIABLE;
2492
2468
  ;}
2493
2469
  break;
2494
2470
 
2495
2471
  case 9:
2496
- #line 396 "pl_gram.y"
2472
+ #line 394 "pl_gram.y"
2497
2473
  {
2498
2474
  plpgsql_curr_compile->resolve_option = PLPGSQL_RESOLVE_COLUMN;
2499
2475
  ;}
2500
2476
  break;
2501
2477
 
2502
2478
  case 10:
2503
- #line 402 "pl_gram.y"
2479
+ #line 400 "pl_gram.y"
2504
2480
  {
2505
2481
  (yyval.str) = (yyvsp[(1) - (1)].word).ident;
2506
2482
  ;}
2507
2483
  break;
2508
2484
 
2509
2485
  case 11:
2510
- #line 406 "pl_gram.y"
2486
+ #line 404 "pl_gram.y"
2511
2487
  {
2512
2488
  (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword));
2513
2489
  ;}
2514
2490
  break;
2515
2491
 
2516
2492
  case 14:
2517
- #line 415 "pl_gram.y"
2493
+ #line 413 "pl_gram.y"
2518
2494
  {
2519
2495
  PLpgSQL_stmt_block *new;
2520
2496
 
@@ -2532,12 +2508,12 @@ yyreduce:
2532
2508
  check_labels((yyvsp[(1) - (6)].declhdr).label, (yyvsp[(6) - (6)].str), (yylsp[(6) - (6)]));
2533
2509
  plpgsql_ns_pop();
2534
2510
 
2535
- (yyval.stmt) = (PLpgSQL_stmt *)new;
2511
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
2536
2512
  ;}
2537
2513
  break;
2538
2514
 
2539
2515
  case 15:
2540
- #line 438 "pl_gram.y"
2516
+ #line 436 "pl_gram.y"
2541
2517
  {
2542
2518
  /* done with decls, so resume identifier lookup */
2543
2519
  plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
@@ -2548,7 +2524,7 @@ yyreduce:
2548
2524
  break;
2549
2525
 
2550
2526
  case 16:
2551
- #line 446 "pl_gram.y"
2527
+ #line 444 "pl_gram.y"
2552
2528
  {
2553
2529
  plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
2554
2530
  (yyval.declhdr).label = (yyvsp[(1) - (2)].str);
@@ -2558,7 +2534,7 @@ yyreduce:
2558
2534
  break;
2559
2535
 
2560
2536
  case 17:
2561
- #line 453 "pl_gram.y"
2537
+ #line 451 "pl_gram.y"
2562
2538
  {
2563
2539
  plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
2564
2540
  (yyval.declhdr).label = (yyvsp[(1) - (3)].str);
@@ -2568,7 +2544,7 @@ yyreduce:
2568
2544
  break;
2569
2545
 
2570
2546
  case 18:
2571
- #line 462 "pl_gram.y"
2547
+ #line 460 "pl_gram.y"
2572
2548
  {
2573
2549
  /* Forget any variables created before block */
2574
2550
  plpgsql_add_initdatums(NULL);
@@ -2581,14 +2557,14 @@ yyreduce:
2581
2557
  break;
2582
2558
 
2583
2559
  case 22:
2584
- #line 479 "pl_gram.y"
2560
+ #line 477 "pl_gram.y"
2585
2561
  {
2586
2562
  /* We allow useless extra DECLAREs */
2587
2563
  ;}
2588
2564
  break;
2589
2565
 
2590
2566
  case 23:
2591
- #line 483 "pl_gram.y"
2567
+ #line 481 "pl_gram.y"
2592
2568
  {
2593
2569
  /*
2594
2570
  * Throw a helpful error if user tries to put block
@@ -2602,7 +2578,7 @@ yyreduce:
2602
2578
  break;
2603
2579
 
2604
2580
  case 24:
2605
- #line 496 "pl_gram.y"
2581
+ #line 494 "pl_gram.y"
2606
2582
  {
2607
2583
  PLpgSQL_variable *var;
2608
2584
 
@@ -2643,7 +2619,7 @@ yyreduce:
2643
2619
  break;
2644
2620
 
2645
2621
  case 25:
2646
- #line 534 "pl_gram.y"
2622
+ #line 532 "pl_gram.y"
2647
2623
  {
2648
2624
  plpgsql_ns_additem((yyvsp[(4) - (5)].nsitem)->itemtype,
2649
2625
  (yyvsp[(4) - (5)].nsitem)->itemno, (yyvsp[(1) - (5)].varname).name);
@@ -2651,18 +2627,18 @@ yyreduce:
2651
2627
  break;
2652
2628
 
2653
2629
  case 26:
2654
- #line 539 "pl_gram.y"
2630
+ #line 537 "pl_gram.y"
2655
2631
  { plpgsql_ns_push((yyvsp[(1) - (3)].varname).name, PLPGSQL_LABEL_OTHER); ;}
2656
2632
  break;
2657
2633
 
2658
2634
  case 27:
2659
- #line 541 "pl_gram.y"
2635
+ #line 539 "pl_gram.y"
2660
2636
  {
2661
2637
  PLpgSQL_var *new;
2662
2638
  PLpgSQL_expr *curname_def;
2663
- char buf[1024];
2664
- char *cp1;
2665
- char *cp2;
2639
+ char buf[NAMEDATALEN * 2 + 64];
2640
+ char *cp1;
2641
+ char *cp2;
2666
2642
 
2667
2643
  /* pop local namespace for cursor args */
2668
2644
  plpgsql_ns_pop();
@@ -2677,9 +2653,9 @@ yyreduce:
2677
2653
 
2678
2654
  curname_def = palloc0(sizeof(PLpgSQL_expr));
2679
2655
 
2680
- strcpy(buf, "SELECT ");
2656
+ /* Note: refname has been truncated to NAMEDATALEN */
2681
2657
  cp1 = new->refname;
2682
- cp2 = buf + strlen(buf);
2658
+ cp2 = buf;
2683
2659
  /*
2684
2660
  * Don't trust standard_conforming_strings here;
2685
2661
  * it might change before we use the string.
@@ -2695,6 +2671,7 @@ yyreduce:
2695
2671
  }
2696
2672
  strcpy(cp2, "'::pg_catalog.refcursor");
2697
2673
  curname_def->query = pstrdup(buf);
2674
+ curname_def->parseMode = RAW_PARSE_PLPGSQL_EXPR;
2698
2675
  new->default_val = curname_def;
2699
2676
 
2700
2677
  new->cursor_explicit_expr = (yyvsp[(7) - (7)].expr);
@@ -2707,46 +2684,46 @@ yyreduce:
2707
2684
  break;
2708
2685
 
2709
2686
  case 28:
2710
- #line 591 "pl_gram.y"
2687
+ #line 590 "pl_gram.y"
2711
2688
  {
2712
2689
  (yyval.ival) = 0;
2713
2690
  ;}
2714
2691
  break;
2715
2692
 
2716
2693
  case 29:
2717
- #line 595 "pl_gram.y"
2694
+ #line 594 "pl_gram.y"
2718
2695
  {
2719
2696
  (yyval.ival) = CURSOR_OPT_NO_SCROLL;
2720
2697
  ;}
2721
2698
  break;
2722
2699
 
2723
2700
  case 30:
2724
- #line 599 "pl_gram.y"
2701
+ #line 598 "pl_gram.y"
2725
2702
  {
2726
2703
  (yyval.ival) = CURSOR_OPT_SCROLL;
2727
2704
  ;}
2728
2705
  break;
2729
2706
 
2730
2707
  case 31:
2731
- #line 605 "pl_gram.y"
2708
+ #line 604 "pl_gram.y"
2732
2709
  {
2733
- (yyval.expr) = read_sql_stmt("");
2710
+ (yyval.expr) = read_sql_stmt();
2734
2711
  ;}
2735
2712
  break;
2736
2713
 
2737
2714
  case 32:
2738
- #line 611 "pl_gram.y"
2715
+ #line 610 "pl_gram.y"
2739
2716
  {
2740
2717
  (yyval.datum) = NULL;
2741
2718
  ;}
2742
2719
  break;
2743
2720
 
2744
2721
  case 33:
2745
- #line 615 "pl_gram.y"
2722
+ #line 614 "pl_gram.y"
2746
2723
  {
2747
2724
  PLpgSQL_row *new;
2748
- int i;
2749
- ListCell *l;
2725
+ int i;
2726
+ ListCell *l;
2750
2727
 
2751
2728
  new = palloc0(sizeof(PLpgSQL_row));
2752
2729
  new->dtype = PLPGSQL_DTYPE_ROW;
@@ -2774,21 +2751,21 @@ yyreduce:
2774
2751
  break;
2775
2752
 
2776
2753
  case 34:
2777
- #line 646 "pl_gram.y"
2754
+ #line 645 "pl_gram.y"
2778
2755
  {
2779
2756
  (yyval.list) = list_make1((yyvsp[(1) - (1)].datum));
2780
2757
  ;}
2781
2758
  break;
2782
2759
 
2783
2760
  case 35:
2784
- #line 650 "pl_gram.y"
2761
+ #line 649 "pl_gram.y"
2785
2762
  {
2786
2763
  (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].datum));
2787
2764
  ;}
2788
2765
  break;
2789
2766
 
2790
2767
  case 36:
2791
- #line 656 "pl_gram.y"
2768
+ #line 655 "pl_gram.y"
2792
2769
  {
2793
2770
  (yyval.datum) = (PLpgSQL_datum *)
2794
2771
  plpgsql_build_variable((yyvsp[(1) - (2)].varname).name, (yyvsp[(1) - (2)].varname).lineno,
@@ -2797,7 +2774,7 @@ yyreduce:
2797
2774
  break;
2798
2775
 
2799
2776
  case 39:
2800
- #line 667 "pl_gram.y"
2777
+ #line 666 "pl_gram.y"
2801
2778
  {
2802
2779
  PLpgSQL_nsitem *nsi;
2803
2780
 
@@ -2815,7 +2792,7 @@ yyreduce:
2815
2792
  break;
2816
2793
 
2817
2794
  case 40:
2818
- #line 682 "pl_gram.y"
2795
+ #line 681 "pl_gram.y"
2819
2796
  {
2820
2797
  PLpgSQL_nsitem *nsi;
2821
2798
 
@@ -2833,7 +2810,7 @@ yyreduce:
2833
2810
  break;
2834
2811
 
2835
2812
  case 41:
2836
- #line 697 "pl_gram.y"
2813
+ #line 696 "pl_gram.y"
2837
2814
  {
2838
2815
  PLpgSQL_nsitem *nsi;
2839
2816
 
@@ -2862,7 +2839,7 @@ yyreduce:
2862
2839
  break;
2863
2840
 
2864
2841
  case 42:
2865
- #line 725 "pl_gram.y"
2842
+ #line 724 "pl_gram.y"
2866
2843
  {
2867
2844
  (yyval.varname).name = (yyvsp[(1) - (1)].word).ident;
2868
2845
  (yyval.varname).lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
@@ -2893,7 +2870,7 @@ yyreduce:
2893
2870
  break;
2894
2871
 
2895
2872
  case 43:
2896
- #line 753 "pl_gram.y"
2873
+ #line 752 "pl_gram.y"
2897
2874
  {
2898
2875
  (yyval.varname).name = pstrdup((yyvsp[(1) - (1)].keyword));
2899
2876
  (yyval.varname).lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
@@ -2924,17 +2901,17 @@ yyreduce:
2924
2901
  break;
2925
2902
 
2926
2903
  case 44:
2927
- #line 783 "pl_gram.y"
2904
+ #line 782 "pl_gram.y"
2928
2905
  { (yyval.boolean) = false; ;}
2929
2906
  break;
2930
2907
 
2931
2908
  case 45:
2932
- #line 785 "pl_gram.y"
2909
+ #line 784 "pl_gram.y"
2933
2910
  { (yyval.boolean) = true; ;}
2934
2911
  break;
2935
2912
 
2936
2913
  case 46:
2937
- #line 789 "pl_gram.y"
2914
+ #line 788 "pl_gram.y"
2938
2915
  {
2939
2916
  /*
2940
2917
  * If there's a lookahead token, read_datatype
@@ -2946,12 +2923,12 @@ yyreduce:
2946
2923
  break;
2947
2924
 
2948
2925
  case 47:
2949
- #line 800 "pl_gram.y"
2926
+ #line 799 "pl_gram.y"
2950
2927
  { (yyval.oid) = InvalidOid; ;}
2951
2928
  break;
2952
2929
 
2953
2930
  case 48:
2954
- #line 802 "pl_gram.y"
2931
+ #line 801 "pl_gram.y"
2955
2932
  {
2956
2933
  (yyval.oid) = get_collation_oid(list_make1(makeString((yyvsp[(2) - (2)].word).ident)),
2957
2934
  false);
@@ -2959,7 +2936,7 @@ yyreduce:
2959
2936
  break;
2960
2937
 
2961
2938
  case 49:
2962
- #line 807 "pl_gram.y"
2939
+ #line 806 "pl_gram.y"
2963
2940
  {
2964
2941
  (yyval.oid) = get_collation_oid(list_make1(makeString(pstrdup((yyvsp[(2) - (2)].keyword)))),
2965
2942
  false);
@@ -2967,41 +2944,41 @@ yyreduce:
2967
2944
  break;
2968
2945
 
2969
2946
  case 50:
2970
- #line 812 "pl_gram.y"
2947
+ #line 811 "pl_gram.y"
2971
2948
  {
2972
2949
  (yyval.oid) = get_collation_oid((yyvsp[(2) - (2)].cword).idents, false);
2973
2950
  ;}
2974
2951
  break;
2975
2952
 
2976
2953
  case 51:
2977
- #line 818 "pl_gram.y"
2954
+ #line 817 "pl_gram.y"
2978
2955
  { (yyval.boolean) = false; ;}
2979
2956
  break;
2980
2957
 
2981
2958
  case 52:
2982
- #line 820 "pl_gram.y"
2959
+ #line 819 "pl_gram.y"
2983
2960
  { (yyval.boolean) = true; ;}
2984
2961
  break;
2985
2962
 
2986
2963
  case 53:
2987
- #line 824 "pl_gram.y"
2964
+ #line 823 "pl_gram.y"
2988
2965
  { (yyval.expr) = NULL; ;}
2989
2966
  break;
2990
2967
 
2991
2968
  case 54:
2992
- #line 826 "pl_gram.y"
2969
+ #line 825 "pl_gram.y"
2993
2970
  {
2994
2971
  (yyval.expr) = read_sql_expression(';', ";");
2995
2972
  ;}
2996
2973
  break;
2997
2974
 
2998
2975
  case 59:
2999
- #line 845 "pl_gram.y"
2976
+ #line 844 "pl_gram.y"
3000
2977
  { (yyval.list) = NIL; ;}
3001
2978
  break;
3002
2979
 
3003
2980
  case 60:
3004
- #line 847 "pl_gram.y"
2981
+ #line 846 "pl_gram.y"
3005
2982
  {
3006
2983
  /* don't bother linking null statements into list */
3007
2984
  if ((yyvsp[(2) - (2)].stmt) == NULL)
@@ -3012,147 +2989,164 @@ yyreduce:
3012
2989
  break;
3013
2990
 
3014
2991
  case 61:
3015
- #line 857 "pl_gram.y"
2992
+ #line 856 "pl_gram.y"
3016
2993
  { (yyval.stmt) = (yyvsp[(1) - (2)].stmt); ;}
3017
2994
  break;
3018
2995
 
3019
2996
  case 62:
3020
- #line 859 "pl_gram.y"
2997
+ #line 858 "pl_gram.y"
3021
2998
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3022
2999
  break;
3023
3000
 
3024
3001
  case 63:
3025
- #line 861 "pl_gram.y"
3002
+ #line 860 "pl_gram.y"
3026
3003
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3027
3004
  break;
3028
3005
 
3029
3006
  case 64:
3030
- #line 863 "pl_gram.y"
3007
+ #line 862 "pl_gram.y"
3031
3008
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3032
3009
  break;
3033
3010
 
3034
3011
  case 65:
3035
- #line 865 "pl_gram.y"
3012
+ #line 864 "pl_gram.y"
3036
3013
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3037
3014
  break;
3038
3015
 
3039
3016
  case 66:
3040
- #line 867 "pl_gram.y"
3017
+ #line 866 "pl_gram.y"
3041
3018
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3042
3019
  break;
3043
3020
 
3044
3021
  case 67:
3045
- #line 869 "pl_gram.y"
3022
+ #line 868 "pl_gram.y"
3046
3023
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3047
3024
  break;
3048
3025
 
3049
3026
  case 68:
3050
- #line 871 "pl_gram.y"
3027
+ #line 870 "pl_gram.y"
3051
3028
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3052
3029
  break;
3053
3030
 
3054
3031
  case 69:
3055
- #line 873 "pl_gram.y"
3032
+ #line 872 "pl_gram.y"
3056
3033
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3057
3034
  break;
3058
3035
 
3059
3036
  case 70:
3060
- #line 875 "pl_gram.y"
3037
+ #line 874 "pl_gram.y"
3061
3038
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3062
3039
  break;
3063
3040
 
3064
3041
  case 71:
3065
- #line 877 "pl_gram.y"
3042
+ #line 876 "pl_gram.y"
3066
3043
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3067
3044
  break;
3068
3045
 
3069
3046
  case 72:
3070
- #line 879 "pl_gram.y"
3047
+ #line 878 "pl_gram.y"
3071
3048
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3072
3049
  break;
3073
3050
 
3074
3051
  case 73:
3075
- #line 881 "pl_gram.y"
3052
+ #line 880 "pl_gram.y"
3076
3053
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3077
3054
  break;
3078
3055
 
3079
3056
  case 74:
3080
- #line 883 "pl_gram.y"
3057
+ #line 882 "pl_gram.y"
3081
3058
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3082
3059
  break;
3083
3060
 
3084
3061
  case 75:
3085
- #line 885 "pl_gram.y"
3062
+ #line 884 "pl_gram.y"
3086
3063
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3087
3064
  break;
3088
3065
 
3089
3066
  case 76:
3090
- #line 887 "pl_gram.y"
3067
+ #line 886 "pl_gram.y"
3091
3068
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3092
3069
  break;
3093
3070
 
3094
3071
  case 77:
3095
- #line 889 "pl_gram.y"
3072
+ #line 888 "pl_gram.y"
3096
3073
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3097
3074
  break;
3098
3075
 
3099
3076
  case 78:
3100
- #line 891 "pl_gram.y"
3077
+ #line 890 "pl_gram.y"
3101
3078
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3102
3079
  break;
3103
3080
 
3104
3081
  case 79:
3105
- #line 893 "pl_gram.y"
3082
+ #line 892 "pl_gram.y"
3106
3083
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3107
3084
  break;
3108
3085
 
3109
3086
  case 80:
3110
- #line 895 "pl_gram.y"
3087
+ #line 894 "pl_gram.y"
3111
3088
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3112
3089
  break;
3113
3090
 
3114
3091
  case 81:
3115
- #line 897 "pl_gram.y"
3092
+ #line 896 "pl_gram.y"
3116
3093
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3117
3094
  break;
3118
3095
 
3119
3096
  case 82:
3120
- #line 899 "pl_gram.y"
3097
+ #line 898 "pl_gram.y"
3121
3098
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3122
3099
  break;
3123
3100
 
3124
3101
  case 83:
3125
- #line 901 "pl_gram.y"
3102
+ #line 900 "pl_gram.y"
3126
3103
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3127
3104
  break;
3128
3105
 
3129
3106
  case 84:
3130
- #line 903 "pl_gram.y"
3107
+ #line 902 "pl_gram.y"
3131
3108
  { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;}
3132
3109
  break;
3133
3110
 
3134
3111
  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"
3112
+ #line 906 "pl_gram.y"
3141
3113
  {
3142
3114
  PLpgSQL_stmt_perform *new;
3115
+ int startloc;
3143
3116
 
3144
3117
  new = palloc0(sizeof(PLpgSQL_stmt_perform));
3145
3118
  new->cmd_type = PLPGSQL_STMT_PERFORM;
3146
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (2)]));
3119
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
3147
3120
  new->stmtid = ++plpgsql_curr_compile->nstatements;
3148
- new->expr = (yyvsp[(2) - (2)].expr);
3121
+ plpgsql_push_back_token(K_PERFORM);
3122
+
3123
+ /*
3124
+ * Since PERFORM isn't legal SQL, we have to cheat to
3125
+ * the extent of substituting "SELECT" for "PERFORM"
3126
+ * in the parsed text. It does not seem worth
3127
+ * inventing a separate parse mode for this one case.
3128
+ * We can't do syntax-checking until after we make the
3129
+ * substitution.
3130
+ */
3131
+ new->expr = read_sql_construct(';', 0, 0, ";",
3132
+ RAW_PARSE_DEFAULT,
3133
+ false, false, true,
3134
+ &startloc, NULL);
3135
+ /* overwrite "perform" ... */
3136
+ memcpy(new->expr->query, " SELECT", 7);
3137
+ /* left-justify to get rid of the leading space */
3138
+ memmove(new->expr->query, new->expr->query + 1,
3139
+ strlen(new->expr->query));
3140
+ /* offset syntax error position to account for that */
3141
+ check_sql_expr(new->expr->query, new->expr->parseMode,
3142
+ startloc + 1);
3149
3143
 
3150
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3144
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3151
3145
  ;}
3152
3146
  break;
3153
3147
 
3154
- case 87:
3155
- #line 923 "pl_gram.y"
3148
+ case 86:
3149
+ #line 942 "pl_gram.y"
3156
3150
  {
3157
3151
  PLpgSQL_stmt_call *new;
3158
3152
 
@@ -3160,16 +3154,20 @@ yyreduce:
3160
3154
  new->cmd_type = PLPGSQL_STMT_CALL;
3161
3155
  new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
3162
3156
  new->stmtid = ++plpgsql_curr_compile->nstatements;
3163
- new->expr = read_sql_stmt("CALL ");
3157
+ plpgsql_push_back_token(K_CALL);
3158
+ new->expr = read_sql_stmt();
3164
3159
  new->is_call = true;
3165
3160
 
3166
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3161
+ /* Remember we may need a procedure resource owner */
3162
+ plpgsql_curr_compile->requires_procedure_resowner = true;
3163
+
3164
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3167
3165
 
3168
3166
  ;}
3169
3167
  break;
3170
3168
 
3171
- case 88:
3172
- #line 937 "pl_gram.y"
3169
+ case 87:
3170
+ #line 960 "pl_gram.y"
3173
3171
  {
3174
3172
  /* use the same structures as for CALL, for simplicity */
3175
3173
  PLpgSQL_stmt_call *new;
@@ -3178,40 +3176,68 @@ yyreduce:
3178
3176
  new->cmd_type = PLPGSQL_STMT_CALL;
3179
3177
  new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
3180
3178
  new->stmtid = ++plpgsql_curr_compile->nstatements;
3181
- new->expr = read_sql_stmt("DO ");
3179
+ plpgsql_push_back_token(K_DO);
3180
+ new->expr = read_sql_stmt();
3182
3181
  new->is_call = false;
3183
3182
 
3184
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3183
+ /* Remember we may need a procedure resource owner */
3184
+ plpgsql_curr_compile->requires_procedure_resowner = true;
3185
+
3186
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3185
3187
 
3186
3188
  ;}
3187
3189
  break;
3188
3190
 
3189
- case 89:
3190
- #line 954 "pl_gram.y"
3191
+ case 88:
3192
+ #line 981 "pl_gram.y"
3191
3193
  {
3192
3194
  PLpgSQL_stmt_assign *new;
3195
+ RawParseMode pmode;
3193
3196
 
3197
+ /* see how many names identify the datum */
3198
+ switch ((yyvsp[(1) - (1)].wdatum).ident ? 1 : list_length((yyvsp[(1) - (1)].wdatum).idents))
3199
+ {
3200
+ case 1:
3201
+ pmode = RAW_PARSE_PLPGSQL_ASSIGN1;
3202
+ break;
3203
+ case 2:
3204
+ pmode = RAW_PARSE_PLPGSQL_ASSIGN2;
3205
+ break;
3206
+ case 3:
3207
+ pmode = RAW_PARSE_PLPGSQL_ASSIGN3;
3208
+ break;
3209
+ default:
3210
+ elog(ERROR, "unexpected number of names");
3211
+ pmode = 0; /* keep compiler quiet */
3212
+ }
3213
+
3214
+ check_assignable((yyvsp[(1) - (1)].wdatum).datum, (yylsp[(1) - (1)]));
3194
3215
  new = palloc0(sizeof(PLpgSQL_stmt_assign));
3195
3216
  new->cmd_type = PLPGSQL_STMT_ASSIGN;
3196
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (3)]));
3217
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
3197
3218
  new->stmtid = ++plpgsql_curr_compile->nstatements;
3198
- new->varno = (yyvsp[(1) - (3)].datum)->dno;
3199
- new->expr = (yyvsp[(3) - (3)].expr);
3219
+ new->varno = (yyvsp[(1) - (1)].wdatum).datum->dno;
3220
+ /* Push back the head name to include it in the stmt */
3221
+ plpgsql_push_back_token(T_DATUM);
3222
+ new->expr = read_sql_construct(';', 0, 0, ";",
3223
+ pmode,
3224
+ false, true, true,
3225
+ NULL, NULL);
3200
3226
 
3201
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3227
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3202
3228
  ;}
3203
3229
  break;
3204
3230
 
3205
- case 90:
3206
- #line 969 "pl_gram.y"
3231
+ case 89:
3232
+ #line 1020 "pl_gram.y"
3207
3233
  {
3208
- PLpgSQL_stmt_getdiag *new;
3209
- ListCell *lc;
3234
+ PLpgSQL_stmt_getdiag *new;
3235
+ ListCell *lc;
3210
3236
 
3211
3237
  new = palloc0(sizeof(PLpgSQL_stmt_getdiag));
3212
3238
  new->cmd_type = PLPGSQL_STMT_GETDIAG;
3213
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (5)]));
3214
- new->stmtid = ++plpgsql_curr_compile->nstatements;
3239
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (5)]));
3240
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3215
3241
  new->is_stacked = (yyvsp[(2) - (5)].boolean);
3216
3242
  new->diag_items = (yyvsp[(4) - (5)].list);
3217
3243
 
@@ -3261,47 +3287,47 @@ yyreduce:
3261
3287
  }
3262
3288
  }
3263
3289
 
3264
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3290
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3265
3291
  ;}
3266
3292
  break;
3267
3293
 
3268
- case 91:
3269
- #line 1031 "pl_gram.y"
3294
+ case 90:
3295
+ #line 1082 "pl_gram.y"
3270
3296
  {
3271
3297
  (yyval.boolean) = false;
3272
3298
  ;}
3273
3299
  break;
3274
3300
 
3275
- case 92:
3276
- #line 1035 "pl_gram.y"
3301
+ case 91:
3302
+ #line 1086 "pl_gram.y"
3277
3303
  {
3278
3304
  (yyval.boolean) = false;
3279
3305
  ;}
3280
3306
  break;
3281
3307
 
3282
- case 93:
3283
- #line 1039 "pl_gram.y"
3308
+ case 92:
3309
+ #line 1090 "pl_gram.y"
3284
3310
  {
3285
3311
  (yyval.boolean) = true;
3286
3312
  ;}
3287
3313
  break;
3288
3314
 
3289
- case 94:
3290
- #line 1045 "pl_gram.y"
3315
+ case 93:
3316
+ #line 1096 "pl_gram.y"
3291
3317
  {
3292
3318
  (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].diagitem));
3293
3319
  ;}
3294
3320
  break;
3295
3321
 
3296
- case 95:
3297
- #line 1049 "pl_gram.y"
3322
+ case 94:
3323
+ #line 1100 "pl_gram.y"
3298
3324
  {
3299
3325
  (yyval.list) = list_make1((yyvsp[(1) - (1)].diagitem));
3300
3326
  ;}
3301
3327
  break;
3302
3328
 
3303
- case 96:
3304
- #line 1055 "pl_gram.y"
3329
+ case 95:
3330
+ #line 1106 "pl_gram.y"
3305
3331
  {
3306
3332
  PLpgSQL_diag_item *new;
3307
3333
 
@@ -3313,10 +3339,10 @@ yyreduce:
3313
3339
  ;}
3314
3340
  break;
3315
3341
 
3316
- case 97:
3317
- #line 1067 "pl_gram.y"
3342
+ case 96:
3343
+ #line 1118 "pl_gram.y"
3318
3344
  {
3319
- int tok = yylex();
3345
+ int tok = yylex();
3320
3346
 
3321
3347
  if (tok_is_keyword(tok, &yylval,
3322
3348
  K_ROW_COUNT, "row_count"))
@@ -3359,127 +3385,108 @@ yyreduce:
3359
3385
  ;}
3360
3386
  break;
3361
3387
 
3362
- case 98:
3363
- #line 1112 "pl_gram.y"
3388
+ case 97:
3389
+ #line 1163 "pl_gram.y"
3364
3390
  {
3365
- if ((yyvsp[(1) - (1)].datum)->dtype == PLPGSQL_DTYPE_ROW ||
3366
- (yyvsp[(1) - (1)].datum)->dtype == PLPGSQL_DTYPE_REC)
3391
+ /*
3392
+ * In principle we should support a getdiag_target
3393
+ * that is an array element, but for now we don't, so
3394
+ * just throw an error if next token is '['.
3395
+ */
3396
+ if ((yyvsp[(1) - (1)].wdatum).datum->dtype == PLPGSQL_DTYPE_ROW ||
3397
+ (yyvsp[(1) - (1)].wdatum).datum->dtype == PLPGSQL_DTYPE_REC ||
3398
+ plpgsql_peek() == '[')
3367
3399
  ereport(ERROR,
3368
3400
  (errcode(ERRCODE_SYNTAX_ERROR),
3369
3401
  errmsg("\"%s\" is not a scalar variable",
3370
- ((PLpgSQL_variable *) (yyvsp[(1) - (1)].datum))->refname),
3402
+ NameOfDatum(&((yyvsp[(1) - (1)].wdatum)))),
3371
3403
  parser_errposition((yylsp[(1) - (1)]))));
3372
- (yyval.datum) = (yyvsp[(1) - (1)].datum);
3404
+ check_assignable((yyvsp[(1) - (1)].wdatum).datum, (yylsp[(1) - (1)]));
3405
+ (yyval.datum) = (yyvsp[(1) - (1)].wdatum).datum;
3373
3406
  ;}
3374
3407
  break;
3375
3408
 
3376
- case 99:
3377
- #line 1123 "pl_gram.y"
3409
+ case 98:
3410
+ #line 1181 "pl_gram.y"
3378
3411
  {
3379
3412
  /* just to give a better message than "syntax error" */
3380
3413
  word_is_not_variable(&((yyvsp[(1) - (1)].word)), (yylsp[(1) - (1)]));
3381
3414
  ;}
3382
3415
  break;
3383
3416
 
3384
- case 100:
3385
- #line 1128 "pl_gram.y"
3417
+ case 99:
3418
+ #line 1186 "pl_gram.y"
3386
3419
  {
3387
3420
  /* just to give a better message than "syntax error" */
3388
3421
  cword_is_not_variable(&((yyvsp[(1) - (1)].cword)), (yylsp[(1) - (1)]));
3389
3422
  ;}
3390
3423
  break;
3391
3424
 
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"
3425
+ case 100:
3426
+ #line 1193 "pl_gram.y"
3420
3427
  {
3421
3428
  PLpgSQL_stmt_if *new;
3422
3429
 
3423
3430
  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);
3431
+ new->cmd_type = PLPGSQL_STMT_IF;
3432
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (8)]));
3433
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3434
+ new->cond = (yyvsp[(2) - (8)].expr);
3435
+ new->then_body = (yyvsp[(3) - (8)].list);
3429
3436
  new->elsif_list = (yyvsp[(4) - (8)].list);
3430
- new->else_body = (yyvsp[(5) - (8)].list);
3437
+ new->else_body = (yyvsp[(5) - (8)].list);
3431
3438
 
3432
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3439
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3433
3440
  ;}
3434
3441
  break;
3435
3442
 
3436
- case 104:
3437
- #line 1175 "pl_gram.y"
3443
+ case 101:
3444
+ #line 1210 "pl_gram.y"
3438
3445
  {
3439
3446
  (yyval.list) = NIL;
3440
3447
  ;}
3441
3448
  break;
3442
3449
 
3443
- case 105:
3444
- #line 1179 "pl_gram.y"
3450
+ case 102:
3451
+ #line 1214 "pl_gram.y"
3445
3452
  {
3446
3453
  PLpgSQL_if_elsif *new;
3447
3454
 
3448
3455
  new = palloc0(sizeof(PLpgSQL_if_elsif));
3449
3456
  new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3450
- new->cond = (yyvsp[(3) - (4)].expr);
3451
- new->stmts = (yyvsp[(4) - (4)].list);
3457
+ new->cond = (yyvsp[(3) - (4)].expr);
3458
+ new->stmts = (yyvsp[(4) - (4)].list);
3452
3459
 
3453
3460
  (yyval.list) = lappend((yyvsp[(1) - (4)].list), new);
3454
3461
  ;}
3455
3462
  break;
3456
3463
 
3457
- case 106:
3458
- #line 1192 "pl_gram.y"
3464
+ case 103:
3465
+ #line 1227 "pl_gram.y"
3459
3466
  {
3460
3467
  (yyval.list) = NIL;
3461
3468
  ;}
3462
3469
  break;
3463
3470
 
3464
- case 107:
3465
- #line 1196 "pl_gram.y"
3471
+ case 104:
3472
+ #line 1231 "pl_gram.y"
3466
3473
  {
3467
3474
  (yyval.list) = (yyvsp[(2) - (2)].list);
3468
3475
  ;}
3469
3476
  break;
3470
3477
 
3471
- case 108:
3472
- #line 1202 "pl_gram.y"
3478
+ case 105:
3479
+ #line 1237 "pl_gram.y"
3473
3480
  {
3474
3481
  (yyval.stmt) = make_case((yylsp[(1) - (7)]), (yyvsp[(2) - (7)].expr), (yyvsp[(3) - (7)].list), (yyvsp[(4) - (7)].list));
3475
3482
  ;}
3476
3483
  break;
3477
3484
 
3478
- case 109:
3479
- #line 1208 "pl_gram.y"
3485
+ case 106:
3486
+ #line 1243 "pl_gram.y"
3480
3487
  {
3481
3488
  PLpgSQL_expr *expr = NULL;
3482
- int tok = yylex();
3489
+ int tok = yylex();
3483
3490
 
3484
3491
  if (tok != K_WHEN)
3485
3492
  {
@@ -3491,41 +3498,41 @@ yyreduce:
3491
3498
  ;}
3492
3499
  break;
3493
3500
 
3494
- case 110:
3495
- #line 1223 "pl_gram.y"
3501
+ case 107:
3502
+ #line 1258 "pl_gram.y"
3496
3503
  {
3497
3504
  (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].casewhen));
3498
3505
  ;}
3499
3506
  break;
3500
3507
 
3501
- case 111:
3502
- #line 1227 "pl_gram.y"
3508
+ case 108:
3509
+ #line 1262 "pl_gram.y"
3503
3510
  {
3504
3511
  (yyval.list) = list_make1((yyvsp[(1) - (1)].casewhen));
3505
3512
  ;}
3506
3513
  break;
3507
3514
 
3508
- case 112:
3509
- #line 1233 "pl_gram.y"
3515
+ case 109:
3516
+ #line 1268 "pl_gram.y"
3510
3517
  {
3511
3518
  PLpgSQL_case_when *new = palloc(sizeof(PLpgSQL_case_when));
3512
3519
 
3513
3520
  new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (3)]));
3514
- new->expr = (yyvsp[(2) - (3)].expr);
3515
- new->stmts = (yyvsp[(3) - (3)].list);
3521
+ new->expr = (yyvsp[(2) - (3)].expr);
3522
+ new->stmts = (yyvsp[(3) - (3)].list);
3516
3523
  (yyval.casewhen) = new;
3517
3524
  ;}
3518
3525
  break;
3519
3526
 
3520
- case 113:
3521
- #line 1244 "pl_gram.y"
3527
+ case 110:
3528
+ #line 1279 "pl_gram.y"
3522
3529
  {
3523
3530
  (yyval.list) = NIL;
3524
3531
  ;}
3525
3532
  break;
3526
3533
 
3527
- case 114:
3528
- #line 1248 "pl_gram.y"
3534
+ case 111:
3535
+ #line 1283 "pl_gram.y"
3529
3536
  {
3530
3537
  /*
3531
3538
  * proc_sect could return an empty list, but we
@@ -3540,71 +3547,71 @@ yyreduce:
3540
3547
  ;}
3541
3548
  break;
3542
3549
 
3543
- case 115:
3544
- #line 1263 "pl_gram.y"
3550
+ case 112:
3551
+ #line 1298 "pl_gram.y"
3545
3552
  {
3546
3553
  PLpgSQL_stmt_loop *new;
3547
3554
 
3548
3555
  new = palloc0(sizeof(PLpgSQL_stmt_loop));
3549
3556
  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;
3557
+ new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (3)]));
3558
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3559
+ new->label = (yyvsp[(1) - (3)].str);
3560
+ new->body = (yyvsp[(3) - (3)].loop_body).stmts;
3554
3561
 
3555
3562
  check_labels((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].loop_body).end_label, (yyvsp[(3) - (3)].loop_body).end_label_location);
3556
3563
  plpgsql_ns_pop();
3557
3564
 
3558
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3565
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3559
3566
  ;}
3560
3567
  break;
3561
3568
 
3562
- case 116:
3563
- #line 1281 "pl_gram.y"
3569
+ case 113:
3570
+ #line 1316 "pl_gram.y"
3564
3571
  {
3565
3572
  PLpgSQL_stmt_while *new;
3566
3573
 
3567
3574
  new = palloc0(sizeof(PLpgSQL_stmt_while));
3568
3575
  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;
3576
+ new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3577
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3578
+ new->label = (yyvsp[(1) - (4)].str);
3579
+ new->cond = (yyvsp[(3) - (4)].expr);
3580
+ new->body = (yyvsp[(4) - (4)].loop_body).stmts;
3574
3581
 
3575
3582
  check_labels((yyvsp[(1) - (4)].str), (yyvsp[(4) - (4)].loop_body).end_label, (yyvsp[(4) - (4)].loop_body).end_label_location);
3576
3583
  plpgsql_ns_pop();
3577
3584
 
3578
- (yyval.stmt) = (PLpgSQL_stmt *)new;
3585
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
3579
3586
  ;}
3580
3587
  break;
3581
3588
 
3582
- case 117:
3583
- #line 1300 "pl_gram.y"
3589
+ case 114:
3590
+ #line 1335 "pl_gram.y"
3584
3591
  {
3585
3592
  /* This runs after we've scanned the loop body */
3586
3593
  if ((yyvsp[(3) - (4)].stmt)->cmd_type == PLPGSQL_STMT_FORI)
3587
3594
  {
3588
- PLpgSQL_stmt_fori *new;
3595
+ PLpgSQL_stmt_fori *new;
3589
3596
 
3590
3597
  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;
3598
+ new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3599
+ new->label = (yyvsp[(1) - (4)].str);
3600
+ new->body = (yyvsp[(4) - (4)].loop_body).stmts;
3594
3601
  (yyval.stmt) = (PLpgSQL_stmt *) new;
3595
3602
  }
3596
3603
  else
3597
3604
  {
3598
- PLpgSQL_stmt_forq *new;
3605
+ PLpgSQL_stmt_forq *new;
3599
3606
 
3600
3607
  Assert((yyvsp[(3) - (4)].stmt)->cmd_type == PLPGSQL_STMT_FORS ||
3601
3608
  (yyvsp[(3) - (4)].stmt)->cmd_type == PLPGSQL_STMT_FORC ||
3602
3609
  (yyvsp[(3) - (4)].stmt)->cmd_type == PLPGSQL_STMT_DYNFORS);
3603
3610
  /* forq is the common supertype of all three */
3604
3611
  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;
3612
+ new->lineno = plpgsql_location_to_lineno((yylsp[(2) - (4)]));
3613
+ new->label = (yyvsp[(1) - (4)].str);
3614
+ new->body = (yyvsp[(4) - (4)].loop_body).stmts;
3608
3615
  (yyval.stmt) = (PLpgSQL_stmt *) new;
3609
3616
  }
3610
3617
 
@@ -3614,8 +3621,8 @@ yyreduce:
3614
3621
  ;}
3615
3622
  break;
3616
3623
 
3617
- case 118:
3618
- #line 1334 "pl_gram.y"
3624
+ case 115:
3625
+ #line 1369 "pl_gram.y"
3619
3626
  {
3620
3627
  int tok = yylex();
3621
3628
  int tokloc = yylloc;
@@ -3623,9 +3630,9 @@ yyreduce:
3623
3630
  if (tok == K_EXECUTE)
3624
3631
  {
3625
3632
  /* EXECUTE means it's a dynamic FOR loop */
3626
- PLpgSQL_stmt_dynfors *new;
3627
- PLpgSQL_expr *expr;
3628
- int term;
3633
+ PLpgSQL_stmt_dynfors *new;
3634
+ PLpgSQL_expr *expr;
3635
+ int term;
3629
3636
 
3630
3637
  expr = read_sql_expression2(K_LOOP, K_USING,
3631
3638
  "LOOP or USING",
@@ -3633,7 +3640,7 @@ yyreduce:
3633
3640
 
3634
3641
  new = palloc0(sizeof(PLpgSQL_stmt_dynfors));
3635
3642
  new->cmd_type = PLPGSQL_STMT_DYNFORS;
3636
- new->stmtid = ++plpgsql_curr_compile->nstatements;
3643
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3637
3644
  if ((yyvsp[(1) - (2)].forvariable).row)
3638
3645
  {
3639
3646
  new->var = (PLpgSQL_variable *) (yyvsp[(1) - (2)].forvariable).row;
@@ -3674,8 +3681,8 @@ yyreduce:
3674
3681
  ((PLpgSQL_var *) yylval.wdatum.datum)->datatype->typoid == REFCURSOROID)
3675
3682
  {
3676
3683
  /* It's FOR var IN cursor */
3677
- PLpgSQL_stmt_forc *new;
3678
- PLpgSQL_var *cursor = (PLpgSQL_var *) yylval.wdatum.datum;
3684
+ PLpgSQL_stmt_forc *new;
3685
+ PLpgSQL_var *cursor = (PLpgSQL_var *) yylval.wdatum.datum;
3679
3686
 
3680
3687
  new = (PLpgSQL_stmt_forc *) palloc0(sizeof(PLpgSQL_stmt_forc));
3681
3688
  new->cmd_type = PLPGSQL_STMT_FORC;
@@ -3698,8 +3705,7 @@ yyreduce:
3698
3705
 
3699
3706
  /* collect cursor's parameters if any */
3700
3707
  new->argquery = read_cursor_args(cursor,
3701
- K_LOOP,
3702
- "LOOP");
3708
+ K_LOOP);
3703
3709
 
3704
3710
  /* create loop's private RECORD variable */
3705
3711
  new->var = (PLpgSQL_variable *)
@@ -3713,9 +3719,9 @@ yyreduce:
3713
3719
  }
3714
3720
  else
3715
3721
  {
3716
- PLpgSQL_expr *expr1;
3717
- int expr1loc;
3718
- bool reverse = false;
3722
+ PLpgSQL_expr *expr1;
3723
+ int expr1loc;
3724
+ bool reverse = false;
3719
3725
 
3720
3726
  /*
3721
3727
  * We have to distinguish between two
@@ -3737,16 +3743,16 @@ yyreduce:
3737
3743
 
3738
3744
  /*
3739
3745
  * 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.
3746
+ * or a LOOP. The text we read may be either
3747
+ * an expression or a whole SQL statement, so
3748
+ * we need to invoke read_sql_construct directly,
3749
+ * and tell it not to check syntax yet.
3744
3750
  */
3745
3751
  expr1 = read_sql_construct(DOT_DOT,
3746
3752
  K_LOOP,
3747
3753
  0,
3748
3754
  "LOOP",
3749
- "SELECT ",
3755
+ RAW_PARSE_DEFAULT,
3750
3756
  true,
3751
3757
  false,
3752
3758
  true,
@@ -3756,13 +3762,18 @@ yyreduce:
3756
3762
  if (tok == DOT_DOT)
3757
3763
  {
3758
3764
  /* 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;
3765
+ PLpgSQL_expr *expr2;
3766
+ PLpgSQL_expr *expr_by;
3767
+ PLpgSQL_var *fvar;
3768
+ PLpgSQL_stmt_fori *new;
3763
3769
 
3764
- /* Check first expression is well-formed */
3765
- check_sql_expr(expr1->query, expr1loc, 7);
3770
+ /*
3771
+ * Relabel first expression as an expression;
3772
+ * then we can check its syntax.
3773
+ */
3774
+ expr1->parseMode = RAW_PARSE_PLPGSQL_EXPR;
3775
+ check_sql_expr(expr1->query, expr1->parseMode,
3776
+ expr1loc);
3766
3777
 
3767
3778
  /* Read and check the second one */
3768
3779
  expr2 = read_sql_expression2(K_LOOP, K_BY,
@@ -3795,25 +3806,21 @@ yyreduce:
3795
3806
 
3796
3807
  new = palloc0(sizeof(PLpgSQL_stmt_fori));
3797
3808
  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;
3809
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3810
+ new->var = fvar;
3811
+ new->reverse = reverse;
3812
+ new->lower = expr1;
3813
+ new->upper = expr2;
3814
+ new->step = expr_by;
3804
3815
 
3805
3816
  (yyval.stmt) = (PLpgSQL_stmt *) new;
3806
3817
  }
3807
3818
  else
3808
3819
  {
3809
3820
  /*
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.
3821
+ * No "..", so it must be a query loop.
3814
3822
  */
3815
- char *tmp_query;
3816
- PLpgSQL_stmt_fors *new;
3823
+ PLpgSQL_stmt_fors *new;
3817
3824
 
3818
3825
  if (reverse)
3819
3826
  ereport(ERROR,
@@ -3821,12 +3828,9 @@ yyreduce:
3821
3828
  errmsg("cannot specify REVERSE in query FOR loop"),
3822
3829
  parser_errposition(tokloc)));
3823
3830
 
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);
3831
+ /* Check syntax as a regular query */
3832
+ check_sql_expr(expr1->query, expr1->parseMode,
3833
+ expr1loc);
3830
3834
 
3831
3835
  new = palloc0(sizeof(PLpgSQL_stmt_fors));
3832
3836
  new->cmd_type = PLPGSQL_STMT_FORS;
@@ -3859,8 +3863,8 @@ yyreduce:
3859
3863
  ;}
3860
3864
  break;
3861
3865
 
3862
- case 119:
3863
- #line 1596 "pl_gram.y"
3866
+ case 116:
3867
+ #line 1628 "pl_gram.y"
3864
3868
  {
3865
3869
  (yyval.forvariable).name = NameOfDatum(&((yyvsp[(1) - (1)].wdatum)));
3866
3870
  (yyval.forvariable).lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
@@ -3888,8 +3892,8 @@ yyreduce:
3888
3892
  ;}
3889
3893
  break;
3890
3894
 
3891
- case 120:
3892
- #line 1622 "pl_gram.y"
3895
+ case 117:
3896
+ #line 1654 "pl_gram.y"
3893
3897
  {
3894
3898
  int tok;
3895
3899
 
@@ -3905,16 +3909,16 @@ yyreduce:
3905
3909
  ;}
3906
3910
  break;
3907
3911
 
3908
- case 121:
3909
- #line 1636 "pl_gram.y"
3912
+ case 118:
3913
+ #line 1668 "pl_gram.y"
3910
3914
  {
3911
3915
  /* just to give a better message than "syntax error" */
3912
3916
  cword_is_not_variable(&((yyvsp[(1) - (1)].cword)), (yylsp[(1) - (1)]));
3913
3917
  ;}
3914
3918
  break;
3915
3919
 
3916
- case 122:
3917
- #line 1643 "pl_gram.y"
3920
+ case 119:
3921
+ #line 1675 "pl_gram.y"
3918
3922
  {
3919
3923
  PLpgSQL_stmt_foreach_a *new;
3920
3924
 
@@ -3952,32 +3956,32 @@ yyreduce:
3952
3956
  ;}
3953
3957
  break;
3954
3958
 
3955
- case 123:
3956
- #line 1681 "pl_gram.y"
3959
+ case 120:
3960
+ #line 1713 "pl_gram.y"
3957
3961
  {
3958
3962
  (yyval.ival) = 0;
3959
3963
  ;}
3960
3964
  break;
3961
3965
 
3962
- case 124:
3963
- #line 1685 "pl_gram.y"
3966
+ case 121:
3967
+ #line 1717 "pl_gram.y"
3964
3968
  {
3965
3969
  (yyval.ival) = (yyvsp[(2) - (2)].ival);
3966
3970
  ;}
3967
3971
  break;
3968
3972
 
3969
- case 125:
3970
- #line 1691 "pl_gram.y"
3973
+ case 122:
3974
+ #line 1723 "pl_gram.y"
3971
3975
  {
3972
3976
  PLpgSQL_stmt_exit *new;
3973
3977
 
3974
3978
  new = palloc0(sizeof(PLpgSQL_stmt_exit));
3975
3979
  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);
3980
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
3981
+ new->is_exit = (yyvsp[(1) - (3)].boolean);
3982
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (3)]));
3983
+ new->label = (yyvsp[(2) - (3)].str);
3984
+ new->cond = (yyvsp[(3) - (3)].expr);
3981
3985
 
3982
3986
  if ((yyvsp[(2) - (3)].str))
3983
3987
  {
@@ -4016,28 +4020,28 @@ yyreduce:
4016
4020
  parser_errposition((yylsp[(1) - (3)]))));
4017
4021
  }
4018
4022
 
4019
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4023
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4020
4024
  ;}
4021
4025
  break;
4022
4026
 
4023
- case 126:
4024
- #line 1744 "pl_gram.y"
4027
+ case 123:
4028
+ #line 1776 "pl_gram.y"
4025
4029
  {
4026
4030
  (yyval.boolean) = true;
4027
4031
  ;}
4028
4032
  break;
4029
4033
 
4030
- case 127:
4031
- #line 1748 "pl_gram.y"
4034
+ case 124:
4035
+ #line 1780 "pl_gram.y"
4032
4036
  {
4033
4037
  (yyval.boolean) = false;
4034
4038
  ;}
4035
4039
  break;
4036
4040
 
4037
- case 128:
4038
- #line 1754 "pl_gram.y"
4041
+ case 125:
4042
+ #line 1786 "pl_gram.y"
4039
4043
  {
4040
- int tok;
4044
+ int tok;
4041
4045
 
4042
4046
  tok = yylex();
4043
4047
  if (tok == 0)
@@ -4061,22 +4065,22 @@ yyreduce:
4061
4065
  ;}
4062
4066
  break;
4063
4067
 
4064
- case 129:
4065
- #line 1780 "pl_gram.y"
4068
+ case 126:
4069
+ #line 1812 "pl_gram.y"
4066
4070
  {
4067
- PLpgSQL_stmt_raise *new;
4068
- int tok;
4071
+ PLpgSQL_stmt_raise *new;
4072
+ int tok;
4069
4073
 
4070
4074
  new = palloc(sizeof(PLpgSQL_stmt_raise));
4071
4075
 
4072
- new->cmd_type = PLPGSQL_STMT_RAISE;
4073
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4074
- new->stmtid = ++plpgsql_curr_compile->nstatements;
4076
+ new->cmd_type = PLPGSQL_STMT_RAISE;
4077
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4078
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
4075
4079
  new->elog_level = ERROR; /* default */
4076
- new->condname = NULL;
4077
- new->message = NULL;
4078
- new->params = NIL;
4079
- new->options = NIL;
4080
+ new->condname = NULL;
4081
+ new->message = NULL;
4082
+ new->params = NIL;
4083
+ new->options = NIL;
4080
4084
 
4081
4085
  tok = yylex();
4082
4086
  if (tok == 0)
@@ -4156,7 +4160,7 @@ yyreduce:
4156
4160
 
4157
4161
  expr = read_sql_construct(',', ';', K_USING,
4158
4162
  ", or ; or USING",
4159
- "SELECT ",
4163
+ RAW_PARSE_PLPGSQL_EXPR,
4160
4164
  true, true, true,
4161
4165
  NULL, &tok);
4162
4166
  new->params = lappend(new->params, expr);
@@ -4169,7 +4173,7 @@ yyreduce:
4169
4173
  K_SQLSTATE, "sqlstate"))
4170
4174
  {
4171
4175
  /* next token should be a string literal */
4172
- char *sqlstatestr;
4176
+ char *sqlstatestr;
4173
4177
 
4174
4178
  if (yylex() != SCONST)
4175
4179
  yyerror("syntax error");
@@ -4203,21 +4207,21 @@ yyreduce:
4203
4207
 
4204
4208
  check_raise_parameters(new);
4205
4209
 
4206
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4210
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4207
4211
  ;}
4208
4212
  break;
4209
4213
 
4210
- case 130:
4211
- #line 1925 "pl_gram.y"
4214
+ case 127:
4215
+ #line 1957 "pl_gram.y"
4212
4216
  {
4213
- PLpgSQL_stmt_assert *new;
4214
- int tok;
4217
+ PLpgSQL_stmt_assert *new;
4218
+ int tok;
4215
4219
 
4216
4220
  new = palloc(sizeof(PLpgSQL_stmt_assert));
4217
4221
 
4218
- new->cmd_type = PLPGSQL_STMT_ASSERT;
4219
- new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4220
- new->stmtid = ++plpgsql_curr_compile->nstatements;
4222
+ new->cmd_type = PLPGSQL_STMT_ASSERT;
4223
+ new->lineno = plpgsql_location_to_lineno((yylsp[(1) - (1)]));
4224
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
4221
4225
 
4222
4226
  new->cond = read_sql_expression2(',', ';',
4223
4227
  ", or ;",
@@ -4232,8 +4236,8 @@ yyreduce:
4232
4236
  ;}
4233
4237
  break;
4234
4238
 
4235
- case 131:
4236
- #line 1949 "pl_gram.y"
4239
+ case 128:
4240
+ #line 1981 "pl_gram.y"
4237
4241
  {
4238
4242
  (yyval.loop_body).stmts = (yyvsp[(1) - (5)].list);
4239
4243
  (yyval.loop_body).end_label = (yyvsp[(4) - (5)].str);
@@ -4241,56 +4245,65 @@ yyreduce:
4241
4245
  ;}
4242
4246
  break;
4243
4247
 
4244
- case 132:
4245
- #line 1967 "pl_gram.y"
4248
+ case 129:
4249
+ #line 1999 "pl_gram.y"
4246
4250
  {
4247
4251
  (yyval.stmt) = make_execsql_stmt(K_IMPORT, (yylsp[(1) - (1)]));
4248
4252
  ;}
4249
4253
  break;
4250
4254
 
4251
- case 133:
4252
- #line 1971 "pl_gram.y"
4255
+ case 130:
4256
+ #line 2003 "pl_gram.y"
4253
4257
  {
4254
4258
  (yyval.stmt) = make_execsql_stmt(K_INSERT, (yylsp[(1) - (1)]));
4255
4259
  ;}
4256
4260
  break;
4257
4261
 
4258
- case 134:
4259
- #line 1975 "pl_gram.y"
4262
+ case 131:
4263
+ #line 2007 "pl_gram.y"
4264
+ {
4265
+ (yyval.stmt) = make_execsql_stmt(K_MERGE, (yylsp[(1) - (1)]));
4266
+ ;}
4267
+ break;
4268
+
4269
+ case 132:
4270
+ #line 2011 "pl_gram.y"
4260
4271
  {
4261
4272
  int tok;
4262
4273
 
4263
4274
  tok = yylex();
4264
4275
  plpgsql_push_back_token(tok);
4265
- if (tok == '=' || tok == COLON_EQUALS || tok == '[')
4276
+ if (tok == '=' || tok == COLON_EQUALS ||
4277
+ tok == '[' || tok == '.')
4266
4278
  word_is_not_variable(&((yyvsp[(1) - (1)].word)), (yylsp[(1) - (1)]));
4267
4279
  (yyval.stmt) = make_execsql_stmt(T_WORD, (yylsp[(1) - (1)]));
4268
4280
  ;}
4269
4281
  break;
4270
4282
 
4271
- case 135:
4272
- #line 1985 "pl_gram.y"
4283
+ case 133:
4284
+ #line 2022 "pl_gram.y"
4273
4285
  {
4274
4286
  int tok;
4275
4287
 
4276
4288
  tok = yylex();
4277
4289
  plpgsql_push_back_token(tok);
4278
- if (tok == '=' || tok == COLON_EQUALS || tok == '[')
4290
+ if (tok == '=' || tok == COLON_EQUALS ||
4291
+ tok == '[' || tok == '.')
4279
4292
  cword_is_not_variable(&((yyvsp[(1) - (1)].cword)), (yylsp[(1) - (1)]));
4280
4293
  (yyval.stmt) = make_execsql_stmt(T_CWORD, (yylsp[(1) - (1)]));
4281
4294
  ;}
4282
4295
  break;
4283
4296
 
4284
- case 136:
4285
- #line 1997 "pl_gram.y"
4297
+ case 134:
4298
+ #line 2035 "pl_gram.y"
4286
4299
  {
4287
4300
  PLpgSQL_stmt_dynexecute *new;
4288
4301
  PLpgSQL_expr *expr;
4289
- int endtoken;
4302
+ int endtoken;
4290
4303
 
4291
4304
  expr = read_sql_construct(K_INTO, K_USING, ';',
4292
4305
  "INTO or USING or ;",
4293
- "SELECT ",
4306
+ RAW_PARSE_PLPGSQL_EXPR,
4294
4307
  true, true, true,
4295
4308
  NULL, &endtoken);
4296
4309
 
@@ -4329,7 +4342,7 @@ yyreduce:
4329
4342
  {
4330
4343
  expr = read_sql_construct(',', ';', K_INTO,
4331
4344
  ", or ; or INTO",
4332
- "SELECT ",
4345
+ RAW_PARSE_PLPGSQL_EXPR,
4333
4346
  true, true, true,
4334
4347
  NULL, &endtoken);
4335
4348
  new->params = lappend(new->params, expr);
@@ -4341,15 +4354,15 @@ yyreduce:
4341
4354
  yyerror("syntax error");
4342
4355
  }
4343
4356
 
4344
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4357
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4345
4358
  ;}
4346
4359
  break;
4347
4360
 
4348
- case 137:
4349
- #line 2061 "pl_gram.y"
4361
+ case 135:
4362
+ #line 2099 "pl_gram.y"
4350
4363
  {
4351
4364
  PLpgSQL_stmt_open *new;
4352
- int tok;
4365
+ int tok;
4353
4366
 
4354
4367
  new = palloc0(sizeof(PLpgSQL_stmt_open));
4355
4368
  new->cmd_type = PLPGSQL_STMT_OPEN;
@@ -4386,7 +4399,7 @@ yyreduce:
4386
4399
  tok = yylex();
4387
4400
  if (tok == K_EXECUTE)
4388
4401
  {
4389
- int endtoken;
4402
+ int endtoken;
4390
4403
 
4391
4404
  new->dynquery =
4392
4405
  read_sql_expression2(K_USING, ';',
@@ -4411,21 +4424,21 @@ yyreduce:
4411
4424
  else
4412
4425
  {
4413
4426
  plpgsql_push_back_token(tok);
4414
- new->query = read_sql_stmt("");
4427
+ new->query = read_sql_stmt();
4415
4428
  }
4416
4429
  }
4417
4430
  else
4418
4431
  {
4419
4432
  /* predefined cursor query, so read args */
4420
- new->argquery = read_cursor_args((yyvsp[(2) - (2)].var), ';', ";");
4433
+ new->argquery = read_cursor_args((yyvsp[(2) - (2)].var), ';');
4421
4434
  }
4422
4435
 
4423
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4436
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4424
4437
  ;}
4425
4438
  break;
4426
4439
 
4427
- case 138:
4428
- #line 2139 "pl_gram.y"
4440
+ case 136:
4441
+ #line 2177 "pl_gram.y"
4429
4442
  {
4430
4443
  PLpgSQL_stmt_fetch *fetch = (yyvsp[(2) - (4)].fetch);
4431
4444
  PLpgSQL_variable *target;
@@ -4451,32 +4464,32 @@ yyreduce:
4451
4464
  fetch->curvar = (yyvsp[(3) - (4)].var)->dno;
4452
4465
  fetch->is_move = false;
4453
4466
 
4454
- (yyval.stmt) = (PLpgSQL_stmt *)fetch;
4467
+ (yyval.stmt) = (PLpgSQL_stmt *) fetch;
4455
4468
  ;}
4456
4469
  break;
4457
4470
 
4458
- case 139:
4459
- #line 2169 "pl_gram.y"
4471
+ case 137:
4472
+ #line 2207 "pl_gram.y"
4460
4473
  {
4461
4474
  PLpgSQL_stmt_fetch *fetch = (yyvsp[(2) - (4)].fetch);
4462
4475
 
4463
4476
  fetch->lineno = plpgsql_location_to_lineno((yylsp[(1) - (4)]));
4464
- fetch->curvar = (yyvsp[(3) - (4)].var)->dno;
4465
- fetch->is_move = true;
4477
+ fetch->curvar = (yyvsp[(3) - (4)].var)->dno;
4478
+ fetch->is_move = true;
4466
4479
 
4467
- (yyval.stmt) = (PLpgSQL_stmt *)fetch;
4480
+ (yyval.stmt) = (PLpgSQL_stmt *) fetch;
4468
4481
  ;}
4469
4482
  break;
4470
4483
 
4471
- case 140:
4472
- #line 2181 "pl_gram.y"
4484
+ case 138:
4485
+ #line 2219 "pl_gram.y"
4473
4486
  {
4474
4487
  (yyval.fetch) = read_fetch_direction();
4475
4488
  ;}
4476
4489
  break;
4477
4490
 
4478
- case 141:
4479
- #line 2187 "pl_gram.y"
4491
+ case 139:
4492
+ #line 2225 "pl_gram.y"
4480
4493
  {
4481
4494
  PLpgSQL_stmt_close *new;
4482
4495
 
@@ -4486,20 +4499,20 @@ yyreduce:
4486
4499
  new->stmtid = ++plpgsql_curr_compile->nstatements;
4487
4500
  new->curvar = (yyvsp[(2) - (3)].var)->dno;
4488
4501
 
4489
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4502
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4490
4503
  ;}
4491
4504
  break;
4492
4505
 
4493
- case 142:
4494
- #line 2201 "pl_gram.y"
4506
+ case 140:
4507
+ #line 2239 "pl_gram.y"
4495
4508
  {
4496
4509
  /* We do not bother building a node for NULL */
4497
4510
  (yyval.stmt) = NULL;
4498
4511
  ;}
4499
4512
  break;
4500
4513
 
4501
- case 143:
4502
- #line 2208 "pl_gram.y"
4514
+ case 141:
4515
+ #line 2246 "pl_gram.y"
4503
4516
  {
4504
4517
  PLpgSQL_stmt_commit *new;
4505
4518
 
@@ -4509,12 +4522,12 @@ yyreduce:
4509
4522
  new->stmtid = ++plpgsql_curr_compile->nstatements;
4510
4523
  new->chain = (yyvsp[(2) - (3)].ival);
4511
4524
 
4512
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4525
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4513
4526
  ;}
4514
4527
  break;
4515
4528
 
4516
- case 144:
4517
- #line 2222 "pl_gram.y"
4529
+ case 142:
4530
+ #line 2260 "pl_gram.y"
4518
4531
  {
4519
4532
  PLpgSQL_stmt_rollback *new;
4520
4533
 
@@ -4524,58 +4537,27 @@ yyreduce:
4524
4537
  new->stmtid = ++plpgsql_curr_compile->nstatements;
4525
4538
  new->chain = (yyvsp[(2) - (3)].ival);
4526
4539
 
4527
- (yyval.stmt) = (PLpgSQL_stmt *)new;
4540
+ (yyval.stmt) = (PLpgSQL_stmt *) new;
4528
4541
  ;}
4529
4542
  break;
4530
4543
 
4531
- case 145:
4532
- #line 2236 "pl_gram.y"
4544
+ case 143:
4545
+ #line 2274 "pl_gram.y"
4533
4546
  { (yyval.ival) = true; ;}
4534
4547
  break;
4535
4548
 
4536
- case 146:
4537
- #line 2237 "pl_gram.y"
4549
+ case 144:
4550
+ #line 2275 "pl_gram.y"
4538
4551
  { (yyval.ival) = false; ;}
4539
4552
  break;
4540
4553
 
4541
- case 147:
4542
- #line 2238 "pl_gram.y"
4554
+ case 145:
4555
+ #line 2276 "pl_gram.y"
4543
4556
  { (yyval.ival) = false; ;}
4544
4557
  break;
4545
4558
 
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"
4559
+ case 146:
4560
+ #line 2281 "pl_gram.y"
4579
4561
  {
4580
4562
  /*
4581
4563
  * In principle we should support a cursor_variable
@@ -4599,29 +4581,29 @@ yyreduce:
4599
4581
  ;}
4600
4582
  break;
4601
4583
 
4602
- case 151:
4603
- #line 2292 "pl_gram.y"
4584
+ case 147:
4585
+ #line 2303 "pl_gram.y"
4604
4586
  {
4605
4587
  /* just to give a better message than "syntax error" */
4606
4588
  word_is_not_variable(&((yyvsp[(1) - (1)].word)), (yylsp[(1) - (1)]));
4607
4589
  ;}
4608
4590
  break;
4609
4591
 
4610
- case 152:
4611
- #line 2297 "pl_gram.y"
4592
+ case 148:
4593
+ #line 2308 "pl_gram.y"
4612
4594
  {
4613
4595
  /* just to give a better message than "syntax error" */
4614
4596
  cword_is_not_variable(&((yyvsp[(1) - (1)].cword)), (yylsp[(1) - (1)]));
4615
4597
  ;}
4616
4598
  break;
4617
4599
 
4618
- case 153:
4619
- #line 2304 "pl_gram.y"
4600
+ case 149:
4601
+ #line 2315 "pl_gram.y"
4620
4602
  { (yyval.exception_block) = NULL; ;}
4621
4603
  break;
4622
4604
 
4623
- case 154:
4624
- #line 2306 "pl_gram.y"
4605
+ case 150:
4606
+ #line 2317 "pl_gram.y"
4625
4607
  {
4626
4608
  /*
4627
4609
  * We use a mid-rule action to add these
@@ -4656,8 +4638,8 @@ yyreduce:
4656
4638
  ;}
4657
4639
  break;
4658
4640
 
4659
- case 155:
4660
- #line 2339 "pl_gram.y"
4641
+ case 151:
4642
+ #line 2350 "pl_gram.y"
4661
4643
  {
4662
4644
  PLpgSQL_exception_block *new = (yyvsp[(2) - (3)].exception_block);
4663
4645
  new->exc_list = (yyvsp[(3) - (3)].list);
@@ -4666,22 +4648,22 @@ yyreduce:
4666
4648
  ;}
4667
4649
  break;
4668
4650
 
4669
- case 156:
4670
- #line 2348 "pl_gram.y"
4651
+ case 152:
4652
+ #line 2359 "pl_gram.y"
4671
4653
  {
4672
4654
  (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].exception));
4673
4655
  ;}
4674
4656
  break;
4675
4657
 
4676
- case 157:
4677
- #line 2352 "pl_gram.y"
4658
+ case 153:
4659
+ #line 2363 "pl_gram.y"
4678
4660
  {
4679
4661
  (yyval.list) = list_make1((yyvsp[(1) - (1)].exception));
4680
4662
  ;}
4681
4663
  break;
4682
4664
 
4683
- case 158:
4684
- #line 2358 "pl_gram.y"
4665
+ case 154:
4666
+ #line 2369 "pl_gram.y"
4685
4667
  {
4686
4668
  PLpgSQL_exception *new;
4687
4669
 
@@ -4694,8 +4676,8 @@ yyreduce:
4694
4676
  ;}
4695
4677
  break;
4696
4678
 
4697
- case 159:
4698
- #line 2371 "pl_gram.y"
4679
+ case 155:
4680
+ #line 2382 "pl_gram.y"
4699
4681
  {
4700
4682
  PLpgSQL_condition *old;
4701
4683
 
@@ -4706,15 +4688,15 @@ yyreduce:
4706
4688
  ;}
4707
4689
  break;
4708
4690
 
4709
- case 160:
4710
- #line 2380 "pl_gram.y"
4691
+ case 156:
4692
+ #line 2391 "pl_gram.y"
4711
4693
  {
4712
4694
  (yyval.condition) = (yyvsp[(1) - (1)].condition);
4713
4695
  ;}
4714
4696
  break;
4715
4697
 
4716
- case 161:
4717
- #line 2386 "pl_gram.y"
4698
+ case 157:
4699
+ #line 2397 "pl_gram.y"
4718
4700
  {
4719
4701
  if (strcmp((yyvsp[(1) - (1)].str), "sqlstate") != 0)
4720
4702
  {
@@ -4750,99 +4732,94 @@ yyreduce:
4750
4732
  ;}
4751
4733
  break;
4752
4734
 
4753
- case 162:
4754
- #line 2422 "pl_gram.y"
4735
+ case 158:
4736
+ #line 2433 "pl_gram.y"
4755
4737
  { (yyval.expr) = read_sql_expression(';', ";"); ;}
4756
4738
  break;
4757
4739
 
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"
4740
+ case 159:
4741
+ #line 2437 "pl_gram.y"
4765
4742
  { (yyval.expr) = read_sql_expression(K_THEN, "THEN"); ;}
4766
4743
  break;
4767
4744
 
4768
- case 165:
4769
- #line 2434 "pl_gram.y"
4745
+ case 160:
4746
+ #line 2441 "pl_gram.y"
4770
4747
  { (yyval.expr) = read_sql_expression(K_LOOP, "LOOP"); ;}
4771
4748
  break;
4772
4749
 
4773
- case 166:
4774
- #line 2438 "pl_gram.y"
4750
+ case 161:
4751
+ #line 2445 "pl_gram.y"
4775
4752
  {
4776
4753
  plpgsql_ns_push(NULL, PLPGSQL_LABEL_BLOCK);
4777
4754
  (yyval.str) = NULL;
4778
4755
  ;}
4779
4756
  break;
4780
4757
 
4781
- case 167:
4782
- #line 2443 "pl_gram.y"
4758
+ case 162:
4759
+ #line 2450 "pl_gram.y"
4783
4760
  {
4784
4761
  plpgsql_ns_push((yyvsp[(2) - (3)].str), PLPGSQL_LABEL_BLOCK);
4785
4762
  (yyval.str) = (yyvsp[(2) - (3)].str);
4786
4763
  ;}
4787
4764
  break;
4788
4765
 
4789
- case 168:
4790
- #line 2450 "pl_gram.y"
4766
+ case 163:
4767
+ #line 2457 "pl_gram.y"
4791
4768
  {
4792
4769
  plpgsql_ns_push(NULL, PLPGSQL_LABEL_LOOP);
4793
4770
  (yyval.str) = NULL;
4794
4771
  ;}
4795
4772
  break;
4796
4773
 
4797
- case 169:
4798
- #line 2455 "pl_gram.y"
4774
+ case 164:
4775
+ #line 2462 "pl_gram.y"
4799
4776
  {
4800
4777
  plpgsql_ns_push((yyvsp[(2) - (3)].str), PLPGSQL_LABEL_LOOP);
4801
4778
  (yyval.str) = (yyvsp[(2) - (3)].str);
4802
4779
  ;}
4803
4780
  break;
4804
4781
 
4805
- case 170:
4806
- #line 2462 "pl_gram.y"
4782
+ case 165:
4783
+ #line 2469 "pl_gram.y"
4807
4784
  {
4808
4785
  (yyval.str) = NULL;
4809
4786
  ;}
4810
4787
  break;
4811
4788
 
4812
- case 171:
4813
- #line 2466 "pl_gram.y"
4789
+ case 166:
4790
+ #line 2473 "pl_gram.y"
4814
4791
  {
4815
4792
  /* label validity will be checked by outer production */
4816
4793
  (yyval.str) = (yyvsp[(1) - (1)].str);
4817
4794
  ;}
4818
4795
  break;
4819
4796
 
4820
- case 172:
4821
- #line 2473 "pl_gram.y"
4797
+ case 167:
4798
+ #line 2480 "pl_gram.y"
4822
4799
  { (yyval.expr) = NULL; ;}
4823
4800
  break;
4824
4801
 
4825
- case 173:
4826
- #line 2475 "pl_gram.y"
4802
+ case 168:
4803
+ #line 2482 "pl_gram.y"
4827
4804
  { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
4828
4805
  break;
4829
4806
 
4830
- case 174:
4831
- #line 2482 "pl_gram.y"
4807
+ case 169:
4808
+ #line 2489 "pl_gram.y"
4832
4809
  {
4833
4810
  (yyval.str) = (yyvsp[(1) - (1)].word).ident;
4834
4811
  ;}
4835
4812
  break;
4836
4813
 
4837
- case 175:
4838
- #line 2486 "pl_gram.y"
4814
+ case 170:
4815
+ #line 2493 "pl_gram.y"
4839
4816
  {
4840
4817
  (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword));
4841
4818
  ;}
4842
4819
  break;
4843
4820
 
4844
- case 176:
4845
- #line 2490 "pl_gram.y"
4821
+ case 171:
4822
+ #line 2497 "pl_gram.y"
4846
4823
  {
4847
4824
  if ((yyvsp[(1) - (1)].wdatum).ident == NULL) /* composite name not OK */
4848
4825
  yyerror("syntax error");
@@ -4852,7 +4829,7 @@ yyreduce:
4852
4829
 
4853
4830
 
4854
4831
  /* Line 1267 of yacc.c. */
4855
- #line 4803 "pl_gram.c"
4832
+ #line 4780 "pl_gram.c"
4856
4833
  default: break;
4857
4834
  }
4858
4835
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -5072,7 +5049,7 @@ yyreturn:
5072
5049
  }
5073
5050
 
5074
5051
 
5075
- #line 2582 "pl_gram.y"
5052
+ #line 2588 "pl_gram.y"
5076
5053
 
5077
5054
 
5078
5055
  /*
@@ -5150,7 +5127,8 @@ static PLpgSQL_expr *
5150
5127
  read_sql_expression(int until, const char *expected)
5151
5128
  {
5152
5129
  return read_sql_construct(until, 0, 0, expected,
5153
- "SELECT ", true, true, true, NULL, NULL);
5130
+ RAW_PARSE_PLPGSQL_EXPR,
5131
+ true, true, true, NULL, NULL);
5154
5132
  }
5155
5133
 
5156
5134
  /* Convenience routine to read an expression with two possible terminators */
@@ -5159,15 +5137,17 @@ read_sql_expression2(int until, int until2, const char *expected,
5159
5137
  int *endtoken)
5160
5138
  {
5161
5139
  return read_sql_construct(until, until2, 0, expected,
5162
- "SELECT ", true, true, true, NULL, endtoken);
5140
+ RAW_PARSE_PLPGSQL_EXPR,
5141
+ true, true, true, NULL, endtoken);
5163
5142
  }
5164
5143
 
5165
5144
  /* Convenience routine to read a SQL statement that must end with ';' */
5166
5145
  static PLpgSQL_expr *
5167
- read_sql_stmt(const char *sqlstart)
5146
+ read_sql_stmt(void)
5168
5147
  {
5169
5148
  return read_sql_construct(';', 0, 0, ";",
5170
- sqlstart, false, true, true, NULL, NULL);
5149
+ RAW_PARSE_DEFAULT,
5150
+ false, true, true, NULL, NULL);
5171
5151
  }
5172
5152
 
5173
5153
  /*
@@ -5177,9 +5157,9 @@ read_sql_stmt(const char *sqlstart)
5177
5157
  * until2: token code for alternate terminator (pass 0 if none)
5178
5158
  * until3: token code for another alternate terminator (pass 0 if none)
5179
5159
  * expected: text to use in complaining that terminator was not found
5180
- * sqlstart: text to prefix to the accumulated SQL text
5160
+ * parsemode: raw_parser() mode to use
5181
5161
  * 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)
5162
+ * valid_sql: whether to check the syntax of the expr
5183
5163
  * trim: trim trailing whitespace
5184
5164
  * startloc: if not NULL, location of first token is stored at *startloc
5185
5165
  * endtoken: if not NULL, ending token is stored at *endtoken
@@ -5190,22 +5170,21 @@ read_sql_construct(int until,
5190
5170
  int until2,
5191
5171
  int until3,
5192
5172
  const char *expected,
5193
- const char *sqlstart,
5173
+ RawParseMode parsemode,
5194
5174
  bool isexpression,
5195
5175
  bool valid_sql,
5196
5176
  bool trim,
5197
5177
  int *startloc,
5198
5178
  int *endtoken)
5199
5179
  {
5200
- int tok;
5201
- StringInfoData ds;
5202
- IdentifierLookup save_IdentifierLookup;
5203
- int startlocation = -1;
5204
- int parenlevel = 0;
5205
- PLpgSQL_expr *expr;
5180
+ int tok;
5181
+ StringInfoData ds;
5182
+ IdentifierLookup save_IdentifierLookup;
5183
+ int startlocation = -1;
5184
+ int parenlevel = 0;
5185
+ PLpgSQL_expr *expr;
5206
5186
 
5207
5187
  initStringInfo(&ds);
5208
- appendStringInfoString(&ds, sqlstart);
5209
5188
 
5210
5189
  /* special lookup mode for identifiers within the SQL text */
5211
5190
  save_IdentifierLookup = plpgsql_IdentifierLookup;
@@ -5280,15 +5259,16 @@ read_sql_construct(int until,
5280
5259
  }
5281
5260
 
5282
5261
  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();
5262
+ expr->query = pstrdup(ds.data);
5263
+ expr->parseMode = parsemode;
5264
+ expr->plan = NULL;
5265
+ expr->paramnos = NULL;
5266
+ expr->target_param = -1;
5267
+ expr->ns = plpgsql_ns_top();
5288
5268
  pfree(ds.data);
5289
5269
 
5290
5270
  if (valid_sql)
5291
- check_sql_expr(expr->query, startlocation, strlen(sqlstart));
5271
+ check_sql_expr(expr->query, expr->parseMode, startlocation);
5292
5272
 
5293
5273
  return expr;
5294
5274
  }
@@ -5296,11 +5276,11 @@ read_sql_construct(int until,
5296
5276
  static PLpgSQL_type *
5297
5277
  read_datatype(int tok)
5298
5278
  {
5299
- StringInfoData ds;
5300
- char *type_name;
5301
- int startlocation;
5302
- PLpgSQL_type *result;
5303
- int parenlevel = 0;
5279
+ StringInfoData ds;
5280
+ char *type_name;
5281
+ int startlocation;
5282
+ PLpgSQL_type *result;
5283
+ int parenlevel = 0;
5304
5284
 
5305
5285
  /* Should only be called while parsing DECLARE sections */
5306
5286
  Assert(plpgsql_IdentifierLookup == IDENTIFIER_LOOKUP_DECLARE);
@@ -5317,7 +5297,7 @@ read_datatype(int tok)
5317
5297
  */
5318
5298
  if (tok == T_WORD)
5319
5299
  {
5320
- char *dtname = yylval.word.ident;
5300
+ char *dtname = yylval.word.ident;
5321
5301
 
5322
5302
  tok = yylex();
5323
5303
  if (tok == '%')
@@ -5341,7 +5321,7 @@ read_datatype(int tok)
5341
5321
  }
5342
5322
  else if (plpgsql_token_is_unreserved_keyword(tok))
5343
5323
  {
5344
- char *dtname = pstrdup(yylval.keyword);
5324
+ char *dtname = pstrdup(yylval.keyword);
5345
5325
 
5346
5326
  tok = yylex();
5347
5327
  if (tok == '%')
@@ -5365,7 +5345,7 @@ read_datatype(int tok)
5365
5345
  }
5366
5346
  else if (tok == T_CWORD)
5367
5347
  {
5368
- List *dtnames = yylval.cword.idents;
5348
+ List *dtnames = yylval.cword.idents;
5369
5349
 
5370
5350
  tok = yylex();
5371
5351
  if (tok == '%')
@@ -5432,17 +5412,17 @@ read_datatype(int tok)
5432
5412
  static PLpgSQL_stmt *
5433
5413
  make_execsql_stmt(int firsttoken, int location)
5434
5414
  {
5435
- StringInfoData ds;
5436
- IdentifierLookup save_IdentifierLookup;
5415
+ StringInfoData ds;
5416
+ IdentifierLookup save_IdentifierLookup;
5437
5417
  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;
5418
+ PLpgSQL_expr *expr;
5419
+ PLpgSQL_variable *target = NULL;
5420
+ int tok;
5421
+ int prev_tok;
5422
+ bool have_into = false;
5423
+ bool have_strict = false;
5424
+ int into_start_loc = -1;
5425
+ int into_end_loc = -1;
5446
5426
 
5447
5427
  initStringInfo(&ds);
5448
5428
 
@@ -5493,6 +5473,8 @@ make_execsql_stmt(int firsttoken, int location)
5493
5473
  {
5494
5474
  if (prev_tok == K_INSERT)
5495
5475
  continue; /* INSERT INTO is not an INTO-target */
5476
+ if (prev_tok == K_MERGE)
5477
+ continue; /* MERGE INTO is not an INTO-target */
5496
5478
  if (firsttoken == K_IMPORT)
5497
5479
  continue; /* IMPORT ... INTO is not an INTO-target */
5498
5480
  if (have_into)
@@ -5526,23 +5508,24 @@ make_execsql_stmt(int firsttoken, int location)
5526
5508
  ds.data[--ds.len] = '\0';
5527
5509
 
5528
5510
  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();
5511
+ expr->query = pstrdup(ds.data);
5512
+ expr->parseMode = RAW_PARSE_DEFAULT;
5513
+ expr->plan = NULL;
5514
+ expr->paramnos = NULL;
5515
+ expr->target_param = -1;
5516
+ expr->ns = plpgsql_ns_top();
5534
5517
  pfree(ds.data);
5535
5518
 
5536
- check_sql_expr(expr->query, location, 0);
5519
+ check_sql_expr(expr->query, expr->parseMode, location);
5537
5520
 
5538
5521
  execsql = palloc0(sizeof(PLpgSQL_stmt_execsql));
5539
5522
  execsql->cmd_type = PLPGSQL_STMT_EXECSQL;
5540
- execsql->lineno = plpgsql_location_to_lineno(location);
5541
- execsql->stmtid = ++plpgsql_curr_compile->nstatements;
5523
+ execsql->lineno = plpgsql_location_to_lineno(location);
5524
+ execsql->stmtid = ++plpgsql_curr_compile->nstatements;
5542
5525
  execsql->sqlstmt = expr;
5543
- execsql->into = have_into;
5544
- execsql->strict = have_strict;
5545
- execsql->target = target;
5526
+ execsql->into = have_into;
5527
+ execsql->strict = have_strict;
5528
+ execsql->target = target;
5546
5529
 
5547
5530
  return (PLpgSQL_stmt *) execsql;
5548
5531
  }
@@ -5564,11 +5547,11 @@ read_fetch_direction(void)
5564
5547
  */
5565
5548
  fetch = (PLpgSQL_stmt_fetch *) palloc0(sizeof(PLpgSQL_stmt_fetch));
5566
5549
  fetch->cmd_type = PLPGSQL_STMT_FETCH;
5567
- fetch->stmtid = ++plpgsql_curr_compile->nstatements;
5550
+ fetch->stmtid = ++plpgsql_curr_compile->nstatements;
5568
5551
  /* set direction defaults: */
5569
5552
  fetch->direction = FETCH_FORWARD;
5570
- fetch->how_many = 1;
5571
- fetch->expr = NULL;
5553
+ fetch->how_many = 1;
5554
+ fetch->expr = NULL;
5572
5555
  fetch->returns_multiple_rows = false;
5573
5556
 
5574
5557
  tok = yylex();
@@ -5749,11 +5732,11 @@ make_return_next_stmt(int location)
5749
5732
  parser_errposition(location)));
5750
5733
 
5751
5734
  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;
5735
+ new->cmd_type = PLPGSQL_STMT_RETURN_NEXT;
5736
+ new->lineno = plpgsql_location_to_lineno(location);
5737
+ new->stmtid = ++plpgsql_curr_compile->nstatements;
5738
+ new->expr = NULL;
5739
+ new->retvarno = -1;
5757
5740
 
5758
5741
  if (plpgsql_curr_compile->out_param_varno >= 0)
5759
5742
  {
@@ -5770,7 +5753,7 @@ make_return_next_stmt(int location)
5770
5753
  * We want to special-case simple variable references for efficiency.
5771
5754
  * So peek ahead to see if that's what we have.
5772
5755
  */
5773
- int tok = yylex();
5756
+ int tok = yylex();
5774
5757
 
5775
5758
  if (tok == T_DATUM && plpgsql_peek() == ';' &&
5776
5759
  (yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_VAR ||
@@ -5822,12 +5805,12 @@ make_return_query_stmt(int location)
5822
5805
  {
5823
5806
  /* ordinary static query */
5824
5807
  plpgsql_push_back_token(tok);
5825
- new->query = read_sql_stmt("");
5808
+ new->query = read_sql_stmt();
5826
5809
  }
5827
5810
  else
5828
5811
  {
5829
5812
  /* dynamic SQL */
5830
- int term;
5813
+ int term;
5831
5814
 
5832
5815
  new->dynquery = read_sql_expression2(';', K_USING, "; or USING",
5833
5816
  &term);
@@ -5880,11 +5863,6 @@ check_assignable(PLpgSQL_datum *datum, int location)
5880
5863
  check_assignable(plpgsql_Datums[((PLpgSQL_recfield *) datum)->recparentno],
5881
5864
  location);
5882
5865
  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
5866
  default:
5889
5867
  elog(ERROR, "unrecognized dtype: %d", datum->dtype);
5890
5868
  break;
@@ -5960,16 +5938,16 @@ read_into_scalar_list(char *initial_name,
5960
5938
  PLpgSQL_datum *initial_datum,
5961
5939
  int initial_location)
5962
5940
  {
5963
- int nfields;
5964
- char *fieldnames[1024];
5965
- int varnos[1024];
5966
- PLpgSQL_row *row;
5967
- int tok;
5941
+ int nfields;
5942
+ char *fieldnames[1024];
5943
+ int varnos[1024];
5944
+ PLpgSQL_row *row;
5945
+ int tok;
5968
5946
 
5969
5947
  check_assignable(initial_datum, initial_location);
5970
5948
  fieldnames[0] = initial_name;
5971
- varnos[0] = initial_datum->dno;
5972
- nfields = 1;
5949
+ varnos[0] = initial_datum->dno;
5950
+ nfields = 1;
5973
5951
 
5974
5952
  while ((tok = yylex()) == ',')
5975
5953
  {
@@ -6022,7 +6000,7 @@ read_into_scalar_list(char *initial_name,
6022
6000
  row->varnos[nfields] = varnos[nfields];
6023
6001
  }
6024
6002
 
6025
- plpgsql_adddatum((PLpgSQL_datum *)row);
6003
+ plpgsql_adddatum((PLpgSQL_datum *) row);
6026
6004
 
6027
6005
  return row;
6028
6006
  }
@@ -6039,7 +6017,7 @@ make_scalar_list1(char *initial_name,
6039
6017
  PLpgSQL_datum *initial_datum,
6040
6018
  int lineno, int location)
6041
6019
  {
6042
- PLpgSQL_row *row;
6020
+ PLpgSQL_row *row;
6043
6021
 
6044
6022
  check_assignable(initial_datum, location);
6045
6023
 
@@ -6054,7 +6032,7 @@ make_scalar_list1(char *initial_name,
6054
6032
  row->fieldnames[0] = initial_name;
6055
6033
  row->varnos[0] = initial_datum->dno;
6056
6034
 
6057
- plpgsql_adddatum((PLpgSQL_datum *)row);
6035
+ plpgsql_adddatum((PLpgSQL_datum *) row);
6058
6036
 
6059
6037
  return row;
6060
6038
  }
@@ -6077,13 +6055,12 @@ make_scalar_list1(char *initial_name,
6077
6055
  * borders. So it is best to bail out as early as we can.
6078
6056
  *
6079
6057
  * 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.
6058
+ * beginning at offset "location". We use this assumption to transpose
6059
+ * any error cursor position back to the function source text.
6083
6060
  * If no error cursor is provided, we'll just point at "location".
6084
6061
  */
6085
6062
  static void
6086
- check_sql_expr(const char *stmt, int location, int leaderlen)
6063
+ check_sql_expr(const char *stmt, RawParseMode parseMode, int location)
6087
6064
  {
6088
6065
  sql_error_callback_arg cbarg;
6089
6066
  ErrorContextCallback syntax_errcontext;
@@ -6093,7 +6070,6 @@ check_sql_expr(const char *stmt, int location, int leaderlen)
6093
6070
  return;
6094
6071
 
6095
6072
  cbarg.location = location;
6096
- cbarg.leaderlen = leaderlen;
6097
6073
 
6098
6074
  syntax_errcontext.callback = plpgsql_sql_error_callback;
6099
6075
  syntax_errcontext.arg = &cbarg;
@@ -6101,7 +6077,7 @@ check_sql_expr(const char *stmt, int location, int leaderlen)
6101
6077
  error_context_stack = &syntax_errcontext;
6102
6078
 
6103
6079
  oldCxt = MemoryContextSwitchTo(plpgsql_compile_tmp_cxt);
6104
- (void) raw_parser(stmt);
6080
+ (void) raw_parser(stmt, parseMode);
6105
6081
  MemoryContextSwitchTo(oldCxt);
6106
6082
 
6107
6083
  /* Restore former ereport callback */
@@ -6126,12 +6102,12 @@ plpgsql_sql_error_callback(void *arg)
6126
6102
  * Note we are dealing with 1-based character numbers at this point.
6127
6103
  */
6128
6104
  errpos = geterrposition();
6129
- if (errpos > cbarg->leaderlen)
6105
+ if (errpos > 0)
6130
6106
  {
6131
- int myerrpos = getinternalerrposition();
6107
+ int myerrpos = getinternalerrposition();
6132
6108
 
6133
6109
  if (myerrpos > 0) /* safety check */
6134
- internalerrposition(myerrpos + errpos - cbarg->leaderlen - 1);
6110
+ internalerrposition(myerrpos + errpos - 1);
6135
6111
  }
6136
6112
 
6137
6113
  /* In any case, flush errposition --- we want internalerrposition only */
@@ -6185,7 +6161,7 @@ check_labels(const char *start_label, const char *end_label, int end_location)
6185
6161
  * parens).
6186
6162
  */
6187
6163
  static PLpgSQL_expr *
6188
- read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6164
+ read_cursor_args(PLpgSQL_var *cursor, int until)
6189
6165
  {
6190
6166
  PLpgSQL_expr *expr;
6191
6167
  PLpgSQL_row *row;
@@ -6193,7 +6169,6 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6193
6169
  int argc;
6194
6170
  char **argv;
6195
6171
  StringInfoData ds;
6196
- char *sqlstart = "SELECT ";
6197
6172
  bool any_named = false;
6198
6173
 
6199
6174
  tok = yylex();
@@ -6230,11 +6205,11 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6230
6205
  for (argc = 0; argc < row->nfields; argc++)
6231
6206
  {
6232
6207
  PLpgSQL_expr *item;
6233
- int endtoken;
6234
- int argpos;
6235
- int tok1,
6236
- tok2;
6237
- int arglocation;
6208
+ int endtoken;
6209
+ int argpos;
6210
+ int tok1,
6211
+ tok2;
6212
+ int arglocation;
6238
6213
 
6239
6214
  /* Check if it's a named parameter: "param := value" */
6240
6215
  plpgsql_peek2(&tok1, &tok2, &arglocation, NULL);
@@ -6294,12 +6269,12 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6294
6269
  */
6295
6270
  item = read_sql_construct(',', ')', 0,
6296
6271
  ",\" or \")",
6297
- sqlstart,
6272
+ RAW_PARSE_PLPGSQL_EXPR,
6298
6273
  true, true,
6299
6274
  false, /* do not trim */
6300
6275
  NULL, &endtoken);
6301
6276
 
6302
- argv[argpos] = item->query + strlen(sqlstart);
6277
+ argv[argpos] = item->query;
6303
6278
 
6304
6279
  if (endtoken == ')' && !(argc == row->nfields - 1))
6305
6280
  ereport(ERROR,
@@ -6318,7 +6293,6 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6318
6293
 
6319
6294
  /* Make positional argument list */
6320
6295
  initStringInfo(&ds);
6321
- appendStringInfoString(&ds, sqlstart);
6322
6296
  for (argc = 0; argc < row->nfields; argc++)
6323
6297
  {
6324
6298
  Assert(argv[argc] != NULL);
@@ -6334,14 +6308,14 @@ read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
6334
6308
  if (argc < row->nfields - 1)
6335
6309
  appendStringInfoString(&ds, ", ");
6336
6310
  }
6337
- appendStringInfoChar(&ds, ';');
6338
6311
 
6339
6312
  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();
6313
+ expr->query = pstrdup(ds.data);
6314
+ expr->parseMode = RAW_PARSE_PLPGSQL_EXPR;
6315
+ expr->plan = NULL;
6316
+ expr->paramnos = NULL;
6317
+ expr->target_param = -1;
6318
+ expr->ns = plpgsql_ns_top();
6345
6319
  pfree(ds.data);
6346
6320
 
6347
6321
  /* Next we'd better find the until token */
@@ -6363,7 +6337,7 @@ read_raise_options(void)
6363
6337
  for (;;)
6364
6338
  {
6365
6339
  PLpgSQL_raise_option *opt;
6366
- int tok;
6340
+ int tok;
6367
6341
 
6368
6342
  if ((tok = yylex()) == 0)
6369
6343
  yyerror("unexpected end of function definition");
@@ -6457,7 +6431,7 @@ static PLpgSQL_stmt *
6457
6431
  make_case(int location, PLpgSQL_expr *t_expr,
6458
6432
  List *case_when_list, List *else_stmts)
6459
6433
  {
6460
- PLpgSQL_stmt_case *new;
6434
+ PLpgSQL_stmt_case *new;
6461
6435
 
6462
6436
  new = palloc(sizeof(PLpgSQL_stmt_case));
6463
6437
  new->cmd_type = PLPGSQL_STMT_CASE;
@@ -6483,9 +6457,9 @@ make_case(int location, PLpgSQL_expr *t_expr,
6483
6457
  */
6484
6458
  if (t_expr)
6485
6459
  {
6486
- char varname[32];
6460
+ char varname[32];
6487
6461
  PLpgSQL_var *t_var;
6488
- ListCell *l;
6462
+ ListCell *l;
6489
6463
 
6490
6464
  /* use a name unlikely to collide with any user names */
6491
6465
  snprintf(varname, sizeof(varname), "__Case__Variable_%d__",
@@ -6508,16 +6482,16 @@ make_case(int location, PLpgSQL_expr *t_expr,
6508
6482
  {
6509
6483
  PLpgSQL_case_when *cwt = (PLpgSQL_case_when *) lfirst(l);
6510
6484
  PLpgSQL_expr *expr = cwt->expr;
6511
- StringInfoData ds;
6485
+ StringInfoData ds;
6512
6486
 
6513
- /* copy expression query without SELECT keyword (expr->query + 7) */
6514
- Assert(strncmp(expr->query, "SELECT ", 7) == 0);
6487
+ /* We expect to have expressions not statements */
6488
+ Assert(expr->parseMode == RAW_PARSE_PLPGSQL_EXPR);
6515
6489
 
6516
- /* And do the string hacking */
6490
+ /* Do the string hacking */
6517
6491
  initStringInfo(&ds);
6518
6492
 
6519
- appendStringInfo(&ds, "SELECT \"%s\" IN (%s)",
6520
- varname, expr->query + 7);
6493
+ appendStringInfo(&ds, "\"%s\" IN (%s)",
6494
+ varname, expr->query);
6521
6495
 
6522
6496
  pfree(expr->query);
6523
6497
  expr->query = pstrdup(ds.data);