Re: [SQL] Correct implementation of 1:n relationship with n>0?

2013-05-14 Thread Wolfgang Keller
> > The point is that I would have expected that problem to be solved > > within the past four decades since relational databases have been > > invented. Or at least in the past two decades since PostgreSQL has > > been developed. > > Then what about n>1, n>2, n>k where k an arbitrarily large posi

Re: [SQL] Correct implementation of 1:n relationship with n>0?

2013-04-30 Thread Wolfgang Keller
> (there is nothing wrong in getting your hands dirty with pl/pgsql btw) The point is that I would have expected that problem to be solved within the past four decades since relational databases have been invented. Or at least in the past two decades since PostgreSQL has been developed. >;-> Aft

Re: [SQL] Correct implementation of 1:n relationship with n>0?

2013-04-30 Thread Wolfgang Keller
> It hit me today that a 1:n relationship can't be implemented just by a > single foreign key constraint if n>0. I must have been sleeping very > deeply not to notice this. > > E.g. if there is a table "list" and another table "list_item" and the > relationship can be described as "every list has

[SQL] Correct implementation of 1:n relationship with n>0?

2013-04-30 Thread Wolfgang Keller
It hit me today that a 1:n relationship can't be implemented just by a single foreign key constraint if n>0. I must have been sleeping very deeply not to notice this. E.g. if there is a table "list" and another table "list_item" and the relationship can be described as "every list has at least one