pgschema
pgschema copied to clipboard
Plan step fails on functions with table row-type composite parameters
My pgschema plan fails when a function takes a table's row type as a parameter (PostgreSQL composite type). The temp-schema validation step cannot resolve the composite type because the referenced table doesn't exist in the temp schema at function parse time.
Reproduce
CREATE TABLE shared.example_table (
id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name varchar NOT NULL
);
CREATE FUNCTION shared.example_helper(p_row shared.example_table)
RETURNS jsonb LANGUAGE sql STABLE AS $$
SELECT jsonb_build_object('id', p_row.id, 'name', p_row.name);
$$;
Running pgschema plan --file schema/main.sql --db mydb --schema shared fails during validation with an error referencing the composite type.
pgschema should resolve composite row types from the target schema before validating function definitions in the temp schema.
Resolved in v1.9.0