pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ALTER CONSTRAINT FOREIGN KEY
2+ messages / 2 participants
[nested] [flat]

* ALTER CONSTRAINT FOREIGN KEY
@ 2002-03-07 21:53 Charles Hauser <chauser@acpub.duke.edu>
  2002-03-13 16:02 ` Re: ALTER CONSTRAINT FOREIGN KEY Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Charles Hauser @ 2002-03-07 21:53 UTC (permalink / raw)
  To: pgsql-sql

Question,


When I created a TABLE clone I initially defined a column:
gb_accessions_id INTEGER REFERENCES gb_accessions(gb_accessions_id) NULL


I have renamed TABLE gb_accessions to TABLE gb, and its column 
gb_accessions_id to gb_id.

I next renamed the column 'gb_accessions_id' in TABLE clone to 'gb_id'.
In renaming this column in TABLE clone I appear to have lost the 
reference to TABLE gb (see below).

Questions:

1. During which step in my renaming did this occur?
2. How should I have carried this out?
3. Can I add back REFERENCES gb(gb_id)?




Database chlamy_est - Table clone

Field	Type	LengthNot Null	Default
  clone_id 	int4 	4  Yes 	nextval('"clone_clone_id_seq"'::text)
  project 	int4 	4  Yes
  plate 	int4 	4  Yes
  row 	char 	1  Yes
  col 	int4 	4  Yes
  read 	char 	1  Yes
  ver 	int4 	4  Yes
  seq 	text  var  Yes
  qual 	text  var  Yes
  length 	int4 	4  Yes
  qual_length 	int4 	4  Yes
  mean_qual_after_trim 	int4 	4  Yes
  qual_start 	int4 	4  Yes
  qual_end 	int4 	4  Yes
  comment 	text  var  Yes
  gb_id 	int4 	4  No


Keyname	Unique	Primary	Field
clone_pkey	Yes	Yes	clone_id
clone_project_key	Yes	No	col
clone_project_key	Yes	No	plate
clone_project_key	Yes	No	project
clone_project_key	Yes	No	read
clone_project_key	Yes	No	row
clone_project_key	Yes	No	ver


Thanks.
-- 
Regards,

	Chuck



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ALTER CONSTRAINT FOREIGN KEY
  2002-03-07 21:53 ALTER CONSTRAINT FOREIGN KEY Charles Hauser <chauser@acpub.duke.edu>
@ 2002-03-13 16:02 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Stephan Szabo @ 2002-03-13 16:02 UTC (permalink / raw)
  To: Charles Hauser <chauser@acpub.duke.edu>; +Cc: pgsql-sql


On Thu, 7 Mar 2002, Charles Hauser wrote:

> When I created a TABLE clone I initially defined a column:
> gb_accessions_id INTEGER REFERENCES gb_accessions(gb_accessions_id) NULL
>
>
> I have renamed TABLE gb_accessions to TABLE gb, and its column
> gb_accessions_id to gb_id.
>
> I next renamed the column 'gb_accessions_id' in TABLE clone to 'gb_id'.
> In renaming this column in TABLE clone I appear to have lost the
> reference to TABLE gb (see below).
>
> Questions:
>
> 1. During which step in my renaming did this occur?

As soon as you renamed either the table or column the constraint got
broken.

> 2. How should I have carried this out?

Pretty much you need to kill the references constraint that was there.
This involes dropping the triggeres involved in the constraint (see
techdocs.postgresql.org for more details - they've got some writings
that will help)

> 3. Can I add back REFERENCES gb(gb_id)?
Yes, use alter table add constraint to add the constraint back.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-03-13 16:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-03-07 21:53 ALTER CONSTRAINT FOREIGN KEY Charles Hauser <chauser@acpub.duke.edu>
2002-03-13 16:02 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>

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