Constraint documentation
Lætitia Avrot <laetitia.avrot@gmail.com>
From: Lætitia Avrot <laetitia.avrot@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2018-06-02T20:52:58Z
Lists: pgsql-hackers
Attachments
- check_constraint_accross_table_note_v1.patch (text/x-patch) patch v1
Hi, Patrick Francelle and I encountered this situation where there was a check constraint on a table using a function to enforce a constraint across two different tables. When using pg_dump to dump structure and data we found out we couldn't restore it because tables weren't dumped in the right order regarding that constraint. Then, we found out this thread https://www.postgresql.org/message-id/11619.1077803699%40sss.pgh.pa.us where Tom explained how "check constraint were not intended to handle cross-table checks" and how you should use a trigger instead. If you look at modeling databases books, you'll actually find someting similar. By looking at the constraint documentation page, we found out there was nothing about it. So we decided to write a first version of a patch. You will find it enclosed. Here are some informations about it : Project : postgresql Branch : master Applying, compilation and test : I applied it successfully. It compiles sucessfully and I tested it on my laptop Platform-specific : there shouldn't be any platform specific item Regression tests : regression tests are not available for documentation Documentation : We don't document documentation source code Performance impact : none Choices I made and why : I choose to include a trigger link to help users go to the accurate documentation section. I also choose to add it as a note so it's more visible (but I'm open minded on that matter) Adresses a todo item : no Please let me tell me know if I missed something. I'm waiting for feedbacks to improve that patch. Cheers, Lætitia -- *Think! Do you really need to print this email ? * *There is no Planet B.*
Commits
-
Clarify that cross-row constraints are unsupported
- 36d442a25a1a 12.0 landed