Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20790

CSV table with INET6 can be created and inserted into, but cannot be read from

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.5
    • 10.5.0
    • Data types
    • None

    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)
      

      Attachments

        Issue Links

          Activity

            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.

            bar Alexander Barkov added a comment - 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.

            People

              bar Alexander Barkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.