Re: Is there a way to return "true"/"false" string for boolean type?

From: Szymon Guz <mabewlun(at)gmail(dot)com>
To: ChoonSoo Park <luispark(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is there a way to return "true"/"false" string for boolean type?
Date: 2014-01-07 18:29:37
Message-ID: CAFjNrYvHprYtr8epAtpGfkN26n6O5d6SLd+XOM-jECyXAeCNew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7 January 2014 19:11, ChoonSoo Park <luispark(at)gmail(dot)com> wrote:

> Hello Gurus,
>
> I have several tables with lots of boolean columns.
> When I run select query for the tables, I always get 't' or 'f' for
> boolean types.
>
> Is there a way to return 'true' or 'false' string for boolean type except
> using CASE WHEN ... clause?
> I mean global postgres configuration setting to return 'true'/'false'
> instead of t/f.
>
> Thank you,
> Choon Park
>

Hi,
if you cast the boolean values to text, then you should get 'true'/'false':

SELECT true::boolean::text, false::boolean::text;
text | text
------+-------
true | false
(1 row)

Does it solve your problem? Why do you want to have true/false instead of
t/f?

regards,
Szymon

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ChoonSoo Park 2014-01-07 18:41:10 Re: Is there a way to return "true"/"false" string for boolean type?
Previous Message ChoonSoo Park 2014-01-07 18:11:16 Is there a way to return "true"/"false" string for boolean type?