Skip to content

Library fails to parse function #1825

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

Open
LucaCappelletti94 opened this issue Apr 27, 2025 · 0 comments
Open

Library fails to parse function #1825

LucaCappelletti94 opened this issue Apr 27, 2025 · 0 comments

Comments

@LucaCappelletti94
Copy link
Contributor

LucaCappelletti94 commented Apr 27, 2025

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.

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

No branches or pull requests

1 participant