Re: FOREIGN KEY errors.

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: FOREIGN KEY errors.
Date: 2000-12-12 01:45:58
Message-ID: 3A358356.F5B41124@selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)selectacast(dot)net
Increase signal to noise ratio. http://www.targabot.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Joseph Shraibman 2000-12-12 04:13:47 Re:
Previous Message Richard Huxton 2000-12-11 18:16:50 Re: Query optimisation