pgschema
pgschema copied to clipboard
[Bug] "Role does not exist"
--script.sql
CREATE SCHEMA app;
ALTER SCHEMA app OWNER To user1;
pgschema plan --user user1 --db db --password ... --file script.sql fails with Error: failed to apply desired state: failed to apply schema SQL to temporary schema pgschema_tmp_20260103_180559_4d8f8276: ERROR: role "user1" does not exist (SQLSTATE 42704).
I suppose I didn't understand the context (schema, role) in which pgschema executes?
pgschema operates inside a schema, which means database level commands such as "CREATE SCHEMA xxx" is not supported https://www.pgschema.com/syntax/unsupported#database-level-commands.
Sure, thanks. I was using the result of pg_dump (all schemas), I'll use pgschema dump --schema app instead.