When creating functions, you can specify variables with SET name FROM CURRENT to get the value of the parameter that is current when CREATE FUNCTION is executed.
pg_format is unaware of this syntax and treats FROM as if it were FROM from a query.
CREATE FUNCTION name ()
RETURNS text
LANGUAGE plpgsql
SET search_path
FROM
current
AS $$
BEGIN
RETURN 'text';
END;
$$;
Expected output:
CREATE FUNCTION name ()
RETURNS text
LANGUAGE plpgsql
SET search_path FROM current
AS $$
BEGIN
RETURN 'text';
END;
$$;
I don't know enough perl to fix it, but by trial and error I found that line 2097 in Beautify.pm has something to do with inserting the line feed:
When creating functions, you can specify variables with
SET name FROM CURRENT
to get the value of the parameter that is current when CREATE FUNCTION is executed.pg_format is unaware of this syntax and treats FROM as if it were FROM from a query.
Expected output:
I don't know enough perl to fix it, but by trial and error I found that line 2097 in Beautify.pm has something to do with inserting the line feed: