Primary key constraints

Поиск
Список
Период
Сортировка
Искать

Primary key constraints

От:
Kumar S <ps_postgres@yahoo.com>
Дата:
Hi group, 


I removed a table from db names experiment.
It has a primary key exp_id (experiment_exp_id_seq)

I renamed that table to study. I re-created experiment
table with all new column names.  exp_id
(experiment_exp_id_seq) remains the primary key for
this table. 

Now when I try to execute this table I get the
following error:

psql:/home/db/experiment.sql:10: ERROR:  relation
"experiment_exp_id_seq" already exists


How to remove this key from every where from the whole
db. 

Thank you. 

K


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

Re: Primary key constraints

От:
"Sean Davis" <sdavis2@mail.nih.gov>
Дата:
Kumar,

You can drop a sequence by doing:

drop sequence experiment_exp_id_seq;

See the documentation here:

http://www.postgresql.org/docs/8.0/static/sql-dropsequence.html

However, that should happen automatically if it was defined as a serial and 
you dropped the table, so I'm not sure what is going on.  If the drop 
sequence doesn't work, perhaps you could tell us what the table definition 
for experiment used to look like and what your table def for study now looks 
like.

Sean

----- Original Message ----- 
From: "Kumar S" 
To: 
Sent: Monday, March 07, 2005 5:27 PM
Subject: [NOVICE] Primary key constraints


> Hi group,
>
>
> I removed a table from db names experiment.
> It has a primary key exp_id (experiment_exp_id_seq)
>
> I renamed that table to study. I re-created experiment
> table with all new column names.  exp_id
> (experiment_exp_id_seq) remains the primary key for
> this table.
>
> Now when I try to execute this table I get the
> following error:
>
> psql:/home/db/experiment.sql:10: ERROR:  relation
> "experiment_exp_id_seq" already exists
>
>
> How to remove this key from every where from the whole
> db.
>
> Thank you.
>
> K
>
>
>
>
> __________________________________
> Celebrate Yahoo!'s 10th Birthday!
> Yahoo! Netrospective: 100 Moments of the Web
> http://birthday.yahoo.com/netrospective/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
> 


FAQ