Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[SQL] Handle untype-cast string as VARCHAR instead of TEXT

1 view
Skip to first unread message

gmb

unread,
May 17, 2016, 8:59:16 AM5/17/16
to
Hi all

I'm dealing with a system where string values is queried but not necessary
type-cast.
E.g.
SELECT case when some_value=1 then 'some string' else 'another string' end
FROM some_table;
This will return a column cast as type TEXT;

Is there some configuration option (or hack?) available which will return
above as VARCHAR ?

I'm using 3rd party software where a VARCHAR value displays much better than
TEXT.
I know best practice will be to type-cast , but I'm hoping for a quick-fix
here :)

Regards




--
View this message in context: http://postgresql.nabble.com/Handle-untype-cast-string-as-VARCHAR-instead-of-TEXT-tp5903959.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


--
Sent via pgsql-sql mailing list (pgsq...@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

David G. Johnston

unread,
May 17, 2016, 9:19:56 AM5/17/16
to
On Tue, May 17, 2016 at 8:58 AM, gmb <gmbo...@gmail.com> wrote:
Hi all

I'm dealing with a system where string values is queried but not necessary
type-cast.
E.g.
SELECT case when some_value=1 then 'some string' else 'another string' end
FROM some_table;
This will return a column cast as type TEXT;

Is there some configuration option (or hack?) available which will return
above as VARCHAR ?

I'm using 3rd party software where a VARCHAR value displays much better than
TEXT.
I know best practice will be to type-cast , but I'm hoping for a quick-fix
here :)

​No, there is not.

David J.
 

gmb

unread,
May 17, 2016, 12:23:43 PM5/17/16
to
0 new messages