Commit 1118b66a authored by Anel Husakovic's avatar Anel Husakovic Committed by anel

MDEV-23626: CONNECT VIR tables return inconsistent error for UPDATE

- Before the patch UPDATE error message for VIR tables was different from TRUNCATE,UPDATE,DELETE
Reviewed by: <Olivier Bertrand>, vicentiu@mariadb.org
parent c62843a0
......@@ -297,6 +297,13 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
PTDB utp;
if (!(utp = tdbp->Duplicate(g))) {
/* If table type is of type virtual retrieve global parameter as it was.*/
if (tdbp->GetAmType() == TYPE_AM_VIR) {
if (tdbp->OpenDB(g)) {
printf("%s\n", g->Message);
throw 7;
}
}
sprintf(g->Message, MSG(INV_UPDT_TABLE), tdbp->GetName());
throw 4;
} // endif tp
......
......@@ -16,3 +16,17 @@ SELECT * FROM t1;
a
10
DROP TABLE t1;
#
# MDEV-23626: CONNECT VIR tables return inconsistent error for UPDATE
#
CREATE TABLE numbers
ENGINE=CONNECT,
TABLE_TYPE=VIR,
BLOCK_SIZE=3;
TRUNCATE TABLE numbers;
ERROR HY000: Got error 174 'Virtual tables are read only' from CONNECT
DELETE FROM numbers WHERE n = 1;
ERROR HY000: Got error 174 'Virtual tables are read only' from CONNECT
UPDATE numbers SET n = 10 WHERE n = 1;
ERROR HY000: Got error 174 'Virtual tables are read only' from CONNECT
DROP TABLE numbers;
......@@ -14,3 +14,20 @@ SELECT * FROM t1;
ALTER TABLE t1 TABLE_TYPE=NON_EXISTING;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-23626: CONNECT VIR tables return inconsistent error for UPDATE
--echo #
CREATE TABLE numbers
ENGINE=CONNECT,
TABLE_TYPE=VIR,
BLOCK_SIZE=3;
--error ER_GET_ERRMSG
TRUNCATE TABLE numbers;
--error ER_GET_ERRMSG
DELETE FROM numbers WHERE n = 1;
--error ER_GET_ERRMSG
UPDATE numbers SET n = 10 WHERE n = 1;
DROP TABLE numbers;
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