Skip site navigation (1) Skip section navigation (2)

Re: rename a table

From: Dennis <dennis(at)zserve(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: rename a table
Date: 2001-06-21 19:28:40
Message-ID: 9gtht8$kjq$1@news.tht.net (view raw or flat)
Thread:
Lists: pgsql-admin
// first simply
drop sequence data_b_seq;

// then create the table as you would. before.

-Dennis

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.
> 
> ---------------------------------------------------------------
> Why do I need to do such a thing?
> I think that I need to do this because I have 1.000.000
> tuples/month and I don't want to work into a very big table.
> So 'I said' I have to find a way to move table DATA to something
> else and then recreate table DATA. This way I am going to
> work into a table of maximum 1.000.000 tuples at the end of
> the month.
> 


In response to

Responses

pgsql-admin by date

Next:From: Bruce MomjianDate: 2001-06-21 22:23:58
Subject: Re: [ADMIN] High memory usage [PATCH]
Previous:From: Volkmar WienersDate: 2001-06-21 17:45:41
Subject: Lost oid restoring dump with blobs

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group