Commit 282c6ce8 authored by unknown's avatar unknown

BUG#17152: Wrong result with BINARY comparison on aliased column

  Testsuite added
parent 11621d2f
......@@ -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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment