Skip to content

Possible bug in deparse IS DISTINCT FROM #62

@benny-medflyt

Description

@benny-medflyt

I haven't confirmed this yet, but from looking at the code there may be a problem with IS DISTINCT FROM

Here is an example query:

SELECT (1 IS NOT NULL) IS DISTINCT FROM (2 IS NOT NULL);

It looks like the deparser is missing parenthesis:

https://github.com/pyramation/pgsql-parser/blob/dae375591a9a48ee61ec7a8209362b22b4a645db/packages/deparser/src/deparser.js#L389

Because if this is deparsed to

SELECT 1 IS NOT NULL IS DISTINCT FROM 2 IS NOT NULL;

Then we get a syntax error:

[42601] ERROR: syntax error at or near "IS"
Position: 41

I don't have time to test this now, so I could be wrong, but I am opening this issue so I don't forget.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions