Skip to content
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

Postgresql parsing fail on function body: no viable alternative at input #436

Open
mermetbt opened this issue Sep 7, 2023 · 2 comments
Open

Comments

@mermetbt
Copy link

mermetbt commented Sep 7, 2023

Hello,

Thanks for this PR #416

I've noticed the parser is not working on function like this:

CREATE FUNCTION public.myfunction() RETURNS void
    LANGUAGE sql
    AS $$
        -- Do something
    $$;

with the output being:

Error: no viable alternative at input '$$\n\t-- Do something\n            $$;\n'

Regards.

@mermetbt
Copy link
Author

mermetbt commented Sep 7, 2023

As a workaround, I use this simple sed command to remove the functions from the sql dump sed '/CREATE FUNCTION/,/\$\$;/d' input.sql > output.sql

@NQPhuc
Copy link
Contributor

NQPhuc commented Sep 7, 2023

Hi mermetbt,

Thanks for the workaround. Indeed the new postgres grammar introduce in #416 even though more complete than our previous parser, it's still not perfect. We'll try to improve this in the future.

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

2 participants