ygrek / sqlgg

SQL Guided (code) Generator
https://ygrek.org/p/sqlgg/
GNU General Public License v2.0
62 stars 20 forks source link

Schema qualified function name fails to parse on Postgres #130

Closed serpent7776 closed 4 months ago

serpent7776 commented 7 months ago

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