Hacker News new | ask | show | jobs
by dotborg2 5082 days ago
table inheritance is cool, but it's also incomplete, docs are pretty clear on that
1 comments

Yeah, I want inherited unique constraints for things which are guaranteed unique in an inheritance tree.

However, there are ways around this. You can, for example, use a composite key with the something related to the specific table in it.

For example our note table (an abstract class if you will) has a note_class field which is set to different default values and with different check constraints on the child tables.

Also foreign keys are a bit of an annoyance in an inherited table environment.