Received: from p1.selectacast.net (p1.selectacast.net [206.41.1.251]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBC1jim08525 for ; Mon, 11 Dec 2000 20:45:44 -0500 (EST) (envelope-from jks@selectacast.net) Received: from selectacast.net (IDENT:jks@d1 [209.219.91.66]) by p1.selectacast.net (8.9.3/8.9.3) with ESMTP id UAA11670; Mon, 11 Dec 2000 20:45:59 -0500 Message-ID: <3A358356.F5B41124@selectacast.net> Date: Mon, 11 Dec 2000 20:45:58 -0500 From: Joseph Shraibman Organization: Xtenit, Inc. http://www.xtenit.com X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.15 i686) X-Accept-Language: en MIME-Version: 1.0 To: Stephan Szabo CC: "pgsql-sql@postgresql.org" Subject: Re: FOREIGN KEY errors. References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200012/70 X-Sequence-Number: 401 Script to reproduce the problem. It drops the tables at the end of the script. Stephan Szabo wrote: > > There was a bug (which should be fixed for 7.1) that got the > arguments wrong for the alter time check of the existing data. > I think I should be able to get a patch together to fix it once > I get a copy of the 7.0.3 source. > > Can you send the table schema as well so I can test it out? > Script to reproduce the problem. It drops the tables at the end of the script. If data is not inserted into mtable there is no problem. ======================================================================================== create table utable ( uk int not null, pk int not null, thetext text, primary key (uk, pk) ); create table mtable( id serial not null primary key, mtext text, o int, /* corresponds to uk */ p int /* corresponds to pk */ ); insert into utable (uk,pk,thetext) values (2,4,'blah 2 4'); insert into utable (uk,pk,thetext) values (2,5,'blah 2 5'); insert into mtable (mtext,o,p) values ('m 2 4',2,4); alter table mtable add FOREIGN KEY (p,o) REFERENCES utable (pk,uk); drop sequence mtable_id_seq; drop table mtable; drop table utable; -- Joseph Shraibman jks@selectacast.net Increase signal to noise ratio. http://www.targabot.com