create parent after children

From: carlos(dot)ohiggins(at)yahoo(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: create parent after children
Date: 2008-10-15 16:40:58
Message-ID: f7e4b018-04c3-48c4-bf80-b1d0d8099f12@e17g2000hsg.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Guys,
I need to create a postgres 7.3 (done that, its bundled with an app I
have to extend).
Now I need to create 2 tables one a table of events. usual mix of
column types, with varchar as primary key.

However when I get 3 events in with specific characteristics I need
to create a summary event saying " 3 events of type X received).

So I need I guess to create a foreign key in the table with the 3
events in, pointing to the primary key in the summary event table.
But normally the parent is created 1st then the children - so I am
confused now about what constraints to put where so i can ensure
things make sense.
any help appreciated..

Carlos

Browse pgsql-general by date

  From Date Subject
Next Message Bill Thoen 2008-10-15 16:42:49 UPDATE and Indexes and Performance
Previous Message Tom Lane 2008-10-15 16:17:35 Re: Column level triggers