Fix #655 - Missing space before UNION when building CREATE VIEW by predictor2718 · Pull Request #656 · phpmyadmin/sql-parser · GitHub
Skip to content

Fix #655 - Missing space before UNION when building CREATE VIEW#656

Open
predictor2718 wants to merge 1 commit into
phpmyadmin:5.11.xfrom
predictor2718:fix/19692-view-union-space
Open

Fix #655 - Missing space before UNION when building CREATE VIEW#656
predictor2718 wants to merge 1 commit into
phpmyadmin:5.11.xfrom
predictor2718:fix/19692-view-union-space

Conversation

@predictor2718

Copy link
Copy Markdown
Contributor

Fixes #655.

CreateStatement::build() glued the built SELECT directly to the trailing body
tokens when rebuilding a CREATE VIEW ... AS SELECT ... UNION ..., producing
invalid SQL like ... WHERE 3 = 3union all (...).

Insert a single space between $builtStatement and the body tokens only when
both sides are non-empty and neither boundary character is whitespace, so the
paren-wrapped LHS case (AS (select ...) union all (...)) doesn't get a double
space.

Includes a regression test in tests/Builder/CreateStatementTest.php.

Also addresses phpMyAdmin reports:

Signed-off-by: predictor2718 245527909+predictor2718@users.noreply.github.com

…VIEW

Signed-off-by: predictor2718 <245527909+predictor2718@users.noreply.github.com>
@codecov

codecov Bot commented Apr 24, 2026

Copy link
Copy Markdown

@williamdes williamdes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants