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

Converting column containing string value '0' to enum converts to empty string

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 10.11.6
    • N/A
    • Data types
    • None

    Description

      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 1624425
      Server version: 10.11.6-MariaDB-1:10.11.6+maria~ubu2004-log mariadb.org binary distribution
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]> create database phils_test;
      Query OK, 1 row affected (0.004 sec)
       
      MariaDB [(none)]> use phils_test
      Database changed
       
      MariaDB [phils_test]> create table enum_test2(c1 varchar(20));
      Query OK, 0 rows affected (0.007 sec)
       
      MariaDB [phils_test]> insert into enum_test2 values ('first'),('second'),('third'), (null), ('0');
      Query OK, 5 rows affected (0.003 sec)
      Records: 5  Duplicates: 0  Warnings: 0
       
      MariaDB [phils_test]> select * from enum_test2;
      +--------+
      | c1     |
      +--------+
      | first  |
      | second |
      | third  |
      | NULL   |
      | 0      |
      +--------+
      5 rows in set (0.001 sec)
       
      MariaDB [phils_test]> alter table enum_test2 modify c1 enum('first','third', 'second');
      Query OK, 5 rows affected (0.012 sec)
      Records: 5  Duplicates: 0  Warnings: 0
       
      MariaDB [phils_test]> select * from enum_test2;
      +--------+
      | c1     |
      +--------+
      | first  |
      | second |
      | third  |
      | NULL   |
      |        |
      +--------+
      5 rows in set (0.001 sec)
       
      MariaDB [phils_test]> drop database phils_test;
      Query OK, 1 row affected (0.024 sec)
       
      
      

      ---------------------------------

      Conversion to enum should fail as '0' is not a valid value in the enum.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            psumner Phil Sumner
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.