Re: *Proper* solution for 1..* relationship? - Mailing list pgsql-novice

From Wolfgang Keller
Subject Re: *Proper* solution for 1..* relationship?
Date
Msg-id 20130429184304.1862af6c16d511b2e73f8bb5@gmx.net
Whole thread Raw
In response to Re: *Proper* solution for 1..* relationship?  (Richard Broersma <richard.broersma@gmail.com>)
List pgsql-novice
> If you want to enforce a 1 to N relationship, You can use a CONSTRAINT
> TRIGGER on the List table to ensure that there is at least one list
> item - if there isn't then raise an exception 'No List Items!!!'.
> You'd want to define the constraint as INITIALLY DEFERRED.
> http://www.postgresql.org/docs/9.2/interactive/sql-createtrigger.html
> http://www.postgresql.org/docs/9.2/interactive/sql-set-constraints.html
>
> A constraint trigger is the closest feature to an ASSERTION statement
> defined by the SQL standard.

Thanks, but the main issue for me is the precise definition of the
constraint to apply.

This issue should be as old as relational databases per se. I just can't
imagine no one has implemented a well-proven "standard" solution yet.

Sincerely,

Wolfgang


pgsql-novice by date:

Previous
From: Richard Broersma
Date:
Subject: Re: *Proper* solution for 1..* relationship?
Next
From: Kevin Grittner
Date:
Subject: Re: *Proper* solution for 1..* relationship?