mammoth
mammoth copied to clipboard
CASE statements don't include the `CASE` and `END` keywords
Mammoth seems to omit the CASE and END keywords: https://github.com/Ff00ff/mammoth/blob/8122afe43425c135a1dd8f0cd22606fb0e0a994d/workspaces/mammoth/src/tests/select.test.ts#L893
When I run the query
"SELECT foo.id, (WHEN foo.value > $1 THEN $2 ELSE $3) greatness FROM foo"
Postgres returns:
ERROR: syntax error at or near "WHEN"
When I run the query
"SELECT foo.id, (CASE WHEN foo.value > $1 THEN $2 ELSE $3 END) greatness FROM foo"
Postgres runs the query correctly.