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

Formatter doesn't handle CASE expressions and statements #274

Open
MauricioFauth opened this issue Dec 15, 2019 · 0 comments
Open

Formatter doesn't handle CASE expressions and statements #274

MauricioFauth opened this issue Dec 15, 2019 · 0 comments
Labels

Comments

@MauricioFauth
Copy link
Member

Formatter doesn't handle CASE expressions and CASE statements.

Related to #272.

Examples:

CASE expression:

-- original
SELECT CASE 1
    WHEN 1 THEN
        'one'
    WHEN 2 THEN
        'two'
    ELSE
        'more'
END;

-- formatted
SELECT CASE
    1 WHEN 1 THEN 'one' WHEN 2 THEN 'two' ELSE 'more'
END;

CASE statement:

-- original
CREATE PROCEDURE p()
BEGIN
    DECLARE
        v INT DEFAULT 1;
    CASE v
        WHEN 2 THEN
            SELECT v;
        WHEN 3 THEN
            SELECT 0;
        ELSE
            BEGIN
            END;
    END CASE;
END;

-- formatted
CREATE PROCEDURE p()
BEGIN
    DECLARE
        v INT DEFAULT 1; CASE v WHEN 2 THEN
    SELECT
        v; WHEN 3 THEN
    SELECT
        0; ELSE
    BEGIN
        END
            ;
    END CASE;
END;
@williamdes williamdes added the bug label Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants