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

Support deparsing "CASE expr WHEN ... END" clause #78

Merged
merged 1 commit into from
Mar 31, 2018

Conversation

Papierkorb
Copy link
Contributor

@Papierkorb Papierkorb commented Mar 31, 2018

Hi,

I found another syntax case where deparse forgot to output something. It's the expression in CASE expr WHEN ... END, the docs call it "simple CASE":

§9.17.1 CASE

There is a “simple” form of CASE expression that is a variant of the general form above:

CASE expression
    WHEN value THEN result
    [WHEN ...]
    [ELSE result]
END

The first expression is computed, then compared to each of the value expressions in the WHEN clauses until one is found that is equal to it. If no match is found, the result of the ELSE clause (or a null value) is returned. This is similar to the switch statement in C.

I was rather confused why the AST I built didn't have the expression lul..

@lfittl lfittl merged commit a632a8a into pganalyze:master Mar 31, 2018
@lfittl
Copy link
Member

lfittl commented Mar 31, 2018

@Papierkorb Nice, thanks again!

@Papierkorb
Copy link
Contributor Author

Wow that was quick, thanks!

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

Successfully merging this pull request may close these issues.

2 participants