4 ms·
FKs and unique indexes are a solid win. Very excited for this!
by odammit 8y ago
FKs and unique indexes are a solid win. Very excited for this!
- pgaddict 8y agoKeep in mind there are limitations - the unique index / constraint has to include the partition keys, and foreign keys are possible in one direction only. This may be improved in the future, of course.
- arghwhat 8y agoWait, so you cannot have a FK reference to the partitioned master table? :(
- pgaddict 8y agoUnfortunately not in PG11, but not because we don't want it - it simply didn't get ready in time. https://github.com/postgres/postgres/commit/3de241dba86f3dd000434f70aebba725fb928032 https://github.com/postgres/postgres/commit/3de241dba86f3dd0... The relevant limitation is described by CREATE TABLE docs that say Partitioned tables do not support <literal>EXCLUDE</literal> constraints however, you can define these constraints on individual partitions. Also, while it's possible to define <literal>PRIMARY KEY</literal> constraints on partitioned tables, creating foreign keys that reference a partitioned table is not yet supported. (the wording is slightly broken in the commit, but got fixed later).
- odammit 8y agoYou've really got me on an emotional rollercoaster here. :D