pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tod McQuillin <devin@spamcop.net>
To: Bhuvan A <bhuvansql@linuxfreemail.com>
Cc: pgsql-sql@postgresql.org, <pgsql-bugs@postgresql.org>
Subject: Re: Casting integer to boolean
Date: Fri, 16 Aug 2002 16:48:49 +0900 (JST)
Message-ID: <20020816164529.S5079-100000@glass.pun-pun.prv> (raw)
In-Reply-To: <Pine.LNX.4.44.0208161249130.2342-100000@Bhuvan.bksys.co.in>

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




view thread (3+ messages)  latest in thread

Message-ID: <20020816164529.S5079-100000@glass.pun-pun.prv>
Permalink:  ../20020816164529.S5079-100000@glass.pun-pun.prv/
Also on:    postgresql.org/message-id/20020816164529.S5079-100000@glass.pun-pun.prv

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: devin@spamcop.net, bhuvansql@linuxfreemail.com, pgsql-bugs@postgresql.org
  Subject: Re: Casting integer to boolean
  In-Reply-To: <20020816164529.S5079-100000@glass.pun-pun.prv>
  References: <Pine.LNX.4.44.0208161249130.2342-100000@Bhuvan.bksys.co.in> <20020816164529.S5079-100000@glass.pun-pun.prv>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox