Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: foreign key integrity #9

Open
ghost opened this issue Aug 24, 2018 · 0 comments
Open

Feature Request: foreign key integrity #9

ghost opened this issue Aug 24, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Aug 24, 2018

Postgresql does not allow for foreign key constraints from a base table to some other table. See Caveats section in https://www.postgresql.org/docs/9.5/static/ddl-inherit.html

Scenario:

  • You have a parent table called persons with a primary key id. You have students and teachers tables that inherit from persons.

  • You have another table called orders and it has an attribute person_id.

  • You'd like to add a foreign_key constraint from persons.id to orders.id. Such that anytime you inserted a student or teacher record it would maintain this constraint. However postgresql will not allow this as the record must exist in the base class.

Request:

  • Optionally allow a way to maintain this foreign_key constaint at the application layer (MTI)

  • For instance, if you tried to insert an orders record and the person did exist in the persons table then MTI would throw a foreign constraint exception.

@ghost ghost changed the title Feature Request: referential integrity Feature Request: application level foreign key integrity Aug 24, 2018
@ghost ghost changed the title Feature Request: application level foreign key integrity Feature Request: foreign key integrity Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants