agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedHandle untype-cast string as VARCHAR instead of TEXT
3+ messages / 2 participants
[nested] [flat]
* Handle untype-cast string as VARCHAR instead of TEXT
@ 2016-05-17 12:58 gmb <gmbouwer@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: gmb @ 2016-05-17 12:58 UTC (permalink / raw)
To: pgsql-sql
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 (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Handle untype-cast string as VARCHAR instead of TEXT
@ 2016-05-17 13:19 David G. Johnston <david.g.johnston@gmail.com>
parent: gmb <gmbouwer@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: David G. Johnston @ 2016-05-17 13:19 UTC (permalink / raw)
To: gmb <gmbouwer@gmail.com>; +Cc: pgsql-sql
On Tue, May 17, 2016 at 8:58 AM, gmb <gmbouwer@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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Handle untype-cast string as VARCHAR instead of TEXT
@ 2016-05-17 16:23 gmb <gmbouwer@gmail.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: gmb @ 2016-05-17 16:23 UTC (permalink / raw)
To: pgsql-sql
Thanks David, worth a try.
GMB
--
View this message in context: http://postgresql.nabble.com/Handle-untype-cast-string-as-VARCHAR-instead-of-TEXT-tp5903959p5903993....
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2016-05-17 16:23 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-17 12:58 Handle untype-cast string as VARCHAR instead of TEXT gmb <gmbouwer@gmail.com>
2016-05-17 13:19 ` David G. Johnston <david.g.johnston@gmail.com>
2016-05-17 16:23 ` gmb <gmbouwer@gmail.com>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox