diff options
author | Anel Husakovic <anel@mariadb.org> | 2020-09-08 00:01:09 +0200 |
---|---|---|
committer | Anel Husakovic <anel@mariadb.org> | 2020-09-08 00:01:09 +0200 |
commit | d736d26d6a6991a94c4ce974ffd6d9b4077d03c5 (patch) | |
tree | 71fb7cf662c1e830252aa85d7fb57aee38abd34c | |
parent | ea7d7d39e25b2a6551c38f16321dc1dc264e8cd9 (diff) | |
download | mariadb-git-bb-10.4-anel-MDEV-23626-connect.tar.gz |
MDEV-23626: CONNECT VIR tables return inconsistent error for UPDATEbb-10.4-anel-MDEV-23626-connect
-rw-r--r-- | storage/connect/connect.cc | 7 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/general.result | 14 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/general.test | 17 |
3 files changed, 38 insertions, 0 deletions
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index 3b58e8b5a8f..fa59d2f36a2 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -298,6 +298,13 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, PTDBASE utp; if (!(utp = (PTDBASE)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 diff --git a/storage/connect/mysql-test/connect/r/general.result b/storage/connect/mysql-test/connect/r/general.result index ed2c903145d..ef023b7c8d9 100644 --- a/storage/connect/mysql-test/connect/r/general.result +++ b/storage/connect/mysql-test/connect/r/general.result @@ -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; diff --git a/storage/connect/mysql-test/connect/t/general.test b/storage/connect/mysql-test/connect/t/general.test index 34e5d4c7b6d..8716f188baa 100644 --- a/storage/connect/mysql-test/connect/t/general.test +++ b/storage/connect/mysql-test/connect/t/general.test @@ -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 1296 +TRUNCATE TABLE numbers; +--error 1296 +DELETE FROM numbers WHERE n = 1; +--error 1296 +UPDATE numbers SET n = 10 WHERE n = 1; +DROP TABLE numbers; |