Commit 55caaae
committed
Improve handling of array elements as getdiag_targets and cursor_variables.
There's no good reason why plpgsql's GET DIAGNOSTICS statement can't
support an array element as target variable, since the execution code
already uses the generic exec_assign_value() function to assign to it.
Hence, refactor the grammar to allow that, by making getdiag_target
depend on the assign_var production.
Ideally we'd also let a cursor_variable expand to an element of a
refcursor[] array, but that's substantially harder since those statements
also have to handle bound-cursor-variable cases. For now, just make sure
the reported error is sensible, ie "cursor variable must be a simple
variable" not "variable must be of type cursor or refcursor". The latter
was quite confusing from the user's viewpoint, since what he wrote
satisfies the claimed restriction.
Per bug #14463 from Zhou Digoal. Given the lack of previous complaints,
I see no need for a back-patch.
Discussion: https://postgr.es/m/20161213152548.14897.81245@wrigleys.postgresql.org1 parent 1f542a2 commit 55caaae
File tree
3 files changed
+33
-22
lines changed- src
- pl/plpgsql/src
- test/regress
- expected
- sql
3 files changed
+33
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| |||
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
212 | | - | |
| 213 | + | |
| 214 | + | |
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
| |||
916 | 918 | | |
917 | 919 | | |
918 | 920 | | |
919 | | - | |
| 921 | + | |
920 | 922 | | |
921 | 923 | | |
922 | 924 | | |
| |||
1014 | 1016 | | |
1015 | 1017 | | |
1016 | 1018 | | |
1017 | | - | |
| 1019 | + | |
1018 | 1020 | | |
1019 | 1021 | | |
1020 | 1022 | | |
| |||
1069 | 1071 | | |
1070 | 1072 | | |
1071 | 1073 | | |
1072 | | - | |
| 1074 | + | |
1073 | 1075 | | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
| 1076 | + | |
| 1077 | + | |
1077 | 1078 | | |
1078 | 1079 | | |
1079 | 1080 | | |
1080 | | - | |
| 1081 | + | |
1081 | 1082 | | |
1082 | | - | |
| 1083 | + | |
1083 | 1084 | | |
1084 | 1085 | | |
1085 | 1086 | | |
| |||
1097 | 1098 | | |
1098 | 1099 | | |
1099 | 1100 | | |
1100 | | - | |
| 1101 | + | |
1101 | 1102 | | |
1102 | 1103 | | |
1103 | 1104 | | |
| |||
1106 | 1107 | | |
1107 | 1108 | | |
1108 | 1109 | | |
1109 | | - | |
| 1110 | + | |
1110 | 1111 | | |
1111 | 1112 | | |
1112 | 1113 | | |
1113 | 1114 | | |
1114 | 1115 | | |
1115 | | - | |
| 1116 | + | |
1116 | 1117 | | |
1117 | 1118 | | |
1118 | 1119 | | |
| |||
2173 | 2174 | | |
2174 | 2175 | | |
2175 | 2176 | | |
2176 | | - | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
2177 | 2184 | | |
2178 | 2185 | | |
2179 | 2186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4623 | 4623 | | |
4624 | 4624 | | |
4625 | 4625 | | |
| 4626 | + | |
4626 | 4627 | | |
4627 | 4628 | | |
4628 | 4629 | | |
| |||
4631 | 4632 | | |
4632 | 4633 | | |
4633 | 4634 | | |
4634 | | - | |
4635 | | - | |
| 4635 | + | |
| 4636 | + | |
| 4637 | + | |
4636 | 4638 | | |
4637 | | - | |
4638 | | - | |
| 4639 | + | |
| 4640 | + | |
4639 | 4641 | | |
4640 | 4642 | | |
4641 | 4643 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3719 | 3719 | | |
3720 | 3720 | | |
3721 | 3721 | | |
| 3722 | + | |
3722 | 3723 | | |
3723 | 3724 | | |
3724 | 3725 | | |
| |||
3727 | 3728 | | |
3728 | 3729 | | |
3729 | 3730 | | |
3730 | | - | |
3731 | | - | |
| 3731 | + | |
| 3732 | + | |
| 3733 | + | |
3732 | 3734 | | |
3733 | | - | |
3734 | | - | |
| 3735 | + | |
| 3736 | + | |
3735 | 3737 | | |
3736 | 3738 | | |
3737 | 3739 | | |
| |||
0 commit comments