[MDEV-26602] User defined function with SIGNAL SQLSTATE is always evaluated inside built-in IF() function Created: 2021-08-27 Updated: 2021-09-14 Resolved: 2021-09-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Stored routines |
| Affects Version/s: | 10.3, 10.4, 10.5, 10.6, 10.7 |
| Fix Version/s: | 10.3.31, 10.4.21, 10.5.12, 10.6.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Edward Stoever | Assignee: | Oleksandr Byelkin |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
This behavior is found in Community and Enterprise editions. One of my databases is not with the unexpected behavior (green), see image "two-different-installs-of-MariaDB-on-DEBIAN". The globals of these two machines are identical. The mariadbd files are identical on these machines. This is what I believe should be the expected behavior:
This is the behavior most often seen:
SQL_MODE for these two are identical: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
| Comments |
| Comment by Roel Van de Paar [ 2021-08-30 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
10.2 Also produces a different result than 10.3-10.7:
Leads to:
Not immediately sure what causes the differences (all settings seem identical) nor what the correct outcome is in this case, nor why the issue happens on the same version on the original reporter's two instances. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2021-09-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
sanja Thanks for checking. My testing was done in CS. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-09-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-09-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
test suite does not allow to reproduce, only command line does, probably not all relevant settings are mentioned in the test suite (usually charsets) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-09-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
SQL_MODE is irrelivant, but character_set_connection is relevant to the bug, correct test case:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2021-09-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For anyone wanting to test the updated testcase on the command line, change the delimiter syntax from //; to // and from ;// to ; to make it work there. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-09-14 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The function is evalueted because description of the function is wrong, it should be NOT DETERMINISTIC (it has side effect of breaking execution and issuing the error). So it is not a but at all. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2021-09-14 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
sanja Why is the output on 10.2 different? Thanks | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-09-14 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Roel I mentioned you because you have checked it It is not on 10.2, because 10.2 process constants in other way | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2021-09-14 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Moved to MDEV as suggested. |