Re: Best way to simulate Booleans - Mailing list pgsql-sql

From Dirk Jagdmann
Subject Re: Best way to simulate Booleans
Date
Msg-id 5d0f60990907070205u3189bd01vff17950e63159455@mail.gmail.com
Whole thread Raw
In response to Re: Best way to simulate Booleans  (Scott Marlowe <scott.marlowe@gmail.com>)
List 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


pgsql-sql by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Best way to simulate Booleans
Next
From: Simon Riggs
Date:
Subject: Re: Best way to simulate Booleans