Bug #28214 Inconsistency in setting BINARY flag for fields with binary collation
Submitted: 3 May 2007 8:11 Modified: 9 May 2007 3:56
Reporter: Tonci Grgin Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.0.42-BK, 5.0.38BK OS:Windows (XPPro SP2)
Assigned to: Assigned Account CPU Architecture:Any

[3 May 2007 8:11] Tonci Grgin
Description:
Check the difference in BINARY flag in INT and DECIMAL fields (missing) compared to DATE field (present). Just another side effect of testing Bug#10491 problems.

How to repeat:
C:\mysql507\bin>mysql -uroot -T test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.0.38-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table bug28113 (
    -> Id INT UNSIGNED NOT NULL PRIMARY KEY,
    -> DateCol DATE NOT NULL);
Query OK, 0 rows affected (0.09 sec)

mysql> INSERT INTO bug28113 VALUES (1,"2007-05-01"), (2,"2007-05-02");
Query OK, 2 rows affected (0.02 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> SELECT * FROM bug28113;
Field   1:  `Id`
Catalog:    `def`
Database:   `test`
Table:      `bug28113`
Org_table:  `bug28113`
Type:       LONG
Collation:  binary (63)
Length:     10
Max_length: 1
Decimals:   0
Flags:      NOT_NULL PRI_KEY UNSIGNED NO_DEFAULT_VALUE NUM PART_KEY

Field   2:  `DateCol`
Catalog:    `def`
Database:   `test`
Table:      `bug28113`
Org_table:  `bug28113`
Type:       DATE
Collation:  binary (63)
Length:     10
Max_length: 10
Decimals:   0
Flags:      NOT_NULL BINARY NO_DEFAULT_VALUE

+----+------------+
| Id | DateCol    |
+----+------------+
|  1 | 2007-05-01 |
|  2 | 2007-05-02 |
+----+------------+
2 rows in set (0.00 sec)

----
mysql> ALTER TABLE bug28113 ADD COLUMN DecCol DECIMAL (5,2) NOT NULL DEFAULT 5.0
0;
Query OK, 2 rows affected (0.09 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> SELECT Id, DecCol FROM bug28113;
Field   1:  `Id`
Catalog:    `def`
Database:   `test`
Table:      `bug28113`
Org_table:  `bug28113`
Type:       LONG
Collation:  binary (63)
Length:     10
Max_length: 1
Decimals:   0
Flags:      NOT_NULL PRI_KEY UNSIGNED NO_DEFAULT_VALUE NUM PART_KEY

Field   2:  `DecCol`
Catalog:    `def`
Database:   `test`
Table:      `bug28113`
Org_table:  `bug28113`
Type:       NEWDECIMAL
Collation:  binary (63)
Length:     7
Max_length: 4
Decimals:   2
Flags:      NOT_NULL

+----+--------+
| Id | DecCol |
+----+--------+
|  1 |   5.00 |
|  2 |   5.00 |
+----+--------+
2 rows in set (0.00 sec)

Suggested fix:
-