Boolean internal representation

Started by Garo Hussenjianover 23 years ago3 messagesgeneral
Jump to latest
#1Garo Hussenjian
garo@xapnet.com

Is there a way to always return booleans as 1/0 instead of t/f, without
using a CASE statement...

Thanks and Regards,
Garo.

=-=-==-=-=-==

Xapnet Internet Solutions
1501 Powell St., Suite N
Emeryville, CA 94608

Tel - (510) 655-9771
Fax - (510) 655-9775
Web - http://www.xapnet.com

#2Bruce Momjian
bruce@momjian.us
In reply to: Garo Hussenjian (#1)
Re: Boolean internal representation

Garo Hussenjian wrote:

Is there a way to always return booleans as 1/0 instead of t/f, without
using a CASE statement...

How do you feel about a plpgsql function that does it:

SELECT print01(boolcol) FROM ...

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Martijn van Oosterhout
kleptog@svana.org
In reply to: Bruce Momjian (#2)
Re: Boolean internal representation

On Wed, Sep 18, 2002 at 08:33:04PM -0400, Bruce Momjian wrote:

Garo Hussenjian wrote:

Is there a way to always return booleans as 1/0 instead of t/f, without
using a CASE statement...

How do you feel about a plpgsql function that does it:

SELECT print01(boolcol) FROM ...

Interestinly, if you use Perl DBI, it translates t/f to 1/0 for you. Very
annoying if you're not expecting it to :)
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

There are 10 kinds of people in the world, those that can do binary
arithmetic and those that can't.