pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joseph Shraibman <jks@selectacast.net>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: FOREIGN KEY errors.
Date: Mon, 11 Dec 2000 20:45:58 -0500
Message-ID: <3A358356.F5B41124@selectacast.net> (raw)
References: <Pine.BSF.4.21.0012080920580.9083-100000@megazone23.bigpanda.com>

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



view thread (3+ messages)

Message-ID: <3A358356.F5B41124@selectacast.net>
Permalink:  ../3A358356.F5B41124@selectacast.net/
Also on:    postgresql.org/message-id/3A358356.F5B41124@selectacast.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jks@selectacast.net, sszabo@megazone23.bigpanda.com
  Subject: Re: FOREIGN KEY errors.
  In-Reply-To: <3A358356.F5B41124@selectacast.net>
  References: <Pine.BSF.4.21.0012080920580.9083-100000@megazone23.bigpanda.com> <3A358356.F5B41124@selectacast.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox