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

Alter on long unique varchar column makes result null

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 10.4.3
    • 10.4.4
    • Server
    • None
    • All

    Description

       
      #
      #MDEV-18922 Alter on long unique varchar column makes result null
      #
      CREATE TABLE t1 (b int, a  varchar(4000));
      INSERT INTO t1 VALUES (1, 2),(2,3),(3,4);
      ALTER TABLE t1 ADD UNIQUE INDEX (a);
      SELECT * FROM t1;
      SELECT a FROM t1;
      drop table t1;
       
      
      

      Result

      CREATE TABLE t1 (b int, a  varchar(4000));
      INSERT INTO t1 VALUES (1, 2),(2,3),(3,4);
      ALTER TABLE t1 ADD UNIQUE INDEX (a);
      SELECT * FROM t1;
      b       a
      1       2
      2       3
      3       4
      SELECT a FROM t1;
      a
      NULL
      NULL
      NULL
      drop table t1;
                    
      

      Attachments

        Issue Links

          Activity

            Even this is giving NULL

            # with VARCHAR(79) or blob  all results are correct
            CREATE TABLE t1 (a int);
             
            INSERT INTO t1 VALUES (1),(2);
             
            ALTER TABLE t1 ADD UNIQUE (a) using hash;
            # returns 2 rows with a=NULL, instead of rows 1,2
            SELECT * FROM t1;
            drop table t1;
            
            

            While this is not giving NULL which is strange

            # with VARCHAR(79) or blob  all results are correct
            CREATE TABLE t1 (a blob);
             
            INSERT INTO t1 VALUES (1),(2);
             
            ALTER TABLE t1 ADD UNIQUE (a) using hash;
            # returns 2 rows with a=NULL, instead of rows 1,2
            SELECT * FROM t1;
            drop table t1;
            
            

            So the field which stores the result in table->record itself is affected , while the fields which store the data pointer is not affected.

            sachin.setiya.007 Sachin Setiya (Inactive) added a comment - Even this is giving NULL # with VARCHAR (79) or blob all results are correct CREATE TABLE t1 (a int );   INSERT INTO t1 VALUES (1),(2);   ALTER TABLE t1 ADD UNIQUE (a) using hash; # returns 2 rows with a= NULL , instead of rows 1,2 SELECT * FROM t1; drop table t1; While this is not giving NULL which is strange # with VARCHAR (79) or blob all results are correct CREATE TABLE t1 (a blob);   INSERT INTO t1 VALUES (1),(2);   ALTER TABLE t1 ADD UNIQUE (a) using hash; # returns 2 rows with a= NULL , instead of rows 1,2 SELECT * FROM t1; drop table t1; So the field which stores the result in table->record itself is affected , while the fields which store the data pointer is not affected.

            People

              sachin.setiya.007 Sachin Setiya (Inactive)
              sachin.setiya.007 Sachin Setiya (Inactive)
              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.