Re: Casting integer to boolean

From: Tod McQuillin <devin(at)spamcop(dot)net>
To: Bhuvan A <bhuvansql(at)linuxfreemail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Casting integer to boolean
Date: 2002-08-16 07:48:49
Message-ID: 20020816164529.S5079-100000@glass.pun-pun.prv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

On Fri, 16 Aug 2002, Bhuvan A wrote:

> How do i cast an integer value to boolean?

You can always do something like this:

select not count(*) = 0 from my_table;

Basically, for any integer i, convert to boolean with: not i = 0
--
Tod McQuillin

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-08-16 07:53:58 Re: Casting integer to boolean
Previous Message Bhuvan A 2002-08-16 07:37:31 Casting integer to boolean

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-08-16 07:53:58 Re: Casting integer to boolean
Previous Message Bhuvan A 2002-08-16 07:37:31 Casting integer to boolean