[MCOL-4909] Columnstore handles nulls and zero-length strings different from the way Innodb handles them Created: 2021-10-28  Updated: 2023-07-05

Status: Open
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: None
Fix Version/s: Icebox

Type: Bug Priority: Major
Reporter: Edward Stoever Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MCOL-4403 Trailing spaces not behaving as InnoDB Closed

 Description   

Columnstore engine does not store empty strings in varchar or text columns, it replaces them with null.

MariaDB [wh]> show session status like 'Columnstore_version';
Variable_name   Value
Columnstore_version     6.1.1
MariaDB [wh]> truncate table p;
MariaDB [wh]> show create table p;
Table   Create Table
p       CREATE TABLE `p` (\n  `col1` varchar(100) DEFAULT NULL\n) ENGINE=Columnstore DEFAULT CHARSET=utf8mb3
MariaDB [wh]> insert into p values (null);
MariaDB [wh]> insert into p values ('');
MariaDB [wh]> select * from p;
col1
NULL
NULL
MariaDB [wh]>

If the column is defined as varchar NOT NULL there is a conflict, which throws an error.

MariaDB [wh]> CREATE TABLE `q`(`col1` varchar(100) NOT NULL DEFAULT '')ENGINE=Columnstore DEFAULT CHARSET=utf8mb3;
MariaDB [wh]> insert into q values('');
ERROR 1815 (HY000): Internal error: CAL0001: Insert Failed:  IDB-4015: Column 'col1' cannot be null.
MariaDB [wh]> 
MariaDB [wh]> CREATE TABLE `u`(`col1` varchar(100) NOT NULL DEFAULT '')ENGINE=innodb DEFAULT CHARSET=utf8mb3;
MariaDB [wh]> insert into u values ('');
MariaDB [wh]> insert into u values (null);
ERROR 1048 (23000): Column 'col1' cannot be null
MariaDB [wh]>



 Comments   
Comment by Edward Stoever [ 2021-10-28 ]

Customer states:
"If there was a way to store an empty string the BI tool (Pentaho) would produce more complete reports.
In the previous versions 1.1.6 and 1.2.5, which we are currently using in dev and production environments, use varchar NOT NULL and this works and does not cause issues. So something changed with the 6.1.1 release."

Generated at Thu Feb 08 02:53:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.