René's URL Explorer Experiment


Title: Accept non-reserved keyword and quoted CTE names (#662) by youdie006 · Pull Request #667 · phpmyadmin/sql-parser · GitHub

Open Graph Title: Accept non-reserved keyword and quoted CTE names (#662) by youdie006 · Pull Request #667 · phpmyadmin/sql-parser

X Title: Accept non-reserved keyword and quoted CTE names (#662) by youdie006 · Pull Request #667 · phpmyadmin/sql-parser

Description: Fixes #662. Problem The WITH (CTE) parser rejects valid CTE names. MySQL accepts a non-reserved keyword (e.g. data, text) as an unquoted identifier, and any identifier when backtick-quoted, but the parser reports The name of the CTE was expected. for: WITH data AS (SELECT 1) SELECT * FROM data The same happens for a backtick-quoted name such as WITH \my_cte` AS (...)`. Root cause In WithStatement::parse() the CTE-name state only accepts a token of type TokenType::None. A non-reserved keyword is lexed as TokenType::Keyword (without FLAG_KEYWORD_RESERVED), and a backtick-quoted identifier as TokenType::Symbol (with FLAG_SYMBOL_BACKTICK), so both fail the guard and are reported as errors. Fix Also accept a non-reserved keyword and a backtick-quoted symbol as the CTE name. Token::$value already carries the correct name (backticks stripped for the symbol case, the keyword text for the keyword case), so the rest of the method is unchanged. Reserved keywords (e.g. SELECT) are still rejected. The old condition negated preg_match() (int|false), suppressed by a PHPStan baseline entry; the new condition compares explicitly (=== 1), so I removed the now-obsolete baseline entry. Test Added testWithNonReservedOrQuotedName (data provider) to tests/Parser/WithStatementTest.php, covering a non-reserved keyword name, a backtick-quoted keyword name, and a backtick-quoted identifier with a space. Red-green verified: before the fix all three produce The name of the CTE was expected.; after, each parses with zero errors and the expected wither name. Verified locally under PHP 8.4: full phpunit (1023 tests), phpcs and psalm clean. phpstan reports only one pre-existing error in CreateStatement.php that is also present on the unmodified tree (a baseline/PHP-version artifact unrelated to this change). Disclosure: prepared with AI assistance (Claude); I reviewed it and verified the red-green test and the project test/analysis gates.

Open Graph Description: Fixes #662. Problem The WITH (CTE) parser rejects valid CTE names. MySQL accepts a non-reserved keyword (e.g. data, text) as an unquoted identifier, and any identifier when backtick-quoted, but the...

X Description: Fixes #662. Problem The WITH (CTE) parser rejects valid CTE names. MySQL accepts a non-reserved keyword (e.g. data, text) as an unquoted identifier, and any identifier when backtick-quoted, but the...

Opengraph URL: https://github.com/phpmyadmin/sql-parser/pull/667

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:c07caca5-3899-d953-0015-4b7720ee6026
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEB50:8414A:E3B6FD:13E45D5:6B04422D
html-safe-nonce1d2f83b7e038a98109929fb200b0187c44fe74c2d5e54a7b32f386429044f017
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjUwOjg0MTRBOkUzQjZGRDoxM0U0NUQ1OjZCMDQ0MjJEIiwidmlzaXRvcl9pZCI6IjI5MTIyNzIyNTczNzY3NTMwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaccd249f403f26e716dd99e787912f65a24f3ba574d6110b149ad017e7bb0d8fe2
hovercard-subject-tagpull_request:4258866767
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/phpmyadmin/sql-parser/pull/667/files
twitter:imagehttps://avatars.githubusercontent.com/u/169331997?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/169331997?s=400&v=4
og:image:altFixes #662. Problem The WITH (CTE) parser rejects valid CTE names. MySQL accepts a non-reserved keyword (e.g. data, text) as an unquoted identifier, and any identifier when backtick-quoted, but the...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/phpmyadmin/sql-parser git https://github.com/phpmyadmin/sql-parser.git
octolytics-dimension-user_id1351977
octolytics-dimension-user_loginphpmyadmin
octolytics-dimension-repository_id36256604
octolytics-dimension-repository_nwophpmyadmin/sql-parser
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36256604
octolytics-dimension-repository_network_root_nwophpmyadmin/sql-parser
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release06dc448a76fe4751ac1db26524aefa3aa3e889a8
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/phpmyadmin/sql-parser/pull/667/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fphpmyadmin%2Fsql-parser%2Fpull%2F667%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fphpmyadmin%2Fsql-parser%2Fpull%2F667%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=phpmyadmin%2Fsql-parser
Reloadhttps://github.com/phpmyadmin/sql-parser/pull/667/files
Reloadhttps://github.com/phpmyadmin/sql-parser/pull/667/files
Reloadhttps://github.com/phpmyadmin/sql-parser/pull/667/files
phpmyadminhttps://github.com/phpmyadmin
sql-parserhttps://github.com/phpmyadmin/sql-parser
Codehttps://github.com/phpmyadmin/sql-parser
Issues55 (55)https://github.com/phpmyadmin/sql-parser/issues
Pull requests21 (21)https://github.com/phpmyadmin/sql-parser/pulls
Actionshttps://github.com/phpmyadmin/sql-parser/actions
Security and qualityhttps://github.com/phpmyadmin/sql-parser/security
Insightshttps://github.com/phpmyadmin/sql-parser/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fphpmyadmin%2Fsql-parser%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fphpmyadmin%2Fsql-parser%2Fissues%2Fnew%2Fchoose
youdie006https://github.com/youdie006
phpmyadmin:masterhttps://github.com/phpmyadmin/sql-parser/tree/master
youdie006:fix/662-cte-nonreserved-keyword-namehttps://github.com/youdie006/sql-parser/tree/fix/662-cte-nonreserved-keyword-name
Conversation 0 https://github.com/phpmyadmin/sql-parser/pull/667
Commits 1 https://github.com/phpmyadmin/sql-parser/pull/667/commits
Checks 0 https://github.com/phpmyadmin/sql-parser/pull/667/checks
Files changed https://github.com/phpmyadmin/sql-parser/pull/667/files
Please reload this pagehttps://github.com/phpmyadmin/sql-parser/pull/667/files
Accept non-reserved keyword and quoted CTE names (#662) https://github.com/phpmyadmin/sql-parser/pull/667/files#top
Show all changes 1 commit https://github.com/phpmyadmin/sql-parser/pull/667/files
5aec69a Accept non-reserved keyword and quoted CTE names youdie006 Aug 12, 2026 https://github.com/phpmyadmin/sql-parser/pull/667/commits/5aec69ae2e02eeb3af055d0b0d9345370423d96b
Clear filters https://github.com/phpmyadmin/sql-parser/pull/667/files
Please reload this pagehttps://github.com/phpmyadmin/sql-parser/pull/667/files
Please reload this pagehttps://github.com/phpmyadmin/sql-parser/pull/667/files
phpstan-baseline.neon https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-995edee38ad4f8387e58ebd52c31bcc04c56cc2448d331b1cf5e0b35c57b9efa
WithStatement.php https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0e3f9ddc7daa4fa1019a5cd35ed4207bd6e39dd7285b4c40d93f6a63fc0875eb
WithStatementTest.php https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0b78d3cff57f55e3494b49b2e3f84fb9d9d9c314dbe4f0df617fa9c4d9a4cbb4
phpstan-baseline.neonhttps://github.com/phpmyadmin/sql-parser/pull/667/files#diff-995edee38ad4f8387e58ebd52c31bcc04c56cc2448d331b1cf5e0b35c57b9efa
View file https://github.com/phpmyadmin/sql-parser/blob/5aec69ae2e02eeb3af055d0b0d9345370423d96b/phpstan-baseline.neon
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/phpmyadmin/sql-parser/pull/667/{{ revealButtonHref }}
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-995edee38ad4f8387e58ebd52c31bcc04c56cc2448d331b1cf5e0b35c57b9efa
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-995edee38ad4f8387e58ebd52c31bcc04c56cc2448d331b1cf5e0b35c57b9efa
src/Statements/WithStatement.phphttps://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0e3f9ddc7daa4fa1019a5cd35ed4207bd6e39dd7285b4c40d93f6a63fc0875eb
View file https://github.com/phpmyadmin/sql-parser/blob/5aec69ae2e02eeb3af055d0b0d9345370423d96b/src/Statements/WithStatement.php
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/phpmyadmin/sql-parser/pull/667/{{ revealButtonHref }}
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0e3f9ddc7daa4fa1019a5cd35ed4207bd6e39dd7285b4c40d93f6a63fc0875eb
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0e3f9ddc7daa4fa1019a5cd35ed4207bd6e39dd7285b4c40d93f6a63fc0875eb
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0e3f9ddc7daa4fa1019a5cd35ed4207bd6e39dd7285b4c40d93f6a63fc0875eb
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0e3f9ddc7daa4fa1019a5cd35ed4207bd6e39dd7285b4c40d93f6a63fc0875eb
tests/Parser/WithStatementTest.phphttps://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0b78d3cff57f55e3494b49b2e3f84fb9d9d9c314dbe4f0df617fa9c4d9a4cbb4
View file https://github.com/phpmyadmin/sql-parser/blob/5aec69ae2e02eeb3af055d0b0d9345370423d96b/tests/Parser/WithStatementTest.php
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/phpmyadmin/sql-parser/pull/667/{{ revealButtonHref }}
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0b78d3cff57f55e3494b49b2e3f84fb9d9d9c314dbe4f0df617fa9c4d9a4cbb4
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0b78d3cff57f55e3494b49b2e3f84fb9d9d9c314dbe4f0df617fa9c4d9a4cbb4
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0b78d3cff57f55e3494b49b2e3f84fb9d9d9c314dbe4f0df617fa9c4d9a4cbb4
https://github.com/phpmyadmin/sql-parser/pull/667/files#diff-0b78d3cff57f55e3494b49b2e3f84fb9d9d9c314dbe4f0df617fa9c4d9a4cbb4
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.