On Tue, Apr 30, 2013 at 7:56 AM, Wolfgang Keller <feliphil(at)gmx(dot)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