pganalyze / pg_query

Ruby extension to parse, deparse and normalize SQL queries using the PostgreSQL query parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail parse function creation DDLs with native function body

aight8 opened this issue · comments

Simple example:

create function example() returns int
return 13;

This is working since postgres 14 - see docs https://www.postgresql.org/docs/current/sql-createfunction.html

The same function written in a more SQL-conforming style, using argument names and an unquoted body:

CREATE FUNCTION add(a integer, b integer) RETURNS integer
    LANGUAGE SQL
    IMMUTABLE
    RETURNS NULL ON NULL INPUT
    RETURN a + b;