Re: Handle untype-cast string as VARCHAR instead of TEXT

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: gmb <gmbouwer(at)gmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Handle untype-cast string as VARCHAR instead of TEXT
Date: 2016-05-17 13:19:44
Message-ID: CAKFQuwYxZ1mwfxU23nziEwCvHrLJjamBJ6+YVxh-4_2NfCuoWA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, May 17, 2016 at 8:58 AM, gmb <gmbouwer(at)gmail(dot)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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message gmb 2016-05-17 16:23:29 Re: Handle untype-cast string as VARCHAR instead of TEXT
Previous Message gmb 2016-05-17 12:58:04 Handle untype-cast string as VARCHAR instead of TEXT