[MDEV-20790] CSV table with INET6 can be created and inserted into, but cannot be read from Created: 2019-10-09  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 not null) engine=csv;
insert into t1 values ('2001:db8::ff00:42:8329');
select * from t1;

10.5 b37386d8

MariaDB [test]> create or replace table t1 (a inet6 not null) engine=csv;
Query OK, 0 rows affected (0.062 sec)
 
MariaDB [test]> insert into t1 values ('2001:db8::ff00:42:8329');
Query OK, 1 row affected (0.017 sec)
 
MariaDB [test]> select * from t1;
ERROR 1194 (HY000): Table 't1' is marked as crashed and should be repaired
MariaDB [test]> repair table t1;
+---------+--------+----------+-------------------------------------------------------------------------------------+
| Table   | Op     | Msg_type | Msg_text                                                                            |
+---------+--------+----------+-------------------------------------------------------------------------------------+
| test.t1 | repair | Warning  | Incorrect inet6 value: '2001:db8::ff00:42:8329' for column `test`.`t1`.`a` at row 1 |
| test.t1 | repair | status   | OK                                                                                  |
+---------+--------+----------+-------------------------------------------------------------------------------------+
2 rows in set (0.017 sec)
 
MariaDB [test]> select * from t1;
Empty set (0.001 sec)



 Comments   
Comment by Alexander Barkov [ 2019-10-10 ]

The problem happens because ha_tina write data to the CSV file using text notation for INET6:

"2001:db8::ff00:42:8329"

but when it further reads a row in this statement:

      if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(),
                          is_enum ? CHECK_FIELD_IGNORE : CHECK_FIELD_WARN))

Field_inet6::store() considers the data to be in the binary format, because buffer.charset() points to &my_charset_bin.

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