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 — CASE with alias is not properly parsed · Issue #588 · phpmyadmin/sql-parser

CASE with alias is not properly parsed #588

New issue
Copy link
New issue
Copy link
Open
Bug
Open
CASE with alias is not properly parsed#588
Bug
Copy link
Labels
bug

Description

@ghost
ghost
opened on Oct 2, 2024

Feeding this SQL to the Parser:

SELECT
  CASE 
    WHEN a.kol = 1 THEN 'one'
    ELSE a.kol
  END as 'case'
FROM foo a;

will result in errors, and calling build() on the statement will result in this SQL:

SELECT CASE 'case' ELSE a.kol AS `END` END FROM foo AS `a`

The errors array contains these errors:

  • An alias was previously found.
  • An alias was expected.
  • Unexpected keyword.
  • Unexpected end of CASE expression

I encountered this problem since I upgraded from 5.8.2 to 5.9.1.

Activity

  1. williamdes
    added
    bug
    on Dec 21, 2024
  2. williamdes commented on Dec 21, 2024

    @williamdes
    williamdes
    on Dec 21, 2024
    Member
    More actions

    Thank you for reporting this bug

    Still confirmed today on 5.2.2-dev

  3. SharpDerek commented on Apr 22, 2026

    @SharpDerek
    SharpDerek
    on Apr 22, 2026
    More actions

    Can confirm that this bug is still happening in 6.0.0.

    I made a pull request with my attempt to fix it

    Reacted by William Desportes
  4. lindaoling commented on Oct 16, 2026

    @lindaoling
    lindaoling
    on Oct 16, 2026
    More actions

    Friendly ping on this issue.

    I can confirm that the same problem is still reproducible on phpmyadmin/sql-parser 6.0.1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    Bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.