Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv8cP-0004Dz-UT for pgsql-admin@arkaria.postgresql.org; Tue, 15 Jan 2013 15:40:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tv8cP-0003PK-AM for pgsql-admin@arkaria.postgresql.org; Tue, 15 Jan 2013 15:40:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv8cO-0003OK-MN for pgsql-admin@postgresql.org; Tue, 15 Jan 2013 15:40:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv8cM-0003ZH-W3 for pgsql-admin@postgresql.org; Tue, 15 Jan 2013 15:40:04 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r0FFe0td025981; Tue, 15 Jan 2013 10:40:00 -0500 (EST) From: Tom Lane To: Albe Laurenz cc: "Rajagopalan, Jayashree *EXTERN*" , "pgsql-admin@postgresql.org" Subject: Re: Casting bytea to varchar In-reply-to: References: <672B315321EBEC4CA4B5627D112E0896067F86D01E@MX25A.corp.emc.com> Comments: In-reply-to Albe Laurenz message dated "Tue, 15 Jan 2013 08:42:32 +0000" Date: Tue, 15 Jan 2013 10:40:00 -0500 Message-ID: <25980.1358264400@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Albe Laurenz writes: > You cannot specify a conversion function while altering > a column's type, you'd have to use a new column like this: Sure you can; that's the whole point of the USING option. It'd look something like ALTER TABLE test ALTER COLUMN val TYPE varchar(255) USING convert(val); with whatever is appropriate in place of convert(). But the real question of course is what is "appropriate" for the OP's situation --- he didn't specify exactly what he's got in his bytea column or how that should be converted to varchar. regards, tom lane -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin