Thread: Problem with old relation

Problem with old relation

From
Rado Petrik
Date:
Hi, 

1) When I create new table expample.

CREATE TABLE "kokot" (
"kokot" SERIAL );


2) and then DROP table kokot ..

3) and then again CREATE table 

CREATE TABLE "kokot" (
"kokot" SERIAL );

PostgreSQL return this error 

PostgreSQL said: ERROR: Relation 'kokot_kokot_seq' already exists
Your query:
CREATE TABLE "kokot" (
"kokot" SERIAL );

Where is problem ?
Thanks 

Rado 
-- 
Rado Petrik <r.p@szm.sk>



Re: Problem with old relation

From
Andreas Schmitz
Date:
Hi,

you also have to drop the sequence.

drop sequence kokot_kokot_seq;


regards

-andreas



On Friday 02 May 2003 14:20, Rado Petrik wrote:
> Hi,
>
> 1) When I create new table expample.
>
> CREATE TABLE "kokot" (
> "kokot" SERIAL );
>
>
> 2) and then DROP table kokot ..
>
> 3) and then again CREATE table
>
> CREATE TABLE "kokot" (
> "kokot" SERIAL );
>
> PostgreSQL return this error
>
> PostgreSQL said: ERROR: Relation 'kokot_kokot_seq' already exists
> Your query:
> CREATE TABLE "kokot" (
> "kokot" SERIAL );
>
> Where is problem ?
> Thanks
>
> Rado

--
Andreas Schmitz - Phone +49 201 8501 318
Cityweb-Technik-Service-Gesellschaft mbH
Friedrichstr. 12 - Fax +49 201 8501 104
45128 Essen - email a.schmitz@cityweb.de



Re: Problem with old relation

From
"A.Bhuvaneswaran"
Date:
> PostgreSQL said: ERROR: Relation 'kokot_kokot_seq' already exists

In pre 7.3, you should drop the sequence as well. It is fixed in 7.3. Thus
in 7.3, if you drop a table its dependent objects like sequences, FKs are
dropped automatically.

regards,
bhuvaneswaran