You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can not handle cross-schema inheritance in postgres #4128
CREATESCHEMAschema_one;
CREATESCHEMAschema_two;
CREATETABLEschema_one.parent (
foo TEXT
);
CREATETABLEschema_two.child (
bar TEXT
) INHERITS (schema_one.parent);
command:
sqlc generate
output:
000001_some_migration.up.sql:1:1: relation "parent" does not exist
Looking at the PR which adds inheritance it seems like the problem is that the schema of the CREATE clause is used to fetched the inherited table. I.e. there is an assumption that the tables are in the same schema. Same is done in latest version; see this line.
Fix, I would assume, would be to get the schema for the table referred to in the INHERITS part. Then use inherited_schema.getTable(inheritTable).
Relevant log output
000001_some_migration.up.sql:1:1: relation "parent" does not exist
Database schema
CREATESCHEMAschema_one;
CREATESCHEMAschema_two;
CREATETABLEschema_one.parent (
foo TEXT
);
CREATETABLEschema_two.child (
bar TEXT
) INHERITS (schema_one.parent);
Activity
axlalmflower commentedon Oct 7, 2025
fix: #4129