RE: syntax error with alter type

From: Kevin Brannen <KBrannen(at)efji(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RE: syntax error with alter type
Date: 2018-12-10 17:58:34
Message-ID: SN1PR19MB025583E85003B244A10C80F9A4A50@SN1PR19MB0255.namprd19.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:

> Kevin Brannen <KBrannen(at)efji(dot)com> writes:
> > So, can you (or anyone) help me understand what "alter type <type> drop attribute" is meant to do? I don't see "attribute" on the page you reference.

> IIRC, that drops a column from a composite type; it's more or less a variant spelling of ALTER TABLE DROP COLUMN.

I'm going to guess this is part of the "SQL Standard", but I'd like to comment that this seems really ... weird. All languages have their warts or things they could have done better in hind sight, but this strikes me as very weird.

That being said, I can sort of see why you say that. Looking at the examples, I can see:

ALTER TYPE compfoo ADD ATTRIBUTE f3 int;

which looks a lot like adding a column to a table. It would have been nice to know what "compfoo" is as that would have cleared up some confusion. I guess I'll make a doc change request.

Of course, the real answer is that someone here in the past should have made a small table of reference values instead of creating an ENUM, then I wouldn't be facing this. Again, hind sight...sigh.

Thanks,
Kevin
This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential information. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, distribution, review, copy or use of any of the information contained in or attached to this message is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify us by reply e-mail, and destroy the original transmission and its attachments without reading them or saving them to disk. Thank you.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2018-12-10 19:24:43 pg_stat_replication view
Previous Message Tom Lane 2018-12-10 17:33:13 Re: pg_restore fails due to foreign key violation