sql-formatter-org / sql-formatter-org/sql-formatter

Error formatting MariaDB CASE STATEMENT

Open
#780 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug mysql/mariadb
Dominant language
TypeScript
Stars
2.9k
Forks
456
Avg merge
3d 4h
Merged PRs (30d)
3

Description

Describe your problem

This code is copied from the MariaDB documentation so there should be no syntax errors:

  CASE v
    WHEN 2 THEN SELECT v;
    WHEN 3 THEN SELECT 0;
    ELSE BEGIN END;
  END CASE;

An Unexpected Error Occurred
Parse error at token: SELECT at line 2 column 17 Unexpected RESERVED_SELECT token:

Which SQL dialect does this apply to?

MariaDB

Which SQL dialect is configured in your VSCode extension settings?

MariaDB

Version of the VSCode extension

4.1.1

I have tried to reproduce this issue on the demo page, and it
  • Reproduces

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides a reproducible MariaDB CASE statement; start by running it on the linked demo page and tracing the MariaDB dialect parser's handling of SELECT inside CASE branches. Done means the statement formats without a parse error and a regression check covers this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, sql, typescript
Domain
compilers, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.