Re: boolean or int2

Поиск
Список
Период
Сортировка
От Keith Worthington
Тема Re: boolean or int2
Дата
Msg-id 20050802184850.M94644@narrowpathinc.com
обсуждение исходный текст
Ответ на boolean or int2  (<operationsengineer1@yahoo.com>)
Ответы Re: boolean or int2  (<operationsengineer1@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Jeffrey Melloy
Дата:
Сообщение: Re: Strange Error on Table Creation Attempt
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Make year 01/01/0001 but leave timestamp alone