[MDEV-20798] Conversion from INET6 to other types performed without errors or warnings Created: 2019-10-10  Updated: 2019-10-11  Resolved: 2019-10-11

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.5
Fix Version/s: 10.5.0

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-274 The data type for IPv6/IPv4 addresses... Closed
relates to MDEV-20784 Testing for MDEV-274 (INET6, data typ... Closed

 Description   

create or replace table t1 (a inet6, b int);
insert into t1 (a) values ('::');
update t1 set b = a;

10.5 b37386d8

MariaDB [test]> update t1 set b = a;
Query OK, 1 row affected (0.047 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
MariaDB [test]> select * from t1;
+------+------+
| a    | b    |
+------+------+
| ::   |    0 |
+------+------+
1 row in set (0.000 sec)

Since explicit CAST from INET6 to INT is prohibited, I would expect that this conversion would be too, or at least it should cause a typical truncation warning/error.

Same with TIMESTAMP, for example:

MariaDB [test]> create or replace table t1 (a inet6, b timestamp);
Query OK, 0 rows affected (0.355 sec)
 
MariaDB [test]> insert into t1 (a) values ('::');
Query OK, 1 row affected (0.045 sec)
 
MariaDB [test]> update t1 set b = a;
Query OK, 1 row affected (0.032 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
MariaDB [test]> select * from t1;
+------+---------------------+
| a    | b                   |
+------+---------------------+
| ::   | 0000-00-00 00:00:00 |
+------+---------------------+
1 row in set (0.001 sec)

Can also be reproduced with ALTER:

MariaDB [test]> create or replace table t1 (a inet6);
Query OK, 0 rows affected (0.321 sec)
 
MariaDB [test]> insert into t1 (a) values ('::');
Query OK, 1 row affected (0.032 sec)
 
MariaDB [test]> alter table t1 modify a date;
Query OK, 1 row affected (0.926 sec)               
Records: 1  Duplicates: 0  Warnings: 0
 
MariaDB [test]> select * from t1;
+------------+
| a          |
+------------+
| 2019-10-11 |
+------------+
1 row in set (0.001 sec)

etc.


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