Re: [ADMIN] Casting bytea to varchar

2013-01-15 Thread Albe Laurenz
Tom Lane wrote: >> 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(v

Re: [ADMIN] Casting bytea to varchar

2013-01-15 Thread Tom Lane
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);

Re: [ADMIN] Casting bytea to varchar

2013-01-15 Thread Albe Laurenz
Jayashree Rajagopalan wrote: > I've to alter a column which is of datatype bytea to varchar(255). > > I used this: > ALTER TABLE tablename ALTER COLUMN columname TYPE varchar(255); > > But I'm really not sure, if the value is casted properly. > Is there a way to explicity to cast the value, while

[ADMIN] Casting bytea to varchar

2013-01-14 Thread Rajagopalan, Jayashree
Hi: I'm relatively new to postgres: I've to alter a column which is of datatype bytea to varchar(255). I used this: ALTER TABLE tablename ALTER COLUMN columname TYPE varchar(255); But I'm really not sure, if the value is casted properly. Is there a way to explicity to cast the value, while alte