Skip to content

Commit

Permalink
modify case syntax about create snapshot for account. (#21025)
Browse files Browse the repository at this point in the history
modify syntax about create snapshot for account

Approved by: @heni02
  • Loading branch information
Ariznawlll authored Jan 3, 2025
1 parent 34949a2 commit 6e3b3ca
Show file tree
Hide file tree
Showing 56 changed files with 528 additions and 528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ id val
3 c
select * from mo_catalog.mo_stored_procedure;
proc_id name creator args body db definer modified_time created_time type security_type comment character_set_client collation_connection database_collation
1 test_if_hit_elseif_first_elseif null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-08-07 09:44:26 2024-08-07 09:44:26 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
2 test_if_hit_if null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-08-07 09:44:26 2024-08-07 09:44:26 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
1 test_if_hit_elseif_first_elseif null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-12-31 06:24:14 2024-12-31 06:24:14 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
2 test_if_hit_if null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-12-31 06:24:14 2024-12-31 06:24:14 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
drop database if exists udf_db2;
create database udf_db2;
use udf_db2;
Expand All @@ -232,15 +232,15 @@ language sql as
'$1 + $2';
select * from mo_catalog.mo_user_defined_function;
function_id name owner args rettype body language db definer modified_time created_time type security_type comment character_set_client collation_connection database_collation
1 addab 2 [{"name": "x", "type": "int"}, {"name": "y", "type": "int"}] int $1 + $2 sql udf_db2 test_account 2024-08-07 09:44:26 2024-08-07 09:44:26 FUNCTION DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
1 addab 2 [{"name": "x", "type": "int"}, {"name": "y", "type": "int"}] int $1 + $2 sql udf_db2 test_account 2024-12-31 06:24:14 2024-12-31 06:24:14 FUNCTION DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
drop stage if exists my_ext_stage;
create stage my_ext_stage URL='s3://load/files/';
drop stage if exists my_ext_stage1;
create stage my_ext_stage1 URL='s3://load/files/' CREDENTIALS={'AWS_KEY_ID'='1a2b3c' ,'AWS_SECRET_KEY'='4x5y6z'};
select * from mo_catalog.mo_stages;
stage_id stage_name url stage_credentials stage_status created_time comment
1 my_ext_stage s3://load/files/ disabled 2024-08-07 09:44:26
2 my_ext_stage1 s3://load/files/ AWS_KEY_ID=1a2b3c,AWS_SECRET_KEY=4x5y6z disabled 2024-08-07 09:44:26
1 my_ext_stage s3://load/files/ disabled 2024-12-31 06:24:14
2 my_ext_stage1 s3://load/files/ AWS_KEY_ID=1a2b3c,AWS_SECRET_KEY=4x5y6z disabled 2024-12-31 06:24:14
drop database if exists test01;
drop database if exists test02;
drop database if exists test03;
Expand Down Expand Up @@ -376,7 +376,7 @@ drop snapshot if exists cluster_level_snapshot;
create snapshot cluster_level_snapshot for cluster;
show snapshots;
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
cluster_level_snapshot 2024-08-07 09:44:26.651225093 cluster
cluster_level_snapshot 2024-12-31 06:24:16.087227 cluster
use db02;
alter table departments add column newcolumn int after department_id;
show create table departments;
Expand Down Expand Up @@ -454,14 +454,14 @@ drop function udf_db2.`addAB`(x int, y int);
drop stage if exists my_ext_stage;
select * from mo_catalog.mo_stages;
stage_id stage_name url stage_credentials stage_status created_time comment
2 my_ext_stage1 s3://load/files/ AWS_KEY_ID=1a2b3c,AWS_SECRET_KEY=4x5y6z disabled 2024-08-07 09:44:26
2 my_ext_stage1 s3://load/files/ AWS_KEY_ID=1a2b3c,AWS_SECRET_KEY=4x5y6z disabled 2024-12-31 06:24:14
use udf_db2;
create function `add`(x int, y int) returns int
language sql as
'$1 + $2';
select * from mo_catalog.mo_user_defined_function;
function_id name owner args rettype body language db definer modified_time created_time type security_type comment character_set_client collation_connection database_collation
2 add 2 [{"name": "x", "type": "int"}, {"name": "y", "type": "int"}] int $1 + $2 sql udf_db2 test_account 2024-08-07 09:44:26 2024-08-07 09:44:26 FUNCTION DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
2 add 2 [{"name": "x", "type": "int"}, {"name": "y", "type": "int"}] int $1 + $2 sql udf_db2 test_account 2024-12-31 06:24:16 2024-12-31 06:24:16 FUNCTION DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
drop database test01;
use test02;
select * from v01;
Expand Down Expand Up @@ -557,15 +557,15 @@ select * from repub01.pri01;
Unknown database repub01
select * from mo_catalog.mo_stored_procedure;
proc_id name creator args body db definer modified_time created_time type security_type comment character_set_client collation_connection database_collation
1 test_if_hit_elseif_first_elseif null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-08-07 09:44:26 2024-08-07 09:44:26 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
2 test_if_hit_if null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-08-07 09:44:26 2024-08-07 09:44:26 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
1 test_if_hit_elseif_first_elseif null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-12-31 06:24:14 2024-12-31 06:24:14 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
2 test_if_hit_if null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-12-31 06:24:14 2024-12-31 06:24:14 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
select * from mo_catalog.mo_stages;
stage_id stage_name url stage_credentials stage_status created_time comment
1 my_ext_stage s3://load/files/ disabled 2024-08-07 09:44:26
2 my_ext_stage1 s3://load/files/ AWS_KEY_ID=1a2b3c,AWS_SECRET_KEY=4x5y6z disabled 2024-08-07 09:44:26
1 my_ext_stage s3://load/files/ disabled 2024-12-31 06:24:14
2 my_ext_stage1 s3://load/files/ AWS_KEY_ID=1a2b3c,AWS_SECRET_KEY=4x5y6z disabled 2024-12-31 06:24:14
select * from mo_catalog.mo_user_defined_function;
function_id name owner args rettype body language db definer modified_time created_time type security_type comment character_set_client collation_connection database_collation
1 addab 2 [{"name": "x", "type": "int"}, {"name": "y", "type": "int"}] int $1 + $2 sql udf_db2 test_account 2024-07-10 07:43:56 2024-07-10 07:43:56 FUNCTION DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
1 addab 2 [{"name": "x", "type": "int"}, {"name": "y", "type": "int"}] int $1 + $2 sql udf_db2 test_account 2024-12-31 06:24:14 2024-12-31 06:24:14 FUNCTION DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
select * from test01.sales;
id sale_date amount
1 2018-12-25 100.00
Expand Down Expand Up @@ -600,8 +600,8 @@ drop database test;
drop database repub02;
select * from mo_catalog.mo_stored_procedure;
proc_id name creator args body db definer modified_time created_time type security_type comment character_set_client collation_connection database_collation
1 test_if_hit_elseif_first_elseif null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-08-07 09:44:26 2024-08-07 09:44:26 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
2 test_if_hit_if null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-08-07 09:44:26 2024-08-07 09:44:26 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
1 test_if_hit_elseif_first_elseif null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-12-31 06:24:14 2024-12-31 06:24:14 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
2 test_if_hit_if null {} begin DECLARE v1 INT; SET v1 = 5; IF v1 > 5 THEN select * from tbh1; ELSEIF v1 = 5 THEN select * from tbh2; ELSEIF v1 = 4 THEN select * from tbh2 limit 1; ELSE select * from tbh3; END IF; end procedure_test test_account 2024-12-31 06:24:14 2024-12-31 06:24:14 PROCEDURE DEFINER utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci
drop database if exists udf_db2;
drop function `addab`(x int, y int);
function addab doesn't exist
Expand Down Expand Up @@ -631,7 +631,7 @@ drop snapshot if exists cluster_level_snapshot;
create snapshot cluster_level_snapshot for cluster;
show snapshots;
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
cluster_level_snapshot 2024-08-07 09:44:29.17621458 cluster
cluster_level_snapshot 2024-12-31 06:24:33.682324 cluster
use mo_catalog;
drop table if exists t2;
create cluster table t2(a int);
Expand All @@ -656,7 +656,7 @@ drop snapshot if exists cluster_level_snapshot;
create snapshot cluster_level_snapshot for cluster;
show snapshots;
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
cluster_level_snapshot 2024-08-07 09:44:29.441979616 cluster
cluster_level_snapshot 2024-12-31 06:24:34.106923 cluster
use mo_catalog;
drop table if exists t2;
create cluster table t2(a int);
Expand All @@ -678,10 +678,10 @@ drop table if exists t1;
create cluster table t1(a int);
insert into t1 values (1,6),(2,6),(3,6);
drop snapshot if exists account_level_snapshot;
create snapshot account_level_snapshot for account sys;
create snapshot account_level_snapshot for account;
show snapshots;
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
account_level_snapshot 2024-08-07 09:44:29.684132745 account sys
account_level_snapshot 2024-12-31 06:24:34.744824 account sys
use mo_catalog;
drop table if exists t2;
create cluster table t2(a int);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ create cluster table t1(a int);
insert into t1 values (1,6),(2,6),(3,6);

drop snapshot if exists account_level_snapshot;
create snapshot account_level_snapshot for account sys;
create snapshot account_level_snapshot for account;
-- @ignore:1
show snapshots;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ performancereviewid employeeid reviewdate reviewerid
drop snapshot if exists sys_sp;
show snapshots;
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
create snapshot sys_sp for account sys;
create snapshot sys_sp for account;
show snapshots;
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
sys_sp 2024-08-20 03:03:00.682696 account sys
sys_sp 2024-12-31 06:16:14.042907 account sys
restore account sys database Company from snapshot sys_sp;
select * from Departments;
departmentid name managerid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ select * from PerformanceReviews;
drop snapshot if exists sys_sp;
-- @ignore:1
show snapshots;
create snapshot sys_sp for account sys;
create snapshot sys_sp for account;
-- @ignore:1
show snapshots;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ show snapshots;
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
account_sp 2024-06-28 06:13:04.389609 account sys
create snapshot cluster_sp for cluster;
create snapshot account_sp for account sys;
create snapshot account_sp for account;
internal error: snapshot account_sp already exists
show snapshots;
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ drop snapshot if exists cluster_sp;
-- @ignore:1
show snapshots;
create snapshot cluster_sp for cluster;
create snapshot account_sp for account sys;
create snapshot account_sp for account;
-- @ignore:1
show snapshots;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ drop database if exists test03;
create database test03;
use test03;
drop snapshot if exists sp01;
create snapshot sp01 for account sys;
create snapshot sp01 for account;
drop table if exists pri01;
create table pri01(
deptno int unsigned comment '部门编号',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ create database test03;
use test03;

drop snapshot if exists sp01;
create snapshot sp01 for account sys;
create snapshot sp01 for account;

drop table if exists pri01;
create table pri01(
Expand Down
8 changes: 4 additions & 4 deletions test/distributed/cases/snapshot/restore_fk_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ create table table04(a INT primary key AUTO_INCREMENT, b INT, c INT);
insert into table03 values (1,1,1), (2,2,2);
insert into table04 values (0,1,2), (2,3,4);
drop snapshot if exists sp01;
create snapshot sp01 for account sys;
create snapshot sp01 for account;
use test01;
drop table aff01;
drop table pri01;
Expand Down Expand Up @@ -279,7 +279,7 @@ insert into aff01 values (7900,'JAMES','CLERK',7698,'1981-12-03',950,NULL,30);
insert into aff01 values (7902,'FORD','ANALYST',7566,'1981-12-03',3000,NULL,20);
insert into aff01 values (7934,'MILLER','CLERK',7782,'1982-01-23',1300,NULL,10);
drop snapshot if exists sp03;
create snapshot sp03 for account sys;
create snapshot sp03 for account;
drop database test02;
drop database test01;
restore account sys database test02 table aff01 from snapshot sp03;
Expand Down Expand Up @@ -311,7 +311,7 @@ insert into f1 values (2,2);
insert into c1 values (2,3);
insert into c1 values (2,2);
drop snapshot if exists sp04;
create snapshot sp04 for account sys;
create snapshot sp04 for account;
insert into f1 values (3,20);
insert into f1 values (4,600);
restore account sys database test04 table f1 from snapshot sp04;
Expand Down Expand Up @@ -432,7 +432,7 @@ col1 col2 col3
1 1 1
2 2 2
drop snapshot if exists sp07;
create snapshot sp07 for account sys;
create snapshot sp07 for account;
insert into foreign01 values(3, '323214321321', 32, 1);
insert into foreign02 values(3,2,10);
restore account sys database test07 table foreign02 from snapshot sp07;
Expand Down
8 changes: 4 additions & 4 deletions test/distributed/cases/snapshot/restore_fk_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ insert into table03 values (1,1,1), (2,2,2);
insert into table04 values (0,1,2), (2,3,4);

drop snapshot if exists sp01;
create snapshot sp01 for account sys;
create snapshot sp01 for account;

use test01;
drop table aff01;
Expand Down Expand Up @@ -240,7 +240,7 @@ insert into aff01 values (7902,'FORD','ANALYST',7566,'1981-12-03',3000,NULL,20);
insert into aff01 values (7934,'MILLER','CLERK',7782,'1982-01-23',1300,NULL,10);

drop snapshot if exists sp03;
create snapshot sp03 for account sys;
create snapshot sp03 for account;

drop database test02;
drop database test01;
Expand Down Expand Up @@ -271,7 +271,7 @@ insert into c1 values (2,3);
insert into c1 values (2,2);

drop snapshot if exists sp04;
create snapshot sp04 for account sys;
create snapshot sp04 for account;

insert into f1 values (3,20);
insert into f1 values (4,600);
Expand Down Expand Up @@ -391,7 +391,7 @@ select * from foreign01;
select * from foreign02;

drop snapshot if exists sp07;
create snapshot sp07 for account sys;
create snapshot sp07 for account;

insert into foreign01 values(3, '323214321321', 32, 1);
insert into foreign02 values(3,2,10);
Expand Down
Loading

0 comments on commit 6e3b3ca

Please sign in to comment.