pgschema
pgschema copied to clipboard
pgschema leaks temporary desired-state schema into GRANT/REVOKE ON FUNCTION for user-defined argument types
Full repro here https://github.com/pettijohn/pgschema-bug - run schema/apply.sh
Using v1.8.0
CREATE TYPE my_input AS (
id uuid
);
CREATE OR REPLACE FUNCTION f_test(p_items my_input[])
RETURNS integer
LANGUAGE sql
AS $$
SELECT COALESCE(array_length(p_items, 1), 0);
$$;
REVOKE ALL ON FUNCTION f_test(my_input[]) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION f_test(my_input[]) TO appname_apiuser;
Apply fails with ERROR: schema "pgschema_tmp_..." does not exist
Issue: generated output sql leaks temporary schema name in grant/revoke statements
REVOKE EXECUTE ON FUNCTION f_test(p_items pgschema_tmp_20260326_161823_31f3dbda.my_input[]) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION f_test(p_items pgschema_tmp_20260326_161823_31f3dbda.my_input[]) TO appname_apiuser;
Wow! This is the second bug I've filed on this project, and both fixed within 24 hours. Amazing. Thank you so much for this awesome project and your dedication to it.