Re: boolean or int2 - Mailing list pgsql-novice

From Keith Worthington
Subject Re: boolean or int2
Date
Msg-id 20050802184850.M94644@narrowpathinc.com
Whole thread Raw
In response to boolean or int2  (<operationsengineer1@yahoo.com>)
Responses Re: boolean or int2  (<operationsengineer1@yahoo.com>)
List pgsql-novice
On Tue, 2 Aug 2005 10:31:17 -0700 (PDT), operationsengineer1 wrote
> i have a situation where widgets either pass or fail a
> test and i record the result.
>
> i'm thinking of using boolean to track this - true for
> pass, false for fail.
>
> i've used int2 in other situations b/c i couldn't be
> as sure that only two outcomes were possible.  i could
> use int2 here, also (ie, 0 for fail, 1 for pass).
>
> does it make a practical difference which one i use?
>
> as always, thanks for the help. it is much appreciated.

Personally I like to use a boolean to make the code a little more self
documenting.  With a column name like passed_test and a boolean your code ends
up looking like

WHERE passed_test

or

WHERE NOT passed_test

Kind Regards,
Keith

pgsql-novice by date:

Previous
From: Jeffrey Melloy
Date:
Subject: Re: Strange Error on Table Creation Attempt
Next
From: Tom Lane
Date:
Subject: Re: Make year 01/01/0001 but leave timestamp alone