Re: changing the sequence for a table - Mailing list pgsql-general

From Richard Huxton
Subject Re: changing the sequence for a table
Date
Msg-id 42B04BE0.3060604@archonet.com
Whole thread Raw
In response to changing the sequence for a table  (Cedric BRINER <work@infomaniak.ch>)
List pgsql-general
Cedric BRINER wrote:
>
> the idea is to drop the ``old_test'' table. But before doing this,
 > I'd like to alter the table ``test'' to use the sequence
 > ``test_id_seq'' instead of ``test_new_seq_id''?

ALTER TABLE new_table ALTER COLUMN my_column DROP DEFAULT;
ALTER TABLE new_table ALTER COLUMN my_column SET DEFAULT
(nextval('old_seq'));
DROP TABLE old_table;

Or something along those lines. See "ALTER TABLE" in the manuals for
details.
--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: David Siebert
Date:
Subject: vacuumdb suggestions?
Next
From: stig erikson
Date:
Subject: Re: postgresql rpms (7.4.2, 7.4.5, 7.4.8) for redhat 8.0