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

From Gavin Flower
Subject Re: *Proper* solution for 1..* relationship?
Date
Msg-id 5181780F.40703@archidevsys.co.nz
Whole thread Raw
In response to Re: *Proper* solution for 1..* relationship?  (Josh Kupershmidt <schmiddy@gmail.com>)
List pgsql-novice
On 02/05/13 03:37, Josh Kupershmidt wrote:
On Tue, Apr 30, 2013 at 7:56 AM, Wolfgang Keller <feliphil@gmx.net> wrote:
The most straightforward way I know to enforce this is to check
that at least one child exists in a DEFERRED trigger on the the
parent.  You still need to worry about concurrency issues.
Imho it's absurd that I have to do this ("worry about concurrency
issues") myself, how long - more than fourty years after the invention
of relational databases?
You're not the first one to wish for something like this, and the SQL
standard actually has the CREATE ASSERTION syntax which I believe
would be able cover your use-case. Unfortunately, almost no databases
support this feature :-(

Josh


Maybe we (see note 1) should implement this feature, presumably with a Government health warning on the likely performance impact? It might serve as a 'checklist' feature for marketing.

Notes:
1) "Who me paleface (see note 2)" said Tonto after the Lone Ranger had said "we are in danger!" when faced with a lot of warlike indians.

2) The Lone Ranger character was actually based on a very successful black lawman!!!


Cheers,
Gavin

pgsql-novice by date:

Previous
From: Josh Kupershmidt
Date:
Subject: Re: *Proper* solution for 1..* relationship?
Next
From: Wolfgang Keller
Date:
Subject: Re: *Proper* solution for 1..* relationship?