A have some problems with Yii and Postgres. I have the table, that has been inherited from another one. Parent table have the primary key, but child doesn
t have one. When I try generate CRUD for child table Yii reports that there are no primary key. Relations method doesnt work for this model too.
any ideas ??
p.s. sorry for my English!
I think that problem in this query:
SELECT conname, consrc, contype, indkey FROM (
CASE WHEN contype='f' THEN
'CHECK (' || consrc || ')'
END AS consrc,
conrelid AS relid,
NULL AS indkey
contype IN ('f', 'c')
CASE WHEN indisprimary THEN
AND EXISTS (
SELECT 1 FROM pg_catalog.pg_depend d JOIN pg_catalog.pg_constraint c
ON (d.refclassid = c.tableoid AND d.refobjid = c.oid)
WHERE d.classid = pc.tableoid AND d.objid = pc.oid AND d.deptype = 'i' AND c.contype IN ('u', 'p')
) AS sub
WHERE relid = (SELECT oid FROM pg_catalog.pg_class WHERE relname= :table
AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace
Not sure how to fix this for the moment…Could you create a ticket about this issue? If you find any solution, please let us know. Thanks.
Could you post both the tables ?
You need to create PK for your children table. It's described in PostgreSQL manual about inheritance. See caveats section.