Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f1DDIAx75228 for ; Tue, 13 Feb 2001 08:18:10 -0500 (EST) (envelope-from pgsql-docs-owner@postgresql.org) Received: from xxx-bfhxx-ms001.mowlem.com (mail.bcmsjv.com [194.6.9.65] (may be forged)) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1D9Zkx54071 for ; Tue, 13 Feb 2001 04:35:46 -0500 (EST) (envelope-from Ben.Trewern@mowlem.com) Received: from xxx-bfhxx-ex002.mowlem.com (unverified) by xxx-bfhxx-ms001.mowlem.com (Content Technologies SMTPRS 4.1.2) with ESMTP id for ; Tue, 13 Feb 2001 09:39:55 +0000 Received: by XXX_BFHXX_EX002 with Internet Mail Service (5.5.2650.21) id ; Tue, 13 Feb 2001 09:35:33 -0000 Message-ID: <996802F75C3CD411B424001083FA445B05953C@CET_PONXX_FP001> From: "Trewern, Ben" To: "'pgsql-general@postgresql.org'" , "'pgsql-docs@postgresql.org'" Subject: RE: [GENERAL] Re: ALTER DROP COLUMN Date: Tue, 13 Feb 2001 09:34:59 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C095A0.4FA43E26" X-Archive-Number: 200102/75 X-Sequence-Number: 330 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C095A0.4FA43E26 Content-Type: text/plain; charset="iso-8859-1" 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 RENAME TO > > > > > Then re-create the old table without the deleted column(s): > > > > SELECT col1, col2, col4 INTO TABLE FROM > > > > > > Then delete the old table: > > > > DROP TABLE > > -- > 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 > ------_=_NextPart_001_01C095A0.4FA43E26 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [GENERAL] Re: ALTER DROP COLUMN

Is there any chance of adding a note about this to the do= cs?  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 litt= le test.  It copied
> over the Attribute and Type information and the pri= mary key index, but
> left everything else behind:  not-null constra= ints, defaults,
> references constraints, check constraints, sequence= generated for
> 'serial' type -- to name a few.
>
> So how is this useful for anything beyond a toy dat= abase?
>
> This inability to drop a column makes it hard to fo= llow an "extreme
> programming" style of development, where one d= esigns only as much into
> the database schema as is needed at the moment (DTS= TTCPW, YAGNI).
> When I do that I often find that I need to drop col= umns (in favor of
> other columns of different types) as I evolve the s= chema to support
> ever more complex applications.  PostgreSQL ma= kes 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 <ano= ther_name>
> >
>
> > Then re-create the old table without the delet= ed column(s):
> >
> > SELECT col1, col2, col4 INTO TABLE <old_nam= e> FROM
> > <another_name>
> >
> > Then delete the old table:
> >
> > DROP TABLE <another_name>
>
> --
> Fred Yankowski      &= nbsp;    fred@OntoSys.com      tel:= +1.630.879.1312
> Principal Consultant     www.On= toSys.com       fax: +1.630.879.1370
> OntoSys, Inc      &nb= sp;      38W242 Deerpath Rd, Batavia, IL 60510, US= A
>

------_=_NextPart_001_01C095A0.4FA43E26--