X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 433929DCF99 for ; Tue, 29 Nov 2005 12:01:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00600-07 for ; Tue, 29 Nov 2005 12:01:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail47.e.nsc.no (mail47.e.nsc.no [193.213.115.47]) by postgresql.org (Postfix) with ESMTP id 545919DCF98 for ; Tue, 29 Nov 2005 12:01:28 -0400 (AST) Received: from [192.168.0.57] (062016183238.customer.alfanett.no [62.16.183.238]) (authenticated bits=0) by mail47.nsc.no (8.13.5/8.13.5) with ESMTP id jATG1QDl027410 for ; Tue, 29 Nov 2005 17:01:27 +0100 (CET) From: "Leif B. Kristensen" To: pgsql-sql@postgresql.org Subject: Re: Strange bug Date: Tue, 29 Nov 2005 17:01:26 +0100 User-Agent: KMail/1.8.1 References: <200511291531.30441.leif@solumslekt.org> <6965.1133275062@sss.pgh.pa.us> <200511291552.53024.leif@solumslekt.org> In-Reply-To: <200511291552.53024.leif@solumslekt.org> X-Face: %iea8o"[SI'kMDS.`hz7lU=?\^lC9J-]CVjo; f{4-C:$?uVUEjyN~uYFn%*aH_c3d09U>=?utf-8?q?x=0A=09TXtaoj=7EMV=2E8PgG7hik9=3BcCT2N6+u?=@Y{wH\p3*_f~FH9k,Wi74e[_l%.7b^'zJ)8S'^G<(=?utf-8?q?=3D=0A=09zw8=5CPMC3=27=7BKl9=2EzL*ks!b6wA?=,c~'F`k&Vq|ELDGa|4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000, UPPERCASE_25_50=0] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/274 X-Sequence-Number: 23525 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