[MXS-4147] multi-statement detection is not working for create procedure Created: 2022-05-30 Updated: 2022-06-09 Resolved: 2022-06-09 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | N/A |
| Affects Version/s: | 2.4 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | danielforever | Assignee: | markus makela |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Description |
|
select 1; CREATE PROCEDURE doiterate(p1 INT) The create procedure has multiple statements, and there's `if else end if` clause. |
| Comments |
| Comment by danielforever [ 2022-06-07 ] | ||||||||||||||||||||||||||
|
@markus any update on this? | ||||||||||||||||||||||||||
| Comment by markus makela [ 2022-06-07 ] | ||||||||||||||||||||||||||
|
daniel_xu_forever seems to work as expected on the latest 2.4 version:
| ||||||||||||||||||||||||||
| Comment by markus makela [ 2022-06-07 ] | ||||||||||||||||||||||||||
|
Please attach the configuration you used (remove any passwords or other sensitive information) and which client program you used to execute the SQL. | ||||||||||||||||||||||||||
| Comment by danielforever [ 2022-06-08 ] | ||||||||||||||||||||||||||
|
@markus My bad, I didn't describe the issue clearly. Using the following sql as an example, the algorithm works like this: It jumps to the first `;` and tries to skip the procedure (with multi-sql procedure, it fails to skip it). Then it starts to check whether the remaining tokens are comments or non-sql (in this case, they aren't) so it will be regarded as multi-statement. CREATE PROCEDURE doiterate(p1 INT) | ||||||||||||||||||||||||||
| Comment by markus makela [ 2022-06-08 ] | ||||||||||||||||||||||||||
|
The fact that it claims the CREATE PROCEDURE is a multi-statement might be wrong but the way it is routed is correct: to the current master server. All multi-statement SQL queries (CREATE PRODECURE and BEGIN NOT ATOMIC blocks) are all treated as if they were writes as the parser in MaxScale does not parse those fully. Is there some practical problem that this behavior causes? | ||||||||||||||||||||||||||
| Comment by markus makela [ 2022-06-09 ] | ||||||||||||||||||||||||||
|
I'll close this as Not a Bug since it's expected and correct behavior to treat compound statements the same way multi-statements are treated. |