Re: How to implement Microsoft Access boolean (YESNO)

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: How to implement Microsoft Access boolean (YESNO)
Дата
Msg-id 87r76yusi3.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: How to implement Microsoft Access boolean (YESNO)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: How to implement Microsoft Access boolean (YESNO)  (PFC <lists@peufeu.com>)
Re: How to implement Microsoft Access boolean (YESNO)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Greg Stark <gsstark@mit.edu> writes:
> > "Jesper K. Pedersen" <jkp@solnet.homeip.net> writes:
> >> Having checked the I/O format it seems that MS Access exports the
> >> values of a YESNO field as 0 and 1
> 
> > If only Postgres's boolean type were as helpful.
> 
> There's a cast to int in 8.1, and you can roll-your-own easily in prior
> releases ...

The annoying thing about is that in just about any client language you'll get
't' and 'f' by default and both will evaluate to false. So any user who tries
to do things the obvious way like this will get a surprise:
if ($db->query("select canlogin from users where userid = ?",$userid)) {  ...}

Is there an implicit cast from ints? So if I pass a 0 or 1 argument for a
boolean parameter now it'll work? That definitely didn't work in the past.

-- 
greg



В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: How to implement Microsoft Access boolean (YESNO)
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: non-equi self-join optimization