Thread: Booleans - Why in Postgres and not in Oracle or Mysql?

Booleans - Why in Postgres and not in Oracle or Mysql?

From
CSN
Date:
I like Postgres's boolean type - why do you suppose
neither Mysql nor Oracle has bothered to implement it?
Booleans are in the SQL-99 spec.

CSN

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: Booleans - Why in Postgres and not in Oracle or Mysql?

From
"Dann Corbit"
Date:
> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> owner@postgresql.org] On Behalf Of CSN
> Sent: Thursday, May 05, 2005 11:57 AM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Booleans - Why in Postgres and not in Oracle or
Mysql?
>
> I like Postgres's boolean type -

Me too.

> why do you suppose
> neither Mysql nor Oracle has bothered to implement it?

Probably they just create a domain using a char which can take on two
values (e.g. 't'/'f' or 1/0).  Oracle 10 has a bit data type (which is a
boolean for all intents and purposes):
B.1 BIGINT
B.2 BINARY
B.3 BIT
B.4 BLOB
B.5 CHAR
B.6 CLOB
B.7 DATE
B.8 DECIMAL
B.9 DOUBLE PRECISION
B.10 FLOAT
B.11 INTEGER
B.12 LONG
B.13 LONG RAW
B.14 LONG VARBINARY
B.15 LONG VARCHAR
B.16 NUMBER
B.17 NUMERIC
B.18 RAW
B.19 REAL
B.20 ROWID
B.21 SMALLINT
B.22 TIME
B.23 TIMESTAMP
B.24 TINYINT
B.25 VARBINARY
B.26 VARCHAR
B.27 VARCHAR2

MySql has a partial Boolean implementation.  From
http://dev.mysql.com/doc/mysql/en/numeric-type-overview.html:

BOOL , BOOLEAN

These are synonyms for TINYINT(1). The BOOLEAN synonym was added in
MySQL 4.1.0. A value of zero is considered false. Non-zero values are
considered true.

In the future, full boolean type handling will be introduced in
accordance with standard SQL.




> Booleans are in the SQL-99 spec.

Probably, MySQL and Oracle will have Boolean types eventually with full
compatibility to the standard.

> CSN
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if
your
>       joining column's datatypes do not match

Re: Booleans - Why in Postgres and not in Oracle or Mysql?

From
CSN
Date:
--- Dann Corbit <DCorbit@connx.com> wrote:
> > why do you suppose
> > neither Mysql nor Oracle has bothered to implement
> it?
>
> Probably they just create a domain using a char
> which can take on two
> values (e.g. 't'/'f' or 1/0).  Oracle 10 has a bit
> data type (which is a
> boolean for all intents and purposes):

Could a bit handle NULL's though?

CSN

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: Booleans - Why in Postgres and not in Oracle or Mysql?

From
Peter Eisentraut
Date:
CSN wrote:
> I like Postgres's boolean type - why do you suppose
> neither Mysql nor Oracle has bothered to implement it?
> Booleans are in the SQL-99 spec.

Fear of breaking old applications

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: Booleans - Why in Postgres and not in Oracle or Mysql?

From
Robert Treat
Date:
On Thu, 2005-05-05 at 15:28, CSN wrote:
>
> --- Dann Corbit <DCorbit@connx.com> wrote:
> > > why do you suppose
> > > neither Mysql nor Oracle has bothered to implement
> > it?
> >
> > Probably they just create a domain using a char
> > which can take on two
> > values (e.g. 't'/'f' or 1/0).  Oracle 10 has a bit
> > data type (which is a
> > boolean for all intents and purposes):
>
> Could a bit handle NULL's though?
>

ISTR there is some debate on whether Booleans should allow NULL and
thats why the boolean type is still in the extended set of sql spec and
not core.

Inceidentally MySQL's boolean is really scary... it's not just than 0 =
false and 1 = true, its 0 = false and (n >= 1) is true.  IMHO that
sounds like a recipe for creating subtle bugs.


Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL