[MCOL-2059] Strings or empty strings are inserted as zero values in numeric data types Created: 2019-01-04  Updated: 2019-09-29  Resolved: 2019-09-29

Status: Closed
Project: MariaDB ColumnStore
Component/s: MariaDB Server
Affects Version/s: 1.2.2
Fix Version/s: Icebox

Type: Bug Priority: Major
Reporter: Zdravelina Sokolovska (Inactive) Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Relates
relates to MCOL-2060 sql_mode does not include STRICT_TRAN... Closed

 Description   

Strings or empty strings are inserted as zero values in numeric data types

expected: receive Error and operation is rejected

note:builtin innodb_version 10.3.11 and server version 10.3.11-MariaDB

1. Create tables with engine Columnstore and InnoDB columns of integer data type
2. Insert into string values --Operation is accepted and it's inserted zero values

1.

MariaDB [a]> show create table acol;
+-------+--------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                             |
+-------+--------------------------------------------------------------------------------------------------------------------------+
| acol  | CREATE TABLE `acol` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)
 
MariaDB [a]> show create table ainn;
+-------+---------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                        |
+-------+---------------------------------------------------------------------------------------------------------------------+
| ainn  | CREATE TABLE `ainn` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+---------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
 
MariaDB [a]>

2.1 Insert a string

MariaDB [a]> insert into acol values ("RR",1);
Query OK, 1 row affected, 1 warning (0.364 sec)
 
MariaDB [a]> select * from acol;
+------+------+
| a    | b    |
+------+------+
|    0 |    1 |
+------+------+
1 row in set (0.100 sec)
 
MariaDB [a]> insert into ainn values ("RR",1);
Query OK, 1 row affected, 1 warning (0.014 sec)
 
MariaDB [a]> select * from ainn;
+------+------+
| a    | b    |
+------+------+
|    0 |    1 |
+------+------+
1 row in set (0.001 sec)

2.2 Insert an empty string

MariaDB [a]> insert into acol values ("",1);
Query OK, 1 row affected, 1 warning (0.105 sec)
 
MariaDB [a]> select * from acol;
+------+------+
| a    | b    |
+------+------+
|    0 |    1 |
|    0 |    1 |
+------+------+
2 rows in set (0.039 sec)
 
MariaDB [a]> insert into ainn values ("",1);
Query OK, 1 row affected, 1 warning (0.009 sec)
 
MariaDB [a]> select * from ainn;
+------+------+
| a    | b    |
+------+------+
|    0 |    1 |
|    0 |    1 |
+------+------+
2 rows in set (0.002 sec)
 

expected behavior as in pure MariDB server installation:

MariaDB [a]>  insert into a values ("RR",1) ;
ERROR 1366 (22007): Incorrect integer value: 'RR' for column 'a' at row 1
MariaDB [a]>  insert into a values ("",1) ;
ERROR 1366 (22007): Incorrect integer value: '' for column 'a' at row 1
MariaDB [a]>



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2019-01-04 ]

As shown in your examples, behaviour is the same for both InnoDB and ColumnStore tables. You get a warning each time telling you this happened.

Comment by Andrew Hutchings (Inactive) [ 2019-01-04 ]

Note that the additional "expected behavior" in the description edit makes this a duplicate of MCOL-2060

Comment by Zdravelina Sokolovska (Inactive) [ 2019-01-04 ]

issue seems to be related to the defaults setting of the sql_mode; strict_trans_tables is not included :
MariaDB [a]> SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
-> ;
MariaDB [a]> insert into acol values ("RR",1);
ERROR 1366 (22007): Incorrect integer value: 'RR' for column 'a' at row 1
MariaDB [a]> insert into acol values ("",1);
ERROR 1366 (22007): Incorrect integer value: '' for column 'a' at row 1

Comment by Zdravelina Sokolovska (Inactive) [ 2019-01-04 ]

related to MCOL-2060

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