Re: rename a table - Mailing list pgsql-admin

From Thalis A. Kalfigopoulos
Subject Re: rename a table
Date
Msg-id Pine.LNX.4.21.0106221624320.27771-100000@aluminum.cs.pitt.edu
Whole thread Raw
In response to rename a table  (Kostis Mentzelos <mentzelos@ematic.com>)
List pgsql-admin
Only declare the attribute 'b' as serial the first time. From then on, whenever you recreate table DATA just declare: b
intdefault nextval('data_b_seq'::text) 

cheers,
thalis


On Thu, 21 Jun 2001, Kostis Mentzelos wrote:

> Hi all,
>
> I want to rename a table from DATA to 'unique' every month
> and then recreate table DATA. (a number of applications works
> with table DATA)
>
> DATA contains among the others a SERIAL field.
>
> create table DATA (a int, b serial,...);
>
> I tried ALTER TABLE DATA RENAME TO XXXX but
> when I recreate table DATA I get this error:
> relation 'data_b_seq' already exists.
>
> Is there any way to rename sequences?
> Is it better to create the new table, copy 1.000.000 to the new
> table and then delete them from DATA and then VACCUM the
> database?
>
> kostis.


pgsql-admin by date:

Previous
From: Dennis
Date:
Subject: Re: rename a table
Next
From: "Yasuo Ohgaki"
Date:
Subject: Re: List of DDL commands?