Re: Best way to simulate Booleans

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Peter Headland <pheadland(at)actuate(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Best way to simulate Booleans
Date: 2009-07-07 09:26:30
Message-ID: 407d949e0907070226p723915c1u8c74a64b4d66593@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Jul 7, 2009 at 10:17 AM, Simon Riggs<simon(at)2ndquadrant(dot)com> wrote:
>
>
> Integer works best since it converts easily to boolean
>
> mybool smallint check (mybool in (0, 1))
>
> You can use "char" also, but the syntax is less clear.

Hm, I was going to suggest using boolean in postgres and making a
"boolean" domain in Oracle for char(1) and then write all sql to
compare with = 'f' and = 't'. It's annoying you can't use "WHERE
foo_flag" and have to write "WHERE foo_flag = 't'" but otherwise that
would give you the same sql in both flavours.

--
greg
http://mit.edu/~gsstark/resume.pdf

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jon Norman 2009-07-07 21:03:23 Re: fsync and Windows XP
Previous Message Simon Riggs 2009-07-07 09:17:02 Re: Best way to simulate Booleans