Skip to content
Snippets Groups Projects
Unverified Commit 23949be1 authored by iamlinjunhong's avatar iamlinjunhong Committed by GitHub
Browse files

fix drop view bug and keyword 'account' (#4725)

Approved by: @aunjgr, @aressu1985, @ouyuanning
parent 750a8856
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -6819,8 +6819,7 @@ reserved_table_id:
| reserved_keyword
reserved_keyword:
ACCOUNT
| ADD
ADD
| ALL
| AND
| AS
......@@ -6982,7 +6981,8 @@ reserved_keyword:
| SECONDARY
non_reserved_keyword:
AGAINST
ACCOUNT
| AGAINST
| AVG_ROW_LENGTH
| AUTO_RANDOM
| ACTION
......
......@@ -388,8 +388,12 @@ func buildDropTable(stmt *tree.DropTable, ctx CompilerContext) (*Plan, error) {
break
}
}
if isView {
if isView && !dropTable.IfExists {
// drop table v0, v0 is view
return nil, errors.New("", fmt.Sprintf("table %s is not exists", dropTable.Table))
} else if isView {
// drop table if exists v0, v0 is view
dropTable.Table = ""
}
}
......
......@@ -13,4 +13,5 @@ create table table16 (1a20 int,1e int);
create table $table18 (a$1 int, $b int, c$ int);
create table table19$ (a int);
create table table17 (`index` int);
create table account(a int);
show tables;
......@@ -23,4 +23,10 @@ create view v2 as select 'a';
show create view v2;
show create table v2;
drop view v1;
drop view v2;
\ No newline at end of file
drop view v2;
create table tt(a int);
create view vv as select * from tt;
drop table if exists tt;
drop table if exists vv;
drop view vv;
\ No newline at end of file
......@@ -13,6 +13,7 @@ create table table16 (1a20 int,1e int);
create table $table18 (a$1 int, $b int, c$ int);
create table table19$ (a int);
create table table17 (`index` int);
create table account(a int);
show tables;
tables_in_create_table
table01
......@@ -30,3 +31,4 @@ table16
$table18
table19$
table17
account
......@@ -41,4 +41,10 @@ show create table v2;
View Create View
v2 create view v2 as select 'a';
drop view v1;
drop view v2;
\ No newline at end of file
drop view v2;
create table tt(a int);
create view vv as select * from tt;
drop table if exists tt;
drop table if exists vv;
drop view vv;
\ No newline at end of file
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