1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT

ER_CHECK_NO_SUCH_TABLE was raised because a view does not have
the corresponding TABLE instance connected to TABLE_LIST and the
server interprets the absence as the absence of the table itself.

To fix the problem, we add a check to ensure that the target table
to be swapped with a partition is not a view.

Reviewed by: Nayuta Yanagisawa
This commit is contained in:
Masashi Tomooka
2022-05-30 19:28:44 +09:00
committed by GitHub
parent c4e87cb22c
commit f7137a619f
3 changed files with 33 additions and 2 deletions

View File

@ -16,7 +16,19 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
CREATE TABLE t1 (a int);
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
--error ER_CHECK_NO_SUCH_TABLE
--error ER_WRONG_OBJECT
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT
--echo #
CREATE TABLE t1 (a int)
PARTITION BY HASH (a)
PARTITIONS 2;
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
--error ER_WRONG_OBJECT
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1;
DROP VIEW v1;
DROP TABLE t1;