Am Do., 12. Juli 2018 um 09:56 Uhr schrieb <[email protected]>: > The actual isse was that the derived table records would not implement > UpdateableRecord and thus could not be used as the type in a class derived > from DaoImpl. >
Oh, I see now. Well, the problem is, the primary key is a lie :-) Check this out: CREATE TABLE a ( id int CONSTRAINT pk_a PRIMARY KEY (id) ); CREATE TABLE b ( x text ) INHERITS (a); INSERT INTO a (id) VALUES (1); INSERT INTO a (id) VALUES (1); -- Constraint violation INSERT INTO x.b (id) VALUES (1); -- No constraint violation! SELECT * FROM x.a; -- You get two times the value 1, despite the constraint SELECT * FROM ONLY x.a; -- Aha, that's how the constraint is validated This is documented here: https://www.postgresql.org/docs/current/static/ddl-inherit.html *Other types of constraints (unique, primary key, and foreign key > constraints) are not inherited.* I haven't checked how a constraint can be enforced on the entire type hierarchy, but given how obscure this feature is, I generally recommend not using it (both in PostgreSQL and Oracle). The only historic use-case I've seen for table inheritance was partitioning, which has recently been supported natively in PostgreSQL as well (just like in Oracle). After all, just like in OO, composition beats inheritance in most cases :-) -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
