[MDEV-18922] Alter on long unique varchar column makes result null Created: 2019-03-14  Updated: 2019-03-22  Resolved: 2019-03-17

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.4.3
Fix Version/s: 10.4.4

Type: Bug Priority: Blocker
Reporter: Sachin Setiya (Inactive) Assignee: Sachin Setiya (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

All


Issue Links:
PartOf
is part of MDEV-18901 Wrong results after ADD UNIQUE INDEX(... Closed
Problem/Incident
causes MDEV-18941 HEAP index is no longer used Closed
is caused by MDEV-371 Unique indexes for blobs Closed

 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;
              



 Comments   
Comment by Sachin Setiya (Inactive) [ 2019-03-14 ]

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.

Generated at Thu Feb 08 08:47:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.