pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kostis Mentzelos <mentzelos@ematic.com>
To: pgsql-admin@postgresql.org
Subject: rename a table
Date: Thu, 21 Jun 2001 11:07:35 +0300
Message-ID: <3B31AB47.2A46172B@ematic.com> (raw)

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.



view thread (6+ messages)  latest in thread

Message-ID: <3B31AB47.2A46172B@ematic.com>
Permalink:  ../3B31AB47.2A46172B@ematic.com/
Also on:    postgresql.org/message-id/3B31AB47.2A46172B@ematic.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mentzelos@ematic.com
  Subject: Re: rename a table
  In-Reply-To: <3B31AB47.2A46172B@ematic.com>
  References: <3B31AB47.2A46172B@ematic.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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