You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Exporting views with union does not put a space before the keyword union #19692
When exporting a view with a union statement, there is no space between the word 'union' and the token before it. While this isn't a problem if the previous token is a closing parenthesis, it is a problem if it isn't, for example:
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `sshkeys` AS SELECT `A`.`username` AS `username`, sshkey_convert(`A`.`public_key` AS `public_key`) AS `public_key` FROM (`ftp_accounts`.`sshkeys` `A` left join `ftp_accounts`.`accounts` `B` on(`A`.`username` = `B`.`username`)) WHERE `B`.`status` & 3 = 3union all (select `C`.`username` AS `username`,sshkey_convert(`C`.`public_key` AS `public_key`) AS `public_key` from `ftp_accounts`.`system_keys` `C` where sysuser_status(`C`.`username` AS `username`) = 0) ;
As shown above, the view gets exported with '[...]B.status & 3 = 3union all [...]', which causes an error when run.
How to Reproduce
Create a view with a union where the union statement comes after an expression other than a closing parenthesis.
Expected behavior
I expected the exported create view statement to be valid SQL.
Activity