Details
- 
    Bug 
- 
    Status: Closed (View Workflow)
- 
    Major 
- 
    Resolution: Fixed
- 
    5.5.1, 5.6.1
- 
        2021-5, 2021-6
Description
| DROP TABLE IF EXISTS t1; | 
| CREATE TABLE t1 (a VARCHAR(2) NOT NULL DEFAULT 'aa') ENGINE=ColumnStore; | 
| INSERT INTO t1 VALUES (''); | 
| SELECT HEX(a) FROM t1; | 
| +--------+ | 
| | HEX(a) | | 
| +--------+ | 
| | 6161   | | 
| +--------+
 | 
Notice, emptry string was conversion to default 'aa'. Looks wrong.
| DROP TABLE IF EXISTS t1; | 
| CREATE TABLE t1 (a VARCHAR(2) NOT NULL DEFAULT ' ') ENGINE=ColumnStore; | 
| INSERT INTO t1 VALUES (''); | 
| SELECT HEX(a) FROM t1; | 
| +--------+ | 
| | HEX(a) | | 
| +--------+ | 
| | 20     | | 
| +--------+
 | 
Notice, emptry string was conversion to default ' '. Looks wrong.
| DROP TABLE IF EXISTS t1; | 
| CREATE TABLE t1 (a VARCHAR(2) NOT NULL DEFAULT ' ') ENGINE=ColumnStore; | 
| INSERT INTO t1 VALUES (' '); | 
| SELECT HEX(a) FROM t1; | 
| +--------+ | 
| | HEX(a) | | 
| +--------+ | 
| | 2020   | | 
| +--------+
 | 
Notice, emptry string was conversion to default ' '. Looks wrong.
In all above scenarios, INSERTs should:
- either fail on NOT NULL violation for now
- or insert an empty string (when we fix the flaw that emptry string is NULL)
But it should not replace to DEFAULT!