Commit 4c6e8fc5 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results

disallow descending indexes in connect
parent ae8600d5
......@@ -1812,6 +1812,12 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s)
pn= (char*)kp.key_part[k].field->field_name.str;
name= PlugDup(g, pn);
if (kp.key_part[k].key_part_flag & HA_REVERSE_SORT)
{
strcpy(g->Message, "Descending indexes are not supported");
xdp->Invalid= true;
}
// Allocate the key part description block
kpp= new(g) KPARTDEF(name, k + 1);
kpp->SetKlen(kp.key_part[k].length);
......@@ -6944,6 +6950,9 @@ int ha_connect::create(const char *name, TABLE *table_arg,
strcpy(g->Message, "Compressed tables are not indexable");
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_UNSUPPORTED;
} else if (xdp->Invalid) {
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_UNSUPPORTED;
} else if (GetIndexType(type) == 1) {
PDBUSER dup= PlgGetUser(g);
PCATLG cat= (dup) ? dup->Catalog : NULL;
......
......@@ -139,3 +139,12 @@ DELETE FROM t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
#
# MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results
#
CREATE TABLE t1 (
id INT,
f VARCHAR(32),
PRIMARY KEY (id DESC)
) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='emp.txt';
ERROR HY000: Descending indexes are not supported
......@@ -78,6 +78,16 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
--echo #
--echo # MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results
--echo #
--error ER_UNKNOWN_ERROR
CREATE TABLE t1 (
id INT,
f VARCHAR(32),
PRIMARY KEY (id DESC)
) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='emp.txt';
#
# Clean up
#
......
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