sqlgg icon indicating copy to clipboard operation
sqlgg copied to clipboard

Schema qualified function name fails to parse on Postgres

Open serpent7776 opened this issue 1 year ago • 0 comments

In Postgres function created by CREATE FUNCTION can be schema qualified. sqlgg doesn't support that and fails to parse such statement. CREATE PROCEDURE can also be schema qualified.

https://www.postgresql.org/docs/current/sql-createfunction.html

CREATE OR REPLACE FUNCTION ns.add(i INT, j INT) RETURNS INT AS $$
BEGIN
    RETURN i + j;
END;
$$ LANGUAGE plpgsql;

SELECT ns.add(2);

The error I get:

==> CREATE OR REPLACE FUNCTION ns.add(i INT, j INT) RETURNS INT AS $$
BEGIN
    RETURN i + j;
END;
$$ LANGUAGE plpgsql
Position 1:30 Tokens: .add(i INT, j INT) RETURNS INT AS
Error: Sqlgg.Sql_parser.MenhirBasics.Error
==> SELECT ns.add(2)
Position 1:13 Tokens: add(2)
Error: Sqlgg.Sql_parser.MenhirBasics.Error
Errors encountered, no code generated

serpent7776 avatar Mar 28 '24 16:03 serpent7776