Thread: Boolean variables...
If I try to set a boolean to 'f' it works; if I set it to 't' it actually sets it to false... You'd think if I'm not allowed to use a string it would raise an error? Eh. No matter. My problem is solved but it looks like a common gotcha. So is there an FAQ on this? cheers C Cath Lawrence, Cath.Lawrence@anu.edu.au Senior Scientific Programmer, Centre for Bioinformation Science, John Curtin School of Medical Research (room 4088) Australian National University, Canberra ACT 0200 ph: (02) 61257959 mobile: 0421-902694 fax: (02) 61252595
Cath Lawrence <Cath.Lawrence@anu.edu.au> writes: > If I try to set a boolean to 'f' it works; if I set it to 't' it > actually sets it to false... Not here: regression=# create table t1 (f1 boolean); CREATE TABLE regression=# insert into t1 values('f'); INSERT 1201117 1 regression=# insert into t1 values('t'); INSERT 1201118 1 regression=# select * from t1; f1 ---- f t (2 rows) regards, tom lane
On the BOOLEAN issue, it seems that a majority of the 'MAJOR', high dollar DBs. do not support the boolean datatype. Is PG supporting a depreciated feature or have the other DBs yet to catch up? --Herbie ----- Original Message ----- From: "Tom Lane" <tgl@sss.pgh.pa.us> To: "Cath Lawrence" <Cath.Lawrence@anu.edu.au> Cc: <pgsql-novice@postgresql.org> Sent: Thursday, August 28, 2003 11:32 PM Subject: Re: [NOVICE] Boolean variables... > Cath Lawrence <Cath.Lawrence@anu.edu.au> writes: > > If I try to set a boolean to 'f' it works; if I set it to 't' it > > actually sets it to false... > > Not here: > > regression=# create table t1 (f1 boolean); > CREATE TABLE > regression=# insert into t1 values('f'); > INSERT 1201117 1 > regression=# insert into t1 values('t'); > INSERT 1201118 1 > regression=# select * from t1; > f1 > ---- > f > t > (2 rows) > > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster
Herbie McDuck wrote: > On the BOOLEAN issue, it seems that a majority of the 'MAJOR', high dollar > DBs. do not support the boolean datatype. > > Is PG supporting a depreciated feature or have the other DBs yet to catch > up? We aren't sure. :-) Our boolean support isn't going to be removed, if that is your question. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Bruce Momjian <pgman@candle.pha.pa.us> writes: > Herbie McDuck wrote: >> On the BOOLEAN issue, it seems that a majority of the 'MAJOR', high dollar >> DBs. do not support the boolean datatype. >> >> Is PG supporting a depreciated feature or have the other DBs yet to catch >> up? > We aren't sure. :-) Sure we are. SQL99 defines type boolean, SQL92 didn't. AFAICT our boolean type is exactly compatible with SQL99 (except that SQL99 offers UNKNOWN as an alternate spelling of NULL::BOOLEAN, which we haven't bothered to provide yet). I wasn't actually planning to respond to such an obvious troll ... regards, tom lane