On Tuesday 29 November 2005 15:52, Leif B. Kristensen wrote:
>Uh-oh. That's my first 'gotcha' in PostgreSQL.
>
>I added the following constraints:

I probably should drop both the inheritance and the citation_id 
altogether, and operate with two separate tables:

CREATE TABLE relation_citations (
    relation_fk INTEGER REFERENCES relations (relation_id),
    source_fk INTEGER REFERENCES sources (source_id),
    CONSTRAINT PRIMARY KEY (relation_fk, source_fk)
);

CREATE TABLE event_citations (
    event_fk INTEGER REFERENCES events (event_id),
    source_fk INTEGER REFERENCES sources (source_id),
    CONSTRAINT PRIMARY KEY (event_fk, source_fk)
);

Is there an easy and non-disruptive way to do this?
-- 
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to