From: Trewern, Ben <Ben.Trewern@mowlem.com>
To: 'pgsql-general@postgresql.org' <pgsql-general@postgresql.org>
To: 'pgsql-docs@postgresql.org' <pgsql-docs@postgresql.org>
Subject: RE: [GENERAL] Re: ALTER DROP COLUMN
Date: Tue, 13 Feb 2001 09:34:59 -0000
Message-ID: <996802F75C3CD411B424001083FA445B05953C@CET_PONXX_FP001> (raw)
Is there any chance of adding a note about this to the docs? It does not
seem to be documented anywhere! Maybe a note in ALTER TABLE
(sql-altertable.htm) and changing the FAQ slightly to mention what happen to
triggers, views, constraints etc.
Regards
Ben
> -----Original Message-----
> From: Fred Yankowski [mailto:fred@ontosys.com]
> Sent: 12 February 2001 21:41
> Cc: pgsql-general@postgresql.org
> Subject: [GENERAL] Re: ALTER DROP COLUMN
>
>
> I just tried this recommended procedure with a little test. It copied
> over the Attribute and Type information and the primary key index, but
> left everything else behind: not-null constraints, defaults,
> references constraints, check constraints, sequence generated for
> 'serial' type -- to name a few.
>
> So how is this useful for anything beyond a toy database?
>
> This inability to drop a column makes it hard to follow an "extreme
> programming" style of development, where one designs only as much into
> the database schema as is needed at the moment (DTSTTCPW, YAGNI).
> When I do that I often find that I need to drop columns (in favor of
> other columns of different types) as I evolve the schema to support
> ever more complex applications. PostgreSQL makes this a bit harder
> than it needs to be.
>
> On Mon, Feb 12, 2001 at 12:34:20PM -0800, Brent R. Matzelle wrote:
> > I know it's a pain, but it isn't all that bad. Just rename your
> > table like so:
> >
> > ALTER TABLE <old_name> RENAME TO <another_name>
> >
>
> > Then re-create the old table without the deleted column(s):
> >
> > SELECT col1, col2, col4 INTO TABLE <old_name> FROM
> > <another_name>
> >
> > Then delete the old table:
> >
> > DROP TABLE <another_name>
>
> --
> Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312
> Principal Consultant www.OntoSys.com fax: +1.630.879.1370
> OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA
>
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-docs@postgresql.org
Cc: Ben.Trewern@mowlem.com, pgsql-general@postgresql.org
Subject: Re: [GENERAL] Re: ALTER DROP COLUMN
In-Reply-To: <996802F75C3CD411B424001083FA445B05953C@CET_PONXX_FP001>
References: <996802F75C3CD411B424001083FA445B05953C@CET_PONXX_FP001>
* 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