Skip to content

Library fails to parse function #1825

Open
@LucaCappelletti94

Description

@LucaCappelletti94

Attempting to parse a function such as the following, which in PostgreSQL works fine, currently fails with ParserError("Expected: ), found: INT")

CREATE OR REPLACE FUNCTION check_values_different(int1 INT, int2 INT) RETURNS BOOLEAN AS $$
BEGIN
    IF int1 <> int2 THEN
        RETURN TRUE;
    ELSE
        RETURN FALSE;
    END IF;
END;
$$ LANGUAGE plpgsql;

Surprisingly enough, the following instead works:

CREATE OR REPLACE FUNCTION check_strings_different(str1 VARCHAR, str2 VARCHAR) RETURNS BOOLEAN AS $$
BEGIN
    IF str1 <> str2 THEN
        RETURN TRUE;
    ELSE
        RETURN FALSE;
    END IF;
END;
$$ LANGUAGE plpgsql;

And even more weird, the following works, so it must be something regarding the name of the attribute int1 and int2 colliding with a type:

CREATE OR REPLACE FUNCTION check_values_different(a INT, b INT) RETURNS BOOLEAN AS $$
BEGIN
    IF a <> b THEN
        RETURN TRUE;
    ELSE
        RETURN FALSE;
    END IF;
END;
$$ LANGUAGE plpgsql;

I will try to fix this error in a PR soon.

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