Bug #22361 Implementation of data type BOOLEAN
Submitted: 14 Sep 2006 18:25 Modified: 10 Jun 2009 11:19
Reporter: Larry Irwin Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Data Types Severity:S4 (Feature request)
Version:5 OS:Any
Assigned to: CPU Architecture:Any
Tags: BOOL

[14 Sep 2006 18:25] Larry Irwin
Description:
If a BOOLEAN data type is declared and a TINYINT(1) is created, it would have been nice for it to create an UNSIGNED TINYINT(1) with limits on the value from 0 to 1.
As it is implemented in version 5, it allows the values -128 through 127.
It would have been easier to implement with BIT(1), which would have automatically limited it's values to true, false and null.

How to repeat:
mysql> CREATE TABLE t (a BOOL, b FLOAT8, c LONG VARCHAR, d NUMERIC);
Query OK, 0 rows affected (0.00 sec)

mysql> DESCRIBE t;
+-------+---------------+------+-----+---------+-------+
| Field | Type          | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| a     | tinyint(1)    | YES  |     | NULL    |       |
| b     | double        | YES  |     | NULL    |       |
| c     | mediumtext    | YES  |     | NULL    |       |
| d     | decimal(10,0) | YES  |     | NULL    |       |
+-------+---------------+------+-----+---------+-------+
4 rows in set (0.01 sec)

Suggested fix:
Add a MySQL data type BOOLEAN as a special interpretation of a BIT(1) datatype.
[15 Sep 2006 8:20] Valeriy Kravchuk
Thank you for a reasonable feature request.
[6 May 2009 18:52] Viktor Ć tujber
I asked around, and it seems that BOOL/BOOLEAN still maps to TINYINT(1), for backwards compatibility reasons.

Considering that, there is still the possibility of implementing it as BIT(1), and providing a server option to switch between the old/new behavior.
[10 Jun 2009 11:19] Susanne Ebrecht
This is a duplicate of bug #8845
[28 Dec 2010 11:43] Kemal Soysal
I do not think this is related to bug #8845.