Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error formatting MariaDB CASE STATEMENT #780

Open
Ebola-Chan-bot opened this issue Sep 16, 2024 · 4 comments
Open

Error formatting MariaDB CASE STATEMENT #780

Ebola-Chan-bot opened this issue Sep 16, 2024 · 4 comments

Comments

@Ebola-Chan-bot
Copy link

Ebola-Chan-bot commented Sep 16, 2024

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
@Ebola-Chan-bot Ebola-Chan-bot added the vscode Related to the VSCode Extension label Sep 16, 2024
@nene
Copy link
Collaborator

nene commented Sep 16, 2024

Thanks for reporting. Unfortunately the support of procedural SQL in SQL Formatter is pretty weak.

The specific problem happens because it really only understand the SQL CASE expression, but has next to no support for CASE statement.

Fixing this is more akin to feature development and I've mostly stopped doing new feature development on SQL Formatter.

I might suggest you instead give a try to prettier-plugin-sql-cst which has better MariaDB/MySQL support, including support for the above CASE statement.

@nene nene removed the vscode Related to the VSCode Extension label Sep 16, 2024
@nene nene changed the title [VSCode]: Unable to format MariaDB CASE STATEMENT Error formatting MariaDB CASE STATEMENT Sep 16, 2024
@Ebola-Chan-bot
Copy link
Author

Thanks for reporting. Unfortunately the support of procedural SQL in SQL Formatter is pretty weak.

The specific problem happens because it really only understand the SQL CASE expression, but has next to no support for CASE statement.

Fixing this is more akin to feature development and I've mostly stopped doing new feature development on SQL Formatter.

I might suggest you instead give a try to prettier-plugin-sql-cst which has better MariaDB/MySQL support, including support for the above CASE statement.

I can't identify whether the prettier-plugin-sql-cst you provide can be used for in VSCode?

@nene
Copy link
Collaborator

nene commented Sep 18, 2024

You can use it through the VSCode Prettier extension as it's just a plugin for Prettier.

@Ebola-Chan-bot
Copy link
Author

Ebola-Chan-bot commented Sep 19, 2024

Fine. CREATE PROCEDURE and UNSIGNED is also not supported. 😭

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

No branches or pull requests

2 participants