Open crimean-celica opened 3 years ago
I have confirmed the issue against a PG 11 set-up. I appears that in PG 11, the definition of the pg_inherits
catalog was changed to include index inheritance (see https://www.postgresql.org/docs/11/catalog-pg-inherits.html and compare it to the docs/10 version). Our initial (and incomplete) support for partitioned tables was done (as I recall) for PG 10 and essentially nothing was done after that.
The problem starts with the query in the inhquery
function of table.py
. It now returns two extra rows in your case (the pkey or idx rows). This could be fixed by modifying that query by JOINing to pg_class ON inhrelid and adding a WHERE to restrict the result to relkind = 'r', e.g.,
SELECT inhrelid::regclass AS sub,
inhparent::regclass AS parent, inhseqno
FROM pg_inherits i JOIN pg_class c ON inhrelid = c.oid
WHERE relkind = 'r'
ORDER BY 1, 3
This does fix your immediate problem but I'm not sure if others will surface.
Steps to reproduce:
1.1 new database:
1.2. new table:
Here I can export schema with no errors.
1.3. primary key:
The same results I obtained when removed the primary key and added a regular index. I.e. right after:
I had no error but after:
I got:
I.e. seems, any index (including primary ley/unique constraints) leads to such issue. Thanks