Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 1DB199FA4C9 for ; Thu, 12 Oct 2006 11:39:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 79728-04 for ; Thu, 12 Oct 2006 14:39:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A9BBC9FA4C5 for ; Thu, 12 Oct 2006 11:39:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k9CEdAUa010300; Thu, 12 Oct 2006 10:39:10 -0400 (EDT) To: Joe cc: Bryce Nesbitt , pgsql-sql@postgresql.org Subject: Re: Is this a bug? Deleting a column deletes the constraint. In-reply-to: <1160645987.51367.13.camel@pampa> References: <452DCE97.2090706@obviously.com> <2323.1160630748@sss.pgh.pa.us> <1160645987.51367.13.camel@pampa> Comments: In-reply-to Joe message dated "Thu, 12 Oct 2006 05:39:47 -0400" Date: Thu, 12 Oct 2006 10:39:09 -0400 Message-ID: <10299.1160663949@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200610/117 X-Sequence-Number: 26506 Joe writes: > I didn't realize before that you can also drop all columns, leaving a > table without *any* columns. Is that a SQL92 "feature"? See the ALTER TABLE reference page: ALTER TABLE DROP COLUMN can be used to drop the only column of a table, leaving a zero-column table. This is an extension of SQL, which disallows zero-column tables. The CREATE TABLE reference page further amplifies: PostgreSQL allows a table of no columns to be created (for example, CREATE TABLE foo();). This is an extension from the SQL standard, which does not allow zero-column tables. Zero-column tables are not in themselves very useful, but disallowing them creates odd special cases for ALTER TABLE DROP COLUMN, so it seems cleaner to ignore this spec restriction. regards, tom lane