[MDEV-31648] Inconsistant behavior when local variable is declared with the same name as a column within trigger Created: 2023-07-08 Updated: 2023-07-08 Resolved: 2023-07-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Parser |
| Affects Version/s: | 10.6.14 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Julien | Assignee: | Sergei Golubchik |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | select, triggers | ||
| Environment: |
Reproduced on 10.6.14 on linux and windows. |
||
| Description |
|
It may be the expected behavior, although it would feel weird to me, but if so the documentation for "select into" is incorrect or incomplete. The bellow code will display "111, 6" instead of the expected "111, 555" :
BUT if renaming the local variable to something else, we get the expected values of 111, 555
Moreover, if removing the "DECLARE" line entirely, we get the expected "#1327 - Undeclared variable: val" error, indicating a local variable is expected after the "INTO", even if it's not assigning it properly when a column of the same name exists. |
| Comments |
| Comment by Sergei Golubchik [ 2023-07-08 ] | |
|
It is assigning it properly and it's not specific to SELECT ... INTO.
then you'll get 111, 555 |