Re: Best way to simulate Booleans

From: Dirk Jagdmann <jagdmann(at)gmail(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: 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:05:15
Message-ID: 5d0f60990907070205u3189bd01vff17950e63159455@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> The most transportable method would be to use either a char(1) or an
> int with a check constraint.
>
> mybool char(1) check (mybool in ('t','f'))
> mybool int check (mybool >=0 and <=1)

I would decide depending on the application requirement. If my Oracle
should look similar to PostgreSQL use the char(1). If you have lots of
application code the int is probably better, since you can just use
the created programming language variable (presumably an integer as
well) in your programming language expressions (if, while).

--
---> Dirk Jagdmann
----> http://cubic.org/~doj
-----> http://llg.cubic.org

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Simon Riggs 2009-07-07 09:17:02 Re: Best way to simulate Booleans
Previous Message Scott Marlowe 2009-07-07 06:13:46 Re: Best way to simulate Booleans