mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
BUG#17152: Wrong result with BINARY comparison on aliased column
Testsuite added
This commit is contained in:
parent
a9e3092102
commit
94e556137d
2 changed files with 69 additions and 0 deletions
|
@ -3241,3 +3241,38 @@ where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
|
|||
a a
|
||||
2005-10-01 2005-10-01
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
a BIGINT(20) NOT NULL,
|
||||
PRIMARY KEY (a)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
|
||||
CREATE TABLE t2 (
|
||||
a BIGINT(20) NOT NULL,
|
||||
b VARCHAR(128) NOT NULL,
|
||||
c TEXT NOT NULL,
|
||||
PRIMARY KEY (a,b),
|
||||
KEY idx_t2_b_c (b,c(200)),
|
||||
CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1, 'bar', 'vbar');
|
||||
INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
|
||||
INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
|
||||
INSERT INTO t2 VALUES (1, 'customer_over', '1');
|
||||
SELECT * FROM t2 WHERE b = 'customer_over';
|
||||
a b c
|
||||
1 customer_over 1
|
||||
SELECT * FROM t2 WHERE BINARY b = 'customer_over';
|
||||
a b c
|
||||
1 customer_over 1
|
||||
SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
|
||||
a
|
||||
1
|
||||
/* Bang: Empty result set, above was expected: */
|
||||
SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
|
||||
a
|
||||
1
|
||||
SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
|
||||
a
|
||||
1
|
||||
drop table t2, t1;
|
||||
|
|
|
@ -2139,3 +2139,37 @@ insert into t2 values('2005-10-01');
|
|||
select * from t1, t2
|
||||
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #17152: Wrong result with BINARY comparison on aliased column
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a BIGINT(20) NOT NULL,
|
||||
PRIMARY KEY (a)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a BIGINT(20) NOT NULL,
|
||||
b VARCHAR(128) NOT NULL,
|
||||
c TEXT NOT NULL,
|
||||
PRIMARY KEY (a,b),
|
||||
KEY idx_t2_b_c (b,c(200)),
|
||||
CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1, 'bar', 'vbar');
|
||||
INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
|
||||
INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
|
||||
INSERT INTO t2 VALUES (1, 'customer_over', '1');
|
||||
|
||||
SELECT * FROM t2 WHERE b = 'customer_over';
|
||||
SELECT * FROM t2 WHERE BINARY b = 'customer_over';
|
||||
SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
|
||||
/* Bang: Empty result set, above was expected: */
|
||||
SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
|
||||
SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
|
||||
|
||||
drop table t2, t1;
|
||||
|
|
Loading…
Reference in a new issue