Skip to content

[Bug]: table does not exists when clone database. #22363

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

162c538

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

Image

Expected Behavior

No response

Steps to Reproduce

drop account if exists acc05;
create account acc05 admin_name = 'test_account' identified by '111';
-- @session:id=5&user=acc05:test_account&password=111
drop database if exists test12;
create database test12;
use test12;
drop table if exists t1;
create table t1 (
    a bigint not null,
    b bigint not null default 0,
    c bigint not null default 0,
    d bigint not null default 0,
    e bigint not null default 0,
    f bigint not null default 0,
    g bigint not null default 0,
    h bigint not null default 0,
    i bigint not null default 0,
    j bigint not null default 0,
    primary key (a));
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
drop table if exists bit01;
create table bit01(id char(1), b binary(10));
insert into bit01 values('a', '111');
insert into bit01 values('a', '110');
insert into bit01 values('a', '143');
insert into bit01 values('a', '000');
insert into bit01 values('b', '001');
insert into bit01 values('b', '011');
insert into bit01 values('c', '010');
insert into bit01 values('d', null);
select * from bit01;
drop table if exists time01;
create table time01 (a datetime(0) not null, primary key(a));
insert into time01 values ('20200101000000'), ('2022-01-02'), ('2022-01-02 00:00:01'), ('2022-01-02 00:00:01.512345');
drop table if exists double01;
create table double01 (a double not null, primary key(a));
insert into double01 values(-1.7976931348623157E+308),(-2.2250738585072014E-308),(0),(2.2250738585072014E-308),(1.7976931348623157E+308);
drop table if exists tinyint01;
create table tinyint01 (a tinyint unsigned not null, primary key(a));
insert into tinyint01 values (255), (0xFC), (254), (253);

SET experimental_hnsw_index = 1;
drop database if exists test13;
create database test13;
use test13;
drop table if exists vector_index_09;
create table vector_index_09(a bigint primary key, b vecf32(128),c int,key c_k(c));
create index idx01 using hnsw on vector_index_09(b) op_type "vector_l2_ops";
insert into vector_index_09 values(9774 ,NULL,3),(9775,NULL,10);
insert into vector_index_09(a,c) values(9777,4),(9778,9);
drop table if exists vector_ip_01;
create table vector_ip_01(a bigint primary key, b vecf32(128), c int, key c_k(c));
insert into vector_ip_01 values(9774 ,normalize_l2("[1, 0, 1, 6, 6, 17, 47, 39, 2, 0, 1, 25, 27, 10, 56, 130, 18, 5, 2, 6, 15, 2, 19, 130, 42, 28, 1, 1, 2, 1, 0, 5, 0, 2, 4, 4, 31, 34, 44, 35, 9, 3, 8, 11, 33, 12, 61, 130, 130, 17, 0, 1, 6, 2, 9, 130, 111, 36, 0, 0, 11, 9, 1, 12, 2, 100, 130, 28, 7, 2, 6, 7, 9, 27, 130, 83, 5, 0, 1, 18, 130, 130, 84, 9, 0, 0, 2, 24, 111, 24, 0, 1, 37, 24, 2, 10, 12, 62, 33, 3, 0, 0, 0, 1, 3, 16, 106, 28, 0, 0, 0, 0, 17, 46, 85, 10, 0, 0, 1, 4, 11, 4, 2, 2, 9, 14, 8, 8]"),3),(9775,normalize_l2("[0, 1, 1, 3, 0, 3, 46, 20, 1, 4, 17, 9, 1, 17, 108, 15, 0, 3, 37, 17, 6, 15, 116, 16, 6, 1, 4, 7, 7, 7, 9, 6, 0, 8, 10, 4, 26, 129, 27, 9, 0, 0, 5, 2, 11, 129, 129, 12, 103, 4, 0, 0, 2, 31, 129, 129, 94, 4, 0, 0, 0, 3, 13, 42, 0, 15, 38, 2, 70, 129, 1, 0, 5, 10, 40, 12, 74, 129, 6, 1, 129, 39, 6, 1, 2, 22, 9, 33, 122, 13, 0, 0, 0, 0, 5, 23, 4, 11, 9, 12, 45, 38, 1, 0, 0, 4, 36, 38, 57, 32, 0, 0, 82, 22, 9, 5, 13, 11, 3, 94, 35, 3, 0, 0, 0, 1, 16, 97]"),5),(9776,normalize_l2("[10, 3, 8, 5, 48, 26, 5, 16, 17, 0, 0, 2, 132, 53, 1, 16, 112, 6, 0, 0, 7, 2, 1, 48, 48, 15, 18, 31, 3, 0, 0, 9, 6, 10, 19, 27, 50, 46, 17, 9, 18, 1, 4, 48, 132, 23, 3, 5, 132, 9, 4, 3, 11, 0, 2, 46, 84, 12, 10, 10, 1, 0, 12, 76, 26, 22, 16, 26, 35, 15, 3, 16, 15, 1, 51, 132, 125, 8, 1, 2, 132, 51, 67, 91, 8, 0, 0, 30, 126, 39, 32, 38, 4, 0, 1, 12, 24, 2, 2, 2, 4, 7, 2, 19, 93, 19, 70, 92, 2, 3, 1, 21, 36, 58, 132, 94, 0, 0, 0, 0, 21, 25, 57, 48, 1, 0, 0, 1]"),3);
insert into vector_ip_01 values(9777, normalize_l2("[16, 15, 0, 0, 5, 46, 5, 5, 4, 0, 0, 0, 28, 118, 12, 5, 75, 44, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13]"),4),(9778,normalize_l2("[41, 0, 0, 7, 1, 1, 20, 67, 9, 0, 0, 0, 0, 31, 120, 61, 25, 0, 0, 0, 0, 10, 120, 90, 32, 0, 0, 1, 13, 11, 22, 50, 4, 0, 2, 93, 40, 15, 37, 18, 12, 2, 2, 19, 8, 44, 120, 25, 120, 5, 0, 0, 0, 2, 48, 97, 102, 14, 3, 3, 11, 9, 34, 41, 0, 0, 4, 120, 56, 3, 4, 5, 6, 15, 37, 116, 28, 0, 0, 3, 120, 120, 24, 6, 2, 0, 1, 28, 53, 90, 51, 11, 11, 2, 12, 14, 8, 6, 4, 30, 9, 1, 4, 22, 25, 79, 120, 66, 5, 0, 0, 6, 42, 120, 91, 43, 15, 2, 4, 39, 12, 9, 9, 12, 15, 5, 24, 36]"),4);
create index idx01 using hnsw on vector_ip_01(b) op_type "vector_ip_ops";
show create table vector_ip_01;

drop database if exists test14;
create database test14;
use test14;
drop table if exists index03;
create table index03 (
                         emp_no      int             not null,
                         birth_date  date            not null,
                         first_name  varchar(14)     not null,
                         last_name   varchar(16)     not null,
                         gender      varchar(5)      not null,
                         hire_date   date            not null,
                         primary key (emp_no)
) partition by range columns (emp_no)(
    partition p01 values less than (100001),
    partition p02 values less than (200001),
    partition p03 values less than (300001),
    partition p04 values less than (400001)
);
insert into index03 values (9001,'1980-12-17', 'SMITH', 'CLERK', 'F', '2008-12-17'),
                           (9002,'1981-02-20', 'ALLEN', 'SALESMAN', 'F', '2008-02-20'),
                           (9003,'1991-02-20', 'Bob', 'TEACHER', 'M', '2008-02-20'),
                           (9004,'1999-02-20', 'MARY', 'PROGRAMMER', 'M', '2008-02-20');
select * from index03;

drop database if exists test15;
create database test15;
use test15;
drop table if exists departments;
create table departments (
                             department_id INT primary key auto_increment,
                             department_name varchar(100)
);
show create table departments;
insert into departments (department_id, department_name)
values (1, 'HR'),(2, 'Engineering');
drop table if exists employees;
create table employees (
                           employee_id INT primary key,
                           first_name varchar(50),
                           last_name varchar(50),
                           department_id INT,
                           FOREIGN KEY (department_id) REFERENCES departments(department_id)
);
insert into employees values
                          (1, 'John', 'Doe', 1),
                          (2, 'Jane', 'Smith', 2),
                          (3, 'Bob', 'Johnson', 1);
drop view if exists employee_view;
create view employee_view as select employee_id, first_name, last_name, department_id from employees;

drop database if exists test12_new;
drop database if exists test13_new;
drop database if exists test14_new;
drop database if exists test15_new;

create database test12_new clone test12;
create database test13_new clone test13;
use test12_new;
drop table t1;
drop table bit01;
drop database if exists test12_new_new;
drop database if exists test13_new_new;
drop database if exists test14_new_new;
drop database if exists test15_new_new;
create database test12_new_new clone test12_new;
create database test13_new_new clone test13_new;
use test12_new_new;
show tables;
select * from double01;
show create table time01;
select * from tinyint01;
create database test14_new clone test14;
create database test15_new clone test15;
drop database test14;
use test15_new;
drop table employees;
create database test14_new_new clone test14_new;
create database test15_new_new clone test15_new;   -->报错

Additional information

No response

Activity

  1. added this to the MO-2508 milestone on Aug 18, 2025
  2. added theissue type on Aug 18, 2025
  3. added
    kind/bug
    size/S
    severity/s0
    on Aug 18, 2025
  4. gouhongshen commented on Aug 19, 2025

    @gouhongshen
    Contributor

    drop table 时,没有 drop view 导致 clone db 时 新建 view 报错。

    需要确定 drop table 时是否同时删除 view。

  5. gouhongshen commented on Dec 31, 2025

    @gouhongshen
    Contributor

    暂时和MySQL行为一致:drop table 时不D drop view,后续遇到无主 view 直接报错。

  6. ghost added a commit that references this issue on Jan 6, 2026
  7. matrix-meow commented on Jan 7, 2026

    @matrix-meow
    Contributor

    Hello @Ariznawlll. The bug issue in the BVT test code has not been removed,issues automatically open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0size/S

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions