holistics/dbml

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

Opened this issue · 2 comments

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.

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 commented

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.