Search Postgresql Archives

Re: changing the sequence for a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
     subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
     message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux