Re: dropping sequences

From: Erik Price <eprice(at)ptc(dot)com>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: dropping sequences
Date: 2003-06-20 13:08:13
Message-ID: 3EF3073D.2030007@ptc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2003-06-20 13:11:05 Re: dropping sequences
Previous Message Thomas Kellerer 2003-06-20 11:47:29 Re: JDBC in PostgreSql for Linux