pg_query 2.0.3 → 5.1.0

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