Commit 6c973be2 authored by Anel Husakovic's avatar Anel Husakovic Committed by Andrew Hutchings

MDEV-28299: Server crashes in XINDXS::Range/CntIndexRange (Connect engine)

- Bug happens only in case when the range function on empty key single
column index (XINDEXS) is used.
- Solution is to return with empty result in this scenario.

Reviewed by: <>
parent 9a95838a
......@@ -139,3 +139,39 @@ DELETE FROM t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
#
# MDEV-28299: Server crashes in
# XINDXS::Range/CntIndexRange (Connect engine)
#
CREATE TABLE t1 ( a int not null, KEY (a))engine=CONNECT;
Warnings:
Warning 1105 No table_type. Will be set to DOS
Warning 1105 No file name. Table will use t1.dos
SELECT * FROM t1 WHERE a=1;
a
INSERT INTO t1 values (1),(2),(1);
SELECT * FROM t1 WHERE a=1;
a
1
1
DROP TABLE t1;
CREATE TABLE t1 (a int, b int, pk int, PRIMARY KEY (pk)) engine=CONNECT;
Warnings:
Warning 1105 No table_type. Will be set to DOS
Warning 1105 No file name. Table will use t1.dos
SELECT x.a
FROM t1 AS x JOIN t1 AS y ON (x.a = y.b)
WHERE x.pk > 3;
a
INSERT INTO t1 values (1,2,1),(2,1,2),(1,2,3),(3,4,4);
SELECT x.a
FROM t1 AS x JOIN t1 AS y ON (x.a = y.b)
WHERE x.pk > 3;
a
INSERT INTO t1 values (1,2,5);
SELECT x.a
FROM t1 AS x JOIN t1 AS y ON (x.a = y.b)
WHERE x.pk > 3;
a
1
DROP TABLE t1;
......@@ -84,3 +84,29 @@ DROP TABLE t3;
--remove_file $MYSQLD_DATADIR/test/emp.txt
--remove_file $MYSQLD_DATADIR/test/sexe.csv
--remove_file $MYSQLD_DATADIR/test/sitmat.csv
--echo #
--echo # MDEV-28299: Server crashes in
--echo # XINDXS::Range/CntIndexRange (Connect engine)
--echo #
CREATE TABLE t1 ( a int not null, KEY (a))engine=CONNECT;
SELECT * FROM t1 WHERE a=1;
INSERT INTO t1 values (1),(2),(1);
SELECT * FROM t1 WHERE a=1;
DROP TABLE t1;
CREATE TABLE t1 (a int, b int, pk int, PRIMARY KEY (pk)) engine=CONNECT;
SELECT x.a
FROM t1 AS x JOIN t1 AS y ON (x.a = y.b)
WHERE x.pk > 3;
INSERT INTO t1 values (1,2,1),(2,1,2),(1,2,3),(3,4,4);
SELECT x.a
FROM t1 AS x JOIN t1 AS y ON (x.a = y.b)
WHERE x.pk > 3;
INSERT INTO t1 values (1,2,5);
SELECT x.a
FROM t1 AS x JOIN t1 AS y ON (x.a = y.b)
WHERE x.pk > 3;
DROP TABLE t1;
......@@ -2028,6 +2028,10 @@ int XINDXS::Range(PGLOBAL g, int limit, bool incl)
PXCOL kp = To_KeyCol;
OPVAL op = Op;
// In case single column index doesn't exist return
if (!kp)
return 0;
switch (limit) {
case 1: Op = (incl) ? OP_GE : OP_GT; break;
case 2: Op = (incl) ? OP_GT : OP_GE; break;
......
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