Re: Is this a bug? Deleting a column deletes the constraint.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe <dev(at)freedomcircle(dot)net>
Cc: Bryce Nesbitt <bryce1(at)obviously(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Is this a bug? Deleting a column deletes the constraint.
Date: 2006-10-12 14:39:09
Message-ID: 10299.1160663949@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Joe <dev(at)freedomcircle(dot)net> 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Browne 2006-10-12 14:56:14 Re: Is this a bug? Deleting a column deletes the constraint.
Previous Message Joe 2006-10-12 09:39:47 Re: Is this a bug? Deleting a column deletes the constraint.