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

EXTRACT from INET6 value does not produce any warnings

    XMLWordPrintable

Details

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

    Description

      create or replace table t1 (a inet6);
      insert into t1 values ('::'),('1::1');
      SELECT EXTRACT(DAY FROM a) FROM t1;
      

      10.5 b5fae7f7

      MariaDB [test]> SELECT EXTRACT(DAY FROM a) FROM t1;
      +---------------------+
      | EXTRACT(DAY FROM a) |
      +---------------------+
      |                   0 |
      |                   0 |
      +---------------------+
      2 rows in set (0.000 sec)
      

      With either CHAR or BINARY instead of INET6, there are warnings:

      MariaDB [test]> create or replace table t1 (a char(39));
      Query OK, 0 rows affected (0.322 sec)
       
      MariaDB [test]> insert into t1 values ('::'),('1::1');
      Query OK, 2 rows affected (0.043 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> SELECT EXTRACT(DAY FROM a) FROM t1;
      +---------------------+
      | EXTRACT(DAY FROM a) |
      +---------------------+
      |                NULL |
      |                   0 |
      +---------------------+
      2 rows in set, 2 warnings (0.000 sec)
       
      MariaDB [test]> show warnings;
      +---------+------+----------------------------------------+
      | Level   | Code | Message                                |
      +---------+------+----------------------------------------+
      | Warning | 1292 | Incorrect interval value: '::'         |
      | Warning | 1292 | Truncated incorrect time value: '1::1' |
      +---------+------+----------------------------------------+
      2 rows in set (0.000 sec)
      

      MariaDB [test]> create or replace table t1 (a binary(16));
      Query OK, 0 rows affected (0.324 sec)
       
      MariaDB [test]> insert into t1 values (INET6_ATON('::')),(INET6_ATON('1::1'));
      Query OK, 2 rows affected (0.042 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> SELECT EXTRACT(DAY FROM a) a1, EXTRACT(DAY FROM INET6_NTOA(a)) a2 FROM t1;
      +------+------+
      | a1   | a2   |
      +------+------+
      | NULL | NULL |
      | NULL |    0 |
      +------+------+
      2 rows in set, 4 warnings (0.000 sec)
       
      MariaDB [test]> show warnings;
      +---------+------+----------------------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                                      |
      +---------+------+----------------------------------------------------------------------------------------------+
      | Warning | 1292 | Incorrect interval value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
      | Warning | 1292 | Incorrect interval value: '::'                                                               |
      | Warning | 1292 | Incorrect interval value: '\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' |
      | Warning | 1292 | Truncated incorrect time value: '1::1'                                                       |
      +---------+------+----------------------------------------------------------------------------------------------+
      4 rows in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.