Hi group!
In the course of trying to create a cleanly formated posting that would
make my problem understandable I have eventually solved it myself. :)
I now post the solution instead, maybe it is of interest to someone. :)
Here is a showcase how to avoid to the "highlander-problem".
Imagine a
RETURN was missing in the AFTER triggers. here is the corrected version:
- begin of code
CREATE TABLE mankind
(
man_id integer primary key,
people_id integer NOT NULL, -- references table people ..,
but that's irrelevant here ..
king boolean NOT NULL DEFAULT false
);
On
On Jun 2, 2:43 am, [EMAIL PROTECTED] (Erwin Brandstetter) wrote:
> raise warning '%', kings;
And remove this line of debug code.
/Erwin
---(end of broadcast)---
TIP 6: explain analyze is your friend
Erwin Brandstetter wrote:
CREATE TABLE mankind
(
man_id integer primary key,
people_id integer NOT NULL, -- references table people .., but
that's irrelevant here ..
king boolean NOT NULL DEFAULT false
);
The trouble with this is that it models "kingship" as an attribute of eve
Hi Lew!
Thank you for your comments. I have elaborated on them.
On Jun 3, 7:22 pm, Lew <[EMAIL PROTECTED]> wrote:
(...)
> The trouble with this is that it models "kingship" as an attribute of every
> man. (What, no female rulers allowed?)
Yeah, saddening, isn't it? Actually, for simplicity's sa
"Erwin Brandstetter" <[EMAIL PROTECTED]> writes:
> I postulate further that a king only be king of his own people (rules out
> multiple kingships, too).
That's not how it's worked in the past :)
If you have a nation table wouldn't you just have a king_id column in that
table which is a foreign
On Jun 5, 8:35 am, [EMAIL PROTECTED] (Gregory Stark) wrote:
> "Erwin Brandstetter" <[EMAIL PROTECTED]> writes:
> > I postulate further that a king only be king of his own people (rules out
> > multiple kingships, too).
>
> That's not how it's worked in the past :)
Yeah i know. :) That's why I had
On Jun 5, 5:10 am, Lew <[EMAIL PROTECTED]> wrote:
> Erwin Brandstetter wrote:
> > CREATE TABLE king
> > (
> >king_id INTEGER PRIMARY KEY REFERENCES man (man_id) ON UPDATE
> > CASCADE ON DELETE CASCADE,
> >nation_id INTEGER UNIQUE,
> >FOREIGN KEY (man_id, nation_id) REFERENCES man (man_i
Oh my, it took me a ton of text to finally come up with a better idea.
5.) The Sun King solution
"L'etat c'est moi!". The model is as simple as can be:
CREATE TABLE nation
(
nation_id SERIAL PRIMARY KEY
);
CREATE TABLE man
(
man_id SERIAL PRIMARY KEY,
nation_id INTEGER NOT NULL REFERENCE