GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ELSE expressions terminate early when encountering an END token by SharpDerek · Pull Request #654 · phpmyadmin/sql-parser

Conversation

@SharpDerek

@SharpDerek SharpDerek commented Apr 22, 2026

Copy link
Copy Markdown

CASE statements with an ELSE returning a value with the "tablename.columnname" format fail due to encountering an END token and parsing it as if it were a column instead. This fixes the issue by checking to see if the current token is an END and breaks before column processing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SharpDerek SharpDerek mentioned this pull request Apr 23, 2026
CASE with alias is not properly parsed #588
Open
@codecov

codecov Bot commented Apr 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.30%. Comparing base (f440917) to head (70b388b).

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #654   +/-   ##
=========================================
  Coverage     96.30%   96.30%           
- Complexity     2254     2255    +1     
=========================================
  Files            90       90           
  Lines          4982     4982           
=========================================
  Hits           4798     4798           
  Misses          184      184           
Flag Coverage Δ
unit-8.2-ubuntu-latest 96.30% <100.00%> (ø)
unit-8.3-ubuntu-latest 96.30% <100.00%> (ø)
unit-8.4-ubuntu-latest 96.30% <100.00%> (ø)
unit-8.5-ubuntu-latest 96.30% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

williamdes
williamdes approved these changes Apr 25, 2026
View reviewed changes

@williamdes williamdes left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thank you for this fix. If possible please reset your branch to 5.11.x and cherry pick your work and force push.
It will allow us to have the fix on 5.11.x
Else just let me know and I will do it manually

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@williamdes

williamdes commented Apr 25, 2026

Copy link
Copy Markdown
Member

Also, please add test cases

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dsharp
ELSE expressions terminate early when encountering an END token
100f954
@SharpDerek
SharpDerek force-pushed the fix/588-case-with-alias-is-not-properly-parsed branch from 70b388b to 100f954 Compare May 7, 2026 22:47
@SharpDerek
SharpDerek changed the base branch from master to 5.11.x May 7, 2026 22:50
@SharpDerek

SharpDerek commented May 8, 2026

Copy link
Copy Markdown
Author

Also, please add test cases

Here's the most succinct test case I can provide:

SELECT
    CASE
        WHEN table_a.column_a = 'FOO'
        THEN table_b.column_a
        ELSE table_b.column_b
END AS foo

Output before change:

SELECT
    CASE foo
    ELSE table_b.column_b AS `END`
END

Output after change:

SELECT
    CASE WHEN table_a.column_a = 'FOO'
    THEN table_b.column_a
    ELSE table_b.column_b
END AS `foo`
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SharpDerek

SharpDerek commented May 8, 2026

Copy link
Copy Markdown
Author

If this gets merged into 5.11.x, would it be put into 6.0.0 as well? That is the version that we are currently running and can't really downpatch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SharpDerek

SharpDerek commented May 28, 2026

Copy link
Copy Markdown
Author

@williamdes Is there anything more you need from me on this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@williamdes williamdes williamdes approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@SharpDerek @williamdes
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.