[MDEV-26299] Some views force server (and mysqldump) to generate invalid SQL for their definitions Created: 2021-08-03 Updated: 2021-11-23 Resolved: 2021-10-18 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Information Schema, Scripts & Clients, Views |
| Affects Version/s: | 10.5.10, 10.5.12, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7 |
| Fix Version/s: | 10.2.41, 10.3.32, 10.4.22, 10.5.13, 10.6.5, 10.7.1 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Valerii Kravchuk | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | mysqldump | ||
| Description |
|
mysqldump used to have problems generating SQL for views (see
Do not mind the completely stupid view definition - it's used in purpose to simplify and obfuscate the real one, so it's easy to reproduce the problem. So, we have this stupid view with proper column names:
But you can already spot the problem above, see this column alias generated for some reason:
Surely if we dump and try to reload, it fails:
It seems to be more a server problem, as we can see from SHOW CREATE VIEW. Simpler cases seems to be covered by the fix to MySQL bug #65388 we merged, but not this complex one. |
| Comments |
| Comment by Oleksandr Byelkin [ 2021-09-15 ] | |||||||||||||||||||||||||||||||
|
I checked, if put definition returned by SHOW CREATE VIEW back to the server and there was no an error, so no problem with SHOW CREATE VIEW. The problem made probably by mysqldump, which try "verschlimmbessern" the result of SHOW CREATE VIEW. i.e. the problem existts and it is problem of mysqldump utility (with high probability). | |||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2021-09-15 ] | |||||||||||||||||||||||||||||||
|
Please check again, something was wrong with your experiment. Copy-pasting SHOW CREATE from the description does cause a syntax error.
| |||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-09-15 ] | |||||||||||||||||||||||||||||||
|
I used mysqltest as usual so yes, I have not noticed the error. | |||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-10-01 ] | |||||||||||||||||||||||||||||||
|
It looks like we need escape automatic generated names for views or just regenerate them in case of presence of symbols which should be escaped. | |||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-10-01 ] | |||||||||||||||||||||||||||||||
|
despite clame of valerii the bug is present beginning from 10.2 and shoud be fixed there | |||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-10-01 ] | |||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-10-01 ] | |||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-10-01 ] | |||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-10-01 ] | |||||||||||||||||||||||||||||||
|
in the test case problem was that the name was too long, other cases also probably possible. | |||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-10-15 ] | |||||||||||||||||||||||||||||||
|
I checked if it is easy to fix automatic names, IMHO in 10.2 it can interfer with many other code including Item comparison | |||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-10-18 ] | |||||||||||||||||||||||||||||||
|
branch bb-10.2-
| |||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2021-10-18 ] | |||||||||||||||||||||||||||||||
|
ok to push |