Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gVPcO-00071o-HR for pgsql-general@arkaria.postgresql.org; Fri, 07 Dec 2018 23:33:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gVPcM-0003xh-Rn for pgsql-general@arkaria.postgresql.org; Fri, 07 Dec 2018 23:33:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gVPcL-0003xa-O8 for pgsql-general@lists.postgresql.org; Fri, 07 Dec 2018 23:33:10 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gVPcI-0004eI-9x for pgsql-general@lists.postgresql.org; Fri, 07 Dec 2018 23:33:09 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BCAF920E89; Fri, 7 Dec 2018 18:33:04 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 07 Dec 2018 18:33:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=K juqcWCw5hFqt4WsNcY3Fs4fBZArCNfXWRanuXIUY2k=; b=Dp85gEnjkSRiqCndm zxDlCarSp08yBgxq/U0+hiRpWkeL+CR32RtxNzWn8xdEhLYqRKgZaa0/bCtAvwdf t0jQdMqxAJphQ7KypsVaIGWEKUhEZacK3jj0c7CG9o/4sEtNPEo7g9nuPnkMeFaq ViB7lVA1uscXqTYS3M5nqEYXU1fx67LTXZuhgKXKWZIcNjrKKNOzOoAy8RQrojHF ZZXGzR4oxqBEyuc2sSgXCjnrDsDOyyMLhjA1oUMDEtl8tMXPoS49x4y6psjuysIs IQp/ON0OYS5P3jOV+JcC9gddPvz/NRGJt9FXinycrzUfZyHbbSEAP83UpAS8HgKx GEQtQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=KjuqcWCw5hFqt4WsNcY3Fs4fBZArCNfXWRanuXIUY 2k=; b=Vdd/VEKj+OBFgCbZnn5YNBAktNOKAXcfmxxCX0qgLgo+hO2fXBlrfaGt5 CmG5OA+TG3IaxpzJYJ97ZkE+7gR91LBpdzqF1ZiU9k/vEkDPRZcIBoP/GbNUMNlI c8hToN/ssvAqRJTjuwJMKpQUkvHWSqHkEMzRU9KHsYxX3hzJWEiOwyYP8nC3HjK3 LodHdHh1qUTDPhZPT88Cv1wOqYGmxVFFF49bzdJ+P1a/dv/Ll44b8dVjJ59Ct+69 0Pf3Px2wfB+9kHCdA8RXXBtBXAqNMkkuXKEqsGZgYIsvywooqUxBcKNRkw5NbE8Q OYidTaQ87ox5v8km3FKUUVX+ed1Ag== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudegtddgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkff gfgggjtgfgsehtkeertddtfeehnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceo rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpe hpohhsthhgrhgvshhqlhdrohhrghenucfkphepjedurddvuddvrddufeegrdefnecurfgr rhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrd gtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id 81EC1102ED; Fri, 7 Dec 2018 18:33:03 -0500 (EST) Subject: Re: syntax error with alter type To: Kevin Brannen , "pgsql-general@lists.postgresql.org" References: From: Adrian Klaver Message-ID: <60cd0448-2940-d9ac-3b52-3be8563f7b88@aklaver.com> Date: Fri, 7 Dec 2018 15:33:02 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/7/18 3:17 PM, Kevin Brannen wrote: > I’m running Pg 9.6.5 if it matters… > > I’m trying to drop a value from an ENUM (type) and it seems like I’m > following the fine manual yet I still get an error. For example: > > nms=# create type alphabet as enum ('a', 'b', 'c', 'd'); > > CREATE TYPE > > nms=# alter type alphabet drop attribute if exists 'c'; > > ERROR:  42601: syntax error at or near "'c'" > > LINE 1: alter type alphabet drop attribute if exists 'c'; > >                                                      ^ > > LOCATION:  scanner_yyerror, scan.l:1086 > > What am I doing wrong? The goal is to get rid of the ‘c’ value from the > enum. Yes, you can assume I’ve already removed of all the ‘c’ values in > the table where it’s used. https://www.postgresql.org/docs/10/datatype-enum.html "Although enum types are primarily intended for static sets of values, there is support for adding new values to an existing enum type, and for renaming values (see ALTER TYPE). Existing values cannot be removed from an enum type, nor can the sort ordering of such values be changed, short of dropping and re-creating the enum type. > > Or does that statement not do what I think it does and I have to do the > “create new type, change the table to use the new type, drop old type, > rename new type to old type” routine? > > 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. -- Adrian Klaver adrian.klaver@aklaver.com