Bug #24530 BOOLEAN literals are not of BOOLEAN i.e. TINYINT(1)
Submitted: 23 Nov 2006 3:07 Modified: 23 Nov 2006 8:51
Reporter: Siu Ching Pong (Asuka Kenji) (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Data Types Severity:S4 (Feature request)
Version:5.1.12-beta OS:Linux (Linux (Fedora Core 5))
Assigned to: CPU Architecture:Any
Tags: boolean, BOOLEAN Related, Data Type, literal

[23 Nov 2006 3:07] Siu Ching Pong (Asuka Kenji)
Description:
The data type of TRUE and FALSE is INT(1), instead of BOOLEAN, i.e. TINYINT(1) in 5.1.12-beta.

Motivation of reporting this issue:

1. BOOLEAN literals which are "wider than" the BOOLEAN data type makes it conceptually incorrect.

2. This may cause "narrowing conversions" to occur when BOOLEAN literals are used in, for example, an INSERT statement:

INSERT INTO test.t1 VALUES (1, 2, TRUE);

3. Fixing the BOOLEAN literals first is an important step towards "full boolean type handling".

File Downloaded:
mysql-5.1.12-beta-linux-x86_64-icc-glibc23.tar.gz

Note:
I have already read "http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html"

How to repeat:
Statements:

DROP TABLE IF EXISTS test.t1;

CREATE TABLE test.t1
SELECT TRUE, FALSE;

DESC test.t1;

Result:

+-------+--------+------+-----+---------+-------+
| Field | Type   | Null | Key | Default | Extra |
+-------+--------+------+-----+---------+-------+
| TRUE  | int(1) | NO   |     | 0       |       |
| FALSE | int(1) | NO   |     | 0       |       |
+-------+--------+------+-----+---------+-------+
2 rows in set (0.00 sec)

Suggested fix:
Declare the BOOLEAN literals TRUE and FALSE as BOOLEAN internally.
[23 Nov 2006 8:51] Sveta Smirnova
Thank you for the reasonable feature request.