mammoth icon indicating copy to clipboard operation
mammoth copied to clipboard

CASE statements don't include the `CASE` and `END` keywords

Open young-mmfm opened this issue 2 years ago • 0 comments

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.

young-mmfm avatar Mar 10 '23 00:03 young-mmfm