Re: dropping sequences - Mailing list pgsql-general

From Erik Price
Subject Re: dropping sequences
Date
Msg-id 3EF3073D.2030007@ptc.com
Whole thread Raw
In response to Re: dropping sequences  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general

scott.marlowe wrote:

> If they are in the same cluster (i.e. running on the same machine under
> the same postmaster) you can use this:
>
> CREATE DATABASE newdb with template olddb;

Great, and can I assume that when I issue "CREATE DATABASE;" this same
command is executed but, implicitly, "with template template0" added?  I
read in the docs that "template0" is the "default" database type unless
overidden.

> The easiest way to do this is to
>
> alter table yourtablehere alter column colwithseq drop default;
>
> which will disconnect the sequence from the table.  Note that the you can
> do it the other way too.

Okay, so the "DEFAULT" of a table is an item that can be dropped,
independently of the table itself, within an ALTER COLUMN statement.  I
didn't know that.

Thanks Scott.


Erik


pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: JDBC in PostgreSql for Linux
Next
From: Doug McNaught
Date:
Subject: Re: dropping sequences