pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Albe Laurenz <laurenz.albe@wien.gv.at>
Cc: Rajagopalan, Jayashree *EXTERN* <Jayashree.Rajagopalan@emc.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: Casting bytea to varchar
Date: Tue, 15 Jan 2013 10:40:00 -0500
Message-ID: <25980.1358264400@sss.pgh.pa.us> (raw)
In-Reply-To: <A737B7A37273E048B164557ADEF4A58B0579988C@ntex2010a.host.magwien.gv.at>
References: <672B315321EBEC4CA4B5627D112E0896067F86D01E@MX25A.corp.emc.com>
	<A737B7A37273E048B164557ADEF4A58B0579988C@ntex2010a.host.magwien.gv.at>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

Albe Laurenz <laurenz.albe@wien.gv.at> 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



view thread (4+ messages)  latest in thread

Message-ID: <25980.1358264400@sss.pgh.pa.us>
Permalink:  ../25980.1358264400@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25980.1358264400@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, laurenz.albe@wien.gv.at, Jayashree.Rajagopalan@emc.com
  Subject: Re: Casting bytea to varchar
  In-Reply-To: <25980.1358264400@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox