diff --git a/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0132 b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0132 new file mode 100644 index 0000000000000000000000000000000000000000..e38d4cfab23700246d31f9fe6b834c66c448ad6f --- /dev/null +++ b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0132 @@ -0,0 +1,145 @@ +-- @testpoint: 反引号测试用例 +-- 验证反引号在锁中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +SQL SUCCESS +-- 创建表 +CREATE TABLE ` t_opengauss_fanyinhao_case0132_1` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE t_opengauss_fanyinhao_case0132_2 (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `t_opengauss_fanyinhao_ case0132_3` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE t_opengauss_fanyinhao_case0132_4 (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `1` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `t_opengauss_fanyinhao_case0132_5我` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `t_opengauss_fanyinhao_case0132_6` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `t_opengauss_fanyinhao_case0132_7$` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `t_opengauss_fanyinhao_case0132_8` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `t_opengauss_fanyinhao_case0132_9,` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `t_opengauss_fanyinhao_case0132_10@` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `int` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `$` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `_` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `我` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE `t_opengauss_fanyinhao_""case0132_11` (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +CREATE TABLE t_opengauss_fanyinhao_case0132_12 (a1 INT,a2 INT,a3 INT); +SQL SUCCESS +-- 开启事物 +START TRANSACTION; +SQL SUCCESS +LOCK TABLE ` t_opengauss_fanyinhao_case0132_1` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE t_opengauss_fanyinhao_case0132_2 IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `t_opengauss_fanyinhao_ case0132_3` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE t_opengauss_fanyinhao_case0132_4 IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `1` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `t_opengauss_fanyinhao_case0132_5我` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `t_opengauss_fanyinhao_case0132_6` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `t_opengauss_fanyinhao_case0132_7$` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `t_opengauss_fanyinhao_case0132_8` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `t_opengauss_fanyinhao_case0132_9,` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `t_opengauss_fanyinhao_case0132_10@` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `int` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `$` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `_` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `我` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +LOCK TABLE `t_opengauss_fanyinhao_""case0132_11` IN SHARE ROW EXCLUSIVE MODE; +SQL SUCCESS +-- 提交 +COMMIT; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING ` t_opengauss_fanyinhao_case0132_1` ON (t_opengauss_fanyinhao_case0132_12.a1 =` t_opengauss_fanyinhao_case0132_1`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=` t_opengauss_fanyinhao_case0132_1`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING t_opengauss_fanyinhao_case0132_2 ON (t_opengauss_fanyinhao_case0132_12.a1 =t_opengauss_fanyinhao_case0132_2.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=t_opengauss_fanyinhao_case0132_2.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_ case0132_3` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_ case0132_3`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_ case0132_3`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING t_opengauss_fanyinhao_case0132_4 ON (t_opengauss_fanyinhao_case0132_12.a1 =t_opengauss_fanyinhao_case0132_4.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=t_opengauss_fanyinhao_case0132_4.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `1` ON (t_opengauss_fanyinhao_case0132_12.a1 =`1`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`1`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_5我` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_5我`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_5我`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_6` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_6`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_6`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_7$` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_7$`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_7$`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_8` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_8`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_8`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_9,` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_9,`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_9,`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_10@` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_10@`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_10@`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `int` ON (t_opengauss_fanyinhao_case0132_12.a1 =`int`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`int`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `$` ON (t_opengauss_fanyinhao_case0132_12.a1 =`$`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`$`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `_` ON (t_opengauss_fanyinhao_case0132_12.a1 =`_`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`_`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `我` ON (t_opengauss_fanyinhao_case0132_12.a1 =`我`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`我`.a2; +SQL SUCCESS +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_""case0132_11` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_""case0132_11`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_""case0132_11`.a2; +SQL SUCCESS +-- 清理环境 +DROP TABLE ` t_opengauss_fanyinhao_case0132_1`; +SQL SUCCESS +DROP TABLE t_opengauss_fanyinhao_case0132_2; +SQL SUCCESS +DROP TABLE `t_opengauss_fanyinhao_ case0132_3`; +SQL SUCCESS +DROP TABLE t_opengauss_fanyinhao_case0132_4; +SQL SUCCESS +DROP TABLE `1`; +SQL SUCCESS +DROP TABLE `t_opengauss_fanyinhao_case0132_5我`; +SQL SUCCESS +DROP TABLE `t_opengauss_fanyinhao_case0132_6`; +SQL SUCCESS +DROP TABLE `t_opengauss_fanyinhao_case0132_7$`; +SQL SUCCESS +DROP TABLE `t_opengauss_fanyinhao_case0132_8`; +SQL SUCCESS +DROP TABLE `t_opengauss_fanyinhao_case0132_9,`; +SQL SUCCESS +DROP TABLE `t_opengauss_fanyinhao_case0132_10@`; +SQL SUCCESS +DROP TABLE `int`; +SQL SUCCESS +DROP TABLE `$`; +SQL SUCCESS +DROP TABLE `_`; +SQL SUCCESS +DROP TABLE `我`; +SQL SUCCESS +DROP TABLE `t_opengauss_fanyinhao_""case0132_11`; +SQL SUCCESS +DROP TABLE t_opengauss_fanyinhao_case0132_12; +SQL SUCCESS diff --git a/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0133 b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0133 new file mode 100644 index 0000000000000000000000000000000000000000..945d809d8fcf743d7bf3c84051903bd95bd10be0 --- /dev/null +++ b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0133 @@ -0,0 +1,121 @@ +-- @t_opengauss_fanyinhao_case0133_1point: 反引号测试用例 +-- 验证反引号在创建保存点以及删除保存点中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +SQL SUCCESS +-- 清理环境 +DROP TABLE IF EXISTS t_opengauss_fanyinhao_case0133_1; +SQL SUCCESS +-- 新建表 +CREATE TABLE t_opengauss_fanyinhao_case0133_1(a int,b int); +SQL SUCCESS +--开启事务 +START TRANSACTION; +SQL SUCCESS +--插入数据 +insert into t_opengauss_fanyinhao_case0133_1 set a=1; +SQL SUCCESS +SAVEPOINT ` sp_opengauss_fanyinhao_case0133_1`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=2; +SQL SUCCESS +SAVEPOINT sp_opengauss_fanyinhao_case0133_2; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=3; +SQL SUCCESS +SAVEPOINT `sp_opengauss_fanyinhao_ case0133_3`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=4; +SQL SUCCESS +SAVEPOINT sp_opengauss_fanyinhao_case0133_4; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=5; +SQL SUCCESS +SAVEPOINT `1`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=6; +SQL SUCCESS +SAVEPOINT `sp_opengauss_fanyinhao_case0133_5我`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=7; +SQL SUCCESS +SAVEPOINT `sp_opengauss_fanyinhao_case0133_6`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=8; +SQL SUCCESS +SAVEPOINT `sp_opengauss_fanyinhao_case0133_7$`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=9; +SQL SUCCESS +SAVEPOINT `sp_opengauss_fanyinhao_case0133_8`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=10; +SQL SUCCESS +SAVEPOINT `sp_opengauss_fanyinhao_case0133_9,`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=11; +SQL SUCCESS +SAVEPOINT `sp_opengauss_fanyinhao_case0133_10@`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=12; +SQL SUCCESS +SAVEPOINT `int`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=13; +SQL SUCCESS +SAVEPOINT `$`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=14; +SQL SUCCESS +SAVEPOINT `_`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=15; +SQL SUCCESS +SAVEPOINT `我`; +SQL SUCCESS +insert into t_opengauss_fanyinhao_case0133_1 set a=16; +SQL SUCCESS +SAVEPOINT `sp_opengauss_fanyinhao_""case0133_11`; +SQL SUCCESS +-- 回滚保存点 +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_""case0133_11`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `我`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `_`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `$`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `int`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_10@`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_9,`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_8`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_7$`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_6`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_5我`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `1`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT sp_opengauss_fanyinhao_case0133_4; +SQL SUCCESS +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_ case0133_3`; +SQL SUCCESS +ROLLBACK TO SAVEPOINT sp_opengauss_fanyinhao_case0133_2; +SQL SUCCESS +ROLLBACK TO SAVEPOINT ` sp_opengauss_fanyinhao_case0133_1`; +SQL SUCCESS +-- 删除保存点 +RELEASE SAVEPOINT ` sp_opengauss_fanyinhao_case0133_1`; +SQL SUCCESS +-- 提交 +COMMIT; +SQL SUCCESS +--删除表 +DROP TABLE t_opengauss_fanyinhao_case0133_1 CASCADE; +SQL SUCCESS diff --git a/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0134 b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0134 new file mode 100644 index 0000000000000000000000000000000000000000..d582ff135bf1941d8728adba12bcd99591de9654 --- /dev/null +++ b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0134 @@ -0,0 +1,45 @@ +-- @testpoint: 反引号测试用例 +-- 验证反引号在查看数据中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +SQL SUCCESS +-- 新建表 +CREATE TABLE t_opengauss_fanyinhao_case0134_1( +` v` INT , V INT , `v v` INT, v1 INT , `1` INT , `我aa` INT , `v2` INT , `v$` INT , `v_` INT , `v,` INT ,`v@` INT , `int` INT , `$` INT , `_` INT , `我` INT , `t""t` INT ); +SQL SUCCESS +-- 插入数据 +INSERT INTO t_opengauss_fanyinhao_case0134_1 SET ` v` =1 , v =1 , `v v` =1, v1 =1 , `1` =1 , `我aa` =1 , `v2` =1 , `v$` =1 , `v_` =1 , `v,` =1 ,`int` =1 , `v@` =1 , `$` =1 , `_` =1 , `我` =1 , `t""t` =1 ; +SQL SUCCESS +INSERT INTO t_opengauss_fanyinhao_case0134_1 SET ` v` =2 , v =2 , `v v` =1, v1 =1 , `1` =1 , `我aa` =1 , `v2` =1 , `v$` =1 , `v_` =1 , `v,` =1 ,`int` =1 , `v@` =1 , `$` =1 , `_` =1 , `我` =1 , `t""t` =1 ; +SQL SUCCESS +INSERT INTO t_opengauss_fanyinhao_case0134_1(` v`,V,`v v`) VALUES(1,1,1); +SQL SUCCESS +INSERT INTO t_opengauss_fanyinhao_case0134_1(` v`,V,`v v`,`我aa`,`t""t`) VALUES(1,1,1,1,1); +SQL SUCCESS +-- 创建视图 +CREATE VIEW v_opengauss_fanyinhao_case0134_1 AS SELECT * FROM t_opengauss_fanyinhao_case0134_1; +SQL SUCCESS +-- 查看数据 +SELECT ` v`, V, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`, `_`, `我`, `t""t` FROM t_opengauss_fanyinhao_case0134_1; ++----+---+-----+----+---+-----+----+----+----+----+----+-----+---+---+---+------+ +| v | V | v v | v1 | 1 | 我aa | v2 | v$ | v_ | v, | v@ | int | $ | _ | 我 | t""t | ++----+---+-----+----+---+-----+----+----+----+----+----+-----+---+---+---+------+ +| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | +| 2 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | +| 1 | 1 | 1 | | | | | | | | | | | | | | +| 1 | 1 | 1 | | | 1 | | | | | | | | | | 1 | ++----+---+-----+----+---+-----+----+----+----+----+----+-----+---+---+---+------+ +SELECT ` v`, v, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`, `_`, `我`, `t""t` FROM v_opengauss_fanyinhao_case0134_1; ++----+---+-----+----+---+-----+----+----+----+----+----+-----+---+---+---+------+ +| v | v | v v | v1 | 1 | 我aa | v2 | v$ | v_ | v, | v@ | int | $ | _ | 我 | t""t | ++----+---+-----+----+---+-----+----+----+----+----+----+-----+---+---+---+------+ +| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | +| 2 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | +| 1 | 1 | 1 | | | | | | | | | | | | | | +| 1 | 1 | 1 | | | 1 | | | | | | | | | | 1 | ++----+---+-----+----+---+-----+----+----+----+----+----+-----+---+---+---+------+ +-- 清理环境 +DROP VIEW v_opengauss_fanyinhao_case0134_1; +SQL SUCCESS +DROP TABLE t_opengauss_fanyinhao_case0134_1 CASCADE; +SQL SUCCESS diff --git a/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0135 b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0135 new file mode 100644 index 0000000000000000000000000000000000000000..1aba206f4668a6644f4249cca66ec998e0c9587c --- /dev/null +++ b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0135 @@ -0,0 +1,89 @@ +-- @testpoint: 反引号测试用例 +-- 验证反引号在执行操作符中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +SQL SUCCESS +SELECT bit_length('world') AS ` v`; ++----+ +| v | ++----+ +| 40 | ++----+ +SELECT btrim('sring' , 'ing') AS v; ++----+ +| v | ++----+ +| sr | ++----+ +SELECT char_length('hello') AS `v v`; ++-----+ +| v v | ++-----+ +| 5 | ++-----+ +SELECT instr( 'abcdabcdabcd', 'bcd', 2, 2 ) AS v1; ++----+ +| v1 | ++----+ +| 6 | ++----+ +SELECT lengthb('hello') AS `1`; ++---+ +| 1 | ++---+ +| 5 | ++---+ +SELECT left('abcde', 2) AS `我aa`; ++-----+ +| 我aa | ++-----+ +| ab | ++-----+ +SELECT length('jose', 'UTF8') AS `v2`; ++----+ +| v2 | ++----+ +| 4 | ++----+ +SELECT lpad('hi', 5, 'xyza') AS `v$`; ++-------+ +| v$ | ++-------+ +| xyzhi | ++-------+ +SELECT lpad('hi', 5, 'xyza') AS `v_`; ++-------+ +| v_ | ++-------+ +| xyzhi | ++-------+ +SELECT notlike(1,1) AS `int`; ++-------+ +| int | ++-------+ +| false | ++-------+ +SELECT overlay('hello' placing 'world' from 2 for 3 ) AS `$`; ++---------+ +| $ | ++---------+ +| hworldo | ++---------+ +SELECT position('ing' in 'string') AS `_`; ++---+ +| _ | ++---+ +| 4 | ++---+ +SELECT pg_client_encoding() AS `我`; ++------+ +| 我 | ++------+ +| UTF8 | ++------+ +SELECT quote_ident('hello world') AS `t""t`; ++---------------+ +| t""t | ++---------------+ +| "hello world" | ++---------------+ diff --git a/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0136 b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0136 new file mode 100644 index 0000000000000000000000000000000000000000..76a2c6ae2d8186fd897867318c3e8bbb583d66c5 --- /dev/null +++ b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0136 @@ -0,0 +1,43 @@ +-- @testpoint: 反引号测试用例,部分用例合理报错 +-- 验证反引号在执行操作符、表达式以及类型转换中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +SQL SUCCESS +SELECT 1 OR 0 AS ` v`; ++------+ +| v | ++------+ +| true | ++------+ +SELECT 1 AND 0 AS `v v`; ++-------+ +| v v | ++-------+ +| false | ++-------+ +SELECT 0 AND 0 AS `v `; ++-------+ +| v | ++-------+ +| false | ++-------+ +SELECT 1+1 AS `1`; ++---+ +| 1 | ++---+ +| 2 | ++---+ +SELECT 5-1 AS `int`; ++-----+ +| int | ++-----+ +| 4 | ++-----+ +SELECT text 'abc' || 'def' AS `t"t`; +Unterminated identifier started at position 32 in SQL SELECT text 'abc' || 'def' AS `t"t`. Expected " char +SELECT text 'abc' || 'def' AS `t""t`; ++-------+ +| t""t | ++-------+ +| false | ++-------+ diff --git a/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0137 b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0137 new file mode 100644 index 0000000000000000000000000000000000000000..a3803eac94d17164f60dd9c1f5e7844ed8fe2c2f --- /dev/null +++ b/openGaussBase/expect/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0137 @@ -0,0 +1,28 @@ +-- @testpoint: 反引号测试用例 +-- 验证反引号在SELECT INTO以及values中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +SQL SUCCESS +-- 新建表 +CREATE TABLE t_opengauss_fanyinhao_case0137_1( +` v` INT , V INT , `v v` INT, v1 INT , `1` INT , `我aa` INT , `v2` INT , `v$` INT , `v_` INT , `v,` INT ,`v@` INT , `int` INT , `$` INT , `_` INT , `我` INT , `t""t` INT ); +SQL SUCCESS +-- 插入数据 +INSERT INTO t_opengauss_fanyinhao_case0137_1 SET ` v` =1 , v =1 , `v v` =1, v1 =1 , `1` =1 , `我aa` =1 , `v2` =1 , `v$` =1 , `v_` =1 , `v,` =1 ,`int` =1 , `v@` =1 , `$` =1 , `_` =1 , `我` =1 , `t""t` =1 ; +SQL SUCCESS +INSERT INTO t_opengauss_fanyinhao_case0137_1 SET ` v` =2 , v =2 , `v v` =1, v1 =1 , `1` =1 , `我aa` =1 , `v2` =1 , `v$` =1 , `v_` =1 , `v,` =1 ,`int` =1 , `v@` =1 , `$` =1 , `_` =1 , `我` =1 , `t""t` =1 ; +SQL SUCCESS +INSERT INTO t_opengauss_fanyinhao_case0137_1(` v`, V, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`, `_`, `我`, `t""t`) VALUES (3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3); +SQL SUCCESS +INSERT INTO t_opengauss_fanyinhao_case0137_1(` v`, V, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`) VALUES (4,4,4,4,4,4,4,4,4,4,4,4,4); +SQL SUCCESS +INSERT INTO t_opengauss_fanyinhao_case0137_1(` v`, V, `v v`, v1, `1`) VALUES (5,5,5,5,5); +SQL SUCCESS +-- 利用SELECT INTO新建表 +SELECT ` v`, V, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`, `_`, `我`, `t""t` INTO t_opengauss_fanyinhao_case0137_2 FROM t_opengauss_fanyinhao_case0137_1; +SQL SUCCESS +-- 清理环境 +DROP TABLE t_opengauss_fanyinhao_case0137_2 CASCADE; +SQL SUCCESS +DROP TABLE t_opengauss_fanyinhao_case0137_1 CASCADE; +SQL SUCCESS diff --git a/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_ASetup_Case0001.py b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_ASetup_Case0001.py new file mode 100644 index 0000000000000000000000000000000000000000..9a90cb5d918e2a0dcd68b9296a54e9ca265a391b --- /dev/null +++ b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_ASetup_Case0001.py @@ -0,0 +1,70 @@ +""" +Copyright (c) 2022 Huawei Technologies Co.,Ltd. + +openGauss is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + + http://license.coscl.org.cn/MulanPSL2 + +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +case Type : dolphin +case Name : 创建dolphin插件库 +Description : + 1、创建b库 + 2、b库下查询dolphin插件 +Expect : + 1、成功 + 2、自动加载成功,无需手动创建 +History : +""" + +import os +import unittest + +from yat.test import Node +from yat.test import macro + +from testcase.utils.Common import Common +from testcase.utils.CommonSH import CommonSH +from testcase.utils.Constant import Constant +from testcase.utils.Logger import Logger + + +class CompatibilityTest01(unittest.Testcase): + def setUp(self): + self.log = Logger() + self.common = Common() + self.sh_primary = CommonSH('PrimaryDbUser') + self.user_node = Node('PrimaryDbUser') + self.constant = Constant() + + def test_dolphin(self): + self.log.info(f'----{os.path.basename(__file__)} start----') + text = '----step1:创建和node.yml同名且兼容b库的数据库;expect:成功----' + self.log.info(text) + sql_cmd = f"drop database if exists {self.user_node.db_name};" \ + f"create database {self.user_node.db_name} " \ + f"dbcompatibility ='B';" + self.log.info(sql_cmd) + sql_res = self.sh_primary.execut_db_sql(sql_cmd, dbname='postgres') + self.log.info(sql_res) + self.assertIn(self.constant.CREATE_DATABASE_SUCCESS, sql_res, + '执行失败' + text) + + text = '---step2:b库下查询dolphin插件;expect:自动加载成功,无需手动创建---' + self.log.info(text) + sql_cmd = "select extname from pg_extension where extname ='dolphin';" + self.log.info(sql_cmd) + sql_res = self.sh_primary.execut_db_sql(sql_cmd, + dbname=self.user_node.db_name) + self.log.info(sql_res) + self.assertEqual('dolphin', sql_res.splitlines()[-2].strip(), + '执行失败' + text) + + def tearDown(self): + self.log.info('--无须清理环境,待sql用例执行完后清理--') + self.log.info(f'----{os.path.basename(__file__)} end-----') diff --git a/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0132.sql b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0132.sql new file mode 100644 index 0000000000000000000000000000000000000000..56c4d64bb8ce5365f3965d3656911e5969b14ffd --- /dev/null +++ b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0132.sql @@ -0,0 +1,76 @@ +-- @testpoint: 反引号测试用例 +-- 验证反引号在锁中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +-- 创建表 +CREATE TABLE ` t_opengauss_fanyinhao_case0132_1` (a1 INT,a2 INT,a3 INT); +CREATE TABLE t_opengauss_fanyinhao_case0132_2 (a1 INT,a2 INT,a3 INT); +CREATE TABLE `t_opengauss_fanyinhao_ case0132_3` (a1 INT,a2 INT,a3 INT); +CREATE TABLE t_opengauss_fanyinhao_case0132_4 (a1 INT,a2 INT,a3 INT); +CREATE TABLE `1` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `t_opengauss_fanyinhao_case0132_5我` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `t_opengauss_fanyinhao_case0132_6` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `t_opengauss_fanyinhao_case0132_7$` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `t_opengauss_fanyinhao_case0132_8` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `t_opengauss_fanyinhao_case0132_9,` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `t_opengauss_fanyinhao_case0132_10@` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `int` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `$` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `_` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `我` (a1 INT,a2 INT,a3 INT); +CREATE TABLE `t_opengauss_fanyinhao_""case0132_11` (a1 INT,a2 INT,a3 INT); +CREATE TABLE t_opengauss_fanyinhao_case0132_12 (a1 INT,a2 INT,a3 INT); +-- 开启事物 +START TRANSACTION; +LOCK TABLE ` t_opengauss_fanyinhao_case0132_1` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE t_opengauss_fanyinhao_case0132_2 IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `t_opengauss_fanyinhao_ case0132_3` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE t_opengauss_fanyinhao_case0132_4 IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `1` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `t_opengauss_fanyinhao_case0132_5我` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `t_opengauss_fanyinhao_case0132_6` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `t_opengauss_fanyinhao_case0132_7$` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `t_opengauss_fanyinhao_case0132_8` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `t_opengauss_fanyinhao_case0132_9,` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `t_opengauss_fanyinhao_case0132_10@` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `int` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `$` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `_` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `我` IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE `t_opengauss_fanyinhao_""case0132_11` IN SHARE ROW EXCLUSIVE MODE; +-- 提交 +COMMIT; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING ` t_opengauss_fanyinhao_case0132_1` ON (t_opengauss_fanyinhao_case0132_12.a1 =` t_opengauss_fanyinhao_case0132_1`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=` t_opengauss_fanyinhao_case0132_1`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING t_opengauss_fanyinhao_case0132_2 ON (t_opengauss_fanyinhao_case0132_12.a1 =t_opengauss_fanyinhao_case0132_2.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=t_opengauss_fanyinhao_case0132_2.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_ case0132_3` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_ case0132_3`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_ case0132_3`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING t_opengauss_fanyinhao_case0132_4 ON (t_opengauss_fanyinhao_case0132_12.a1 =t_opengauss_fanyinhao_case0132_4.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=t_opengauss_fanyinhao_case0132_4.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `1` ON (t_opengauss_fanyinhao_case0132_12.a1 =`1`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`1`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_5我` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_5我`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_5我`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_6` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_6`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_6`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_7$` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_7$`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_7$`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_8` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_8`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_8`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_9,` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_9,`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_9,`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_case0132_10@` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_case0132_10@`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_case0132_10@`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `int` ON (t_opengauss_fanyinhao_case0132_12.a1 =`int`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`int`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `$` ON (t_opengauss_fanyinhao_case0132_12.a1 =`$`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`$`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `_` ON (t_opengauss_fanyinhao_case0132_12.a1 =`_`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`_`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `我` ON (t_opengauss_fanyinhao_case0132_12.a1 =`我`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`我`.a2; +MERGE INTO t_opengauss_fanyinhao_case0132_12 USING `t_opengauss_fanyinhao_""case0132_11` ON (t_opengauss_fanyinhao_case0132_12.a1 =`t_opengauss_fanyinhao_""case0132_11`.a1) WHEN MATCHED THEN UPDATE SET t_opengauss_fanyinhao_case0132_12.a2=`t_opengauss_fanyinhao_""case0132_11`.a2; +-- 清理环境 +DROP TABLE ` t_opengauss_fanyinhao_case0132_1`; +DROP TABLE t_opengauss_fanyinhao_case0132_2; +DROP TABLE `t_opengauss_fanyinhao_ case0132_3`; +DROP TABLE t_opengauss_fanyinhao_case0132_4; +DROP TABLE `1`; +DROP TABLE `t_opengauss_fanyinhao_case0132_5我`; +DROP TABLE `t_opengauss_fanyinhao_case0132_6`; +DROP TABLE `t_opengauss_fanyinhao_case0132_7$`; +DROP TABLE `t_opengauss_fanyinhao_case0132_8`; +DROP TABLE `t_opengauss_fanyinhao_case0132_9,`; +DROP TABLE `t_opengauss_fanyinhao_case0132_10@`; +DROP TABLE `int`; +DROP TABLE `$`; +DROP TABLE `_`; +DROP TABLE `我`; +DROP TABLE `t_opengauss_fanyinhao_""case0132_11`; +DROP TABLE t_opengauss_fanyinhao_case0132_12; diff --git a/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0133.sql b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0133.sql new file mode 100644 index 0000000000000000000000000000000000000000..b8b59367859ab6fef579eac44e5687d12d02bc93 --- /dev/null +++ b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0133.sql @@ -0,0 +1,66 @@ +-- @t_opengauss_fanyinhao_case0133_1point: 反引号测试用例 +-- 验证反引号在创建保存点以及删除保存点中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +-- 清理环境 +DROP TABLE IF EXISTS t_opengauss_fanyinhao_case0133_1; +-- 新建表 +CREATE TABLE t_opengauss_fanyinhao_case0133_1(a int,b int); +--开启事务 +START TRANSACTION; +--插入数据 +insert into t_opengauss_fanyinhao_case0133_1 set a=1; +SAVEPOINT ` sp_opengauss_fanyinhao_case0133_1`; +insert into t_opengauss_fanyinhao_case0133_1 set a=2; +SAVEPOINT sp_opengauss_fanyinhao_case0133_2; +insert into t_opengauss_fanyinhao_case0133_1 set a=3; +SAVEPOINT `sp_opengauss_fanyinhao_ case0133_3`; +insert into t_opengauss_fanyinhao_case0133_1 set a=4; +SAVEPOINT sp_opengauss_fanyinhao_case0133_4; +insert into t_opengauss_fanyinhao_case0133_1 set a=5; +SAVEPOINT `1`; +insert into t_opengauss_fanyinhao_case0133_1 set a=6; +SAVEPOINT `sp_opengauss_fanyinhao_case0133_5我`; +insert into t_opengauss_fanyinhao_case0133_1 set a=7; +SAVEPOINT `sp_opengauss_fanyinhao_case0133_6`; +insert into t_opengauss_fanyinhao_case0133_1 set a=8; +SAVEPOINT `sp_opengauss_fanyinhao_case0133_7$`; +insert into t_opengauss_fanyinhao_case0133_1 set a=9; +SAVEPOINT `sp_opengauss_fanyinhao_case0133_8`; +insert into t_opengauss_fanyinhao_case0133_1 set a=10; +SAVEPOINT `sp_opengauss_fanyinhao_case0133_9,`; +insert into t_opengauss_fanyinhao_case0133_1 set a=11; +SAVEPOINT `sp_opengauss_fanyinhao_case0133_10@`; +insert into t_opengauss_fanyinhao_case0133_1 set a=12; +SAVEPOINT `int`; +insert into t_opengauss_fanyinhao_case0133_1 set a=13; +SAVEPOINT `$`; +insert into t_opengauss_fanyinhao_case0133_1 set a=14; +SAVEPOINT `_`; +insert into t_opengauss_fanyinhao_case0133_1 set a=15; +SAVEPOINT `我`; +insert into t_opengauss_fanyinhao_case0133_1 set a=16; +SAVEPOINT `sp_opengauss_fanyinhao_""case0133_11`; +-- 回滚保存点 +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_""case0133_11`; +ROLLBACK TO SAVEPOINT `我`; +ROLLBACK TO SAVEPOINT `_`; +ROLLBACK TO SAVEPOINT `$`; +ROLLBACK TO SAVEPOINT `int`; +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_10@`; +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_9,`; +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_8`; +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_7$`; +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_6`; +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_case0133_5我`; +ROLLBACK TO SAVEPOINT `1`; +ROLLBACK TO SAVEPOINT sp_opengauss_fanyinhao_case0133_4; +ROLLBACK TO SAVEPOINT `sp_opengauss_fanyinhao_ case0133_3`; +ROLLBACK TO SAVEPOINT sp_opengauss_fanyinhao_case0133_2; +ROLLBACK TO SAVEPOINT ` sp_opengauss_fanyinhao_case0133_1`; +-- 删除保存点 +RELEASE SAVEPOINT ` sp_opengauss_fanyinhao_case0133_1`; +-- 提交 +COMMIT; +--删除表 +DROP TABLE t_opengauss_fanyinhao_case0133_1 CASCADE; diff --git a/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0134.sql b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0134.sql new file mode 100644 index 0000000000000000000000000000000000000000..fdbd17f91912265b582f28a7dbb5ba8b35b50cc5 --- /dev/null +++ b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0134.sql @@ -0,0 +1,20 @@ +-- @testpoint: 反引号测试用例 +-- 验证反引号在查看数据中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +-- 新建表 +CREATE TABLE t_opengauss_fanyinhao_case0134_1( +` v` INT , V INT , `v v` INT, v1 INT , `1` INT , `我aa` INT , `v2` INT , `v$` INT , `v_` INT , `v,` INT ,`v@` INT , `int` INT , `$` INT , `_` INT , `我` INT , `t""t` INT ); +-- 插入数据 +INSERT INTO t_opengauss_fanyinhao_case0134_1 SET ` v` =1 , v =1 , `v v` =1, v1 =1 , `1` =1 , `我aa` =1 , `v2` =1 , `v$` =1 , `v_` =1 , `v,` =1 ,`int` =1 , `v@` =1 , `$` =1 , `_` =1 , `我` =1 , `t""t` =1 ; +INSERT INTO t_opengauss_fanyinhao_case0134_1 SET ` v` =2 , v =2 , `v v` =1, v1 =1 , `1` =1 , `我aa` =1 , `v2` =1 , `v$` =1 , `v_` =1 , `v,` =1 ,`int` =1 , `v@` =1 , `$` =1 , `_` =1 , `我` =1 , `t""t` =1 ; +INSERT INTO t_opengauss_fanyinhao_case0134_1(` v`,V,`v v`) VALUES(1,1,1); +INSERT INTO t_opengauss_fanyinhao_case0134_1(` v`,V,`v v`,`我aa`,`t""t`) VALUES(1,1,1,1,1); +-- 创建视图 +CREATE VIEW v_opengauss_fanyinhao_case0134_1 AS SELECT * FROM t_opengauss_fanyinhao_case0134_1; +-- 查看数据 +SELECT ` v`, V, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`, `_`, `我`, `t""t` FROM t_opengauss_fanyinhao_case0134_1; +SELECT ` v`, v, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`, `_`, `我`, `t""t` FROM v_opengauss_fanyinhao_case0134_1; +-- 清理环境 +DROP VIEW v_opengauss_fanyinhao_case0134_1; +DROP TABLE t_opengauss_fanyinhao_case0134_1 CASCADE; diff --git a/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0135.sql b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0135.sql new file mode 100644 index 0000000000000000000000000000000000000000..1da4b81248273ddc9a93b7785003885d2c777fb1 --- /dev/null +++ b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0135.sql @@ -0,0 +1,19 @@ +-- @testpoint: 反引号测试用例 +-- 验证反引号在执行操作符中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; + +SELECT bit_length('world') AS ` v`; +SELECT btrim('sring' , 'ing') AS v; +SELECT char_length('hello') AS `v v`; +SELECT instr( 'abcdabcdabcd', 'bcd', 2, 2 ) AS v1; +SELECT lengthb('hello') AS `1`; +SELECT left('abcde', 2) AS `我aa`; +SELECT length('jose', 'UTF8') AS `v2`; +SELECT lpad('hi', 5, 'xyza') AS `v$`; +SELECT lpad('hi', 5, 'xyza') AS `v_`; +SELECT notlike(1,1) AS `int`; +SELECT overlay('hello' placing 'world' from 2 for 3 ) AS `$`; +SELECT position('ing' in 'string') AS `_`; +SELECT pg_client_encoding() AS `我`; +SELECT quote_ident('hello world') AS `t""t`; diff --git a/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0136.sql b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0136.sql new file mode 100644 index 0000000000000000000000000000000000000000..35e4cb1bcfbeeb5c98b1901cde2d942b238eb675 --- /dev/null +++ b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0136.sql @@ -0,0 +1,11 @@ +-- @testpoint: 反引号测试用例,部分用例合理报错 +-- 验证反引号在执行操作符、表达式以及类型转换中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +SELECT 1 OR 0 AS ` v`; +SELECT 1 AND 0 AS `v v`; +SELECT 0 AND 0 AS `v `; +SELECT 1+1 AS `1`; +SELECT 5-1 AS `int`; +SELECT text 'abc' || 'def' AS `t"t`; +SELECT text 'abc' || 'def' AS `t""t`; diff --git a/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0137.sql b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0137.sql new file mode 100644 index 0000000000000000000000000000000000000000..09114379745ebcdd16a6392272b271d40ee33dd5 --- /dev/null +++ b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_BACKQUOTE_Case0137.sql @@ -0,0 +1,18 @@ +-- @testpoint: 反引号测试用例 +-- 验证反引号在SELECT INTO以及values中的作用 +-- 设置非双引号模式 +set dolphin.sql_mode=''; +-- 新建表 +CREATE TABLE t_opengauss_fanyinhao_case0137_1( +` v` INT , V INT , `v v` INT, v1 INT , `1` INT , `我aa` INT , `v2` INT , `v$` INT , `v_` INT , `v,` INT ,`v@` INT , `int` INT , `$` INT , `_` INT , `我` INT , `t""t` INT ); +-- 插入数据 +INSERT INTO t_opengauss_fanyinhao_case0137_1 SET ` v` =1 , v =1 , `v v` =1, v1 =1 , `1` =1 , `我aa` =1 , `v2` =1 , `v$` =1 , `v_` =1 , `v,` =1 ,`int` =1 , `v@` =1 , `$` =1 , `_` =1 , `我` =1 , `t""t` =1 ; +INSERT INTO t_opengauss_fanyinhao_case0137_1 SET ` v` =2 , v =2 , `v v` =1, v1 =1 , `1` =1 , `我aa` =1 , `v2` =1 , `v$` =1 , `v_` =1 , `v,` =1 ,`int` =1 , `v@` =1 , `$` =1 , `_` =1 , `我` =1 , `t""t` =1 ; +INSERT INTO t_opengauss_fanyinhao_case0137_1(` v`, V, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`, `_`, `我`, `t""t`) VALUES (3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3); +INSERT INTO t_opengauss_fanyinhao_case0137_1(` v`, V, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`) VALUES (4,4,4,4,4,4,4,4,4,4,4,4,4); +INSERT INTO t_opengauss_fanyinhao_case0137_1(` v`, V, `v v`, v1, `1`) VALUES (5,5,5,5,5); +-- 利用SELECT INTO新建表 +SELECT ` v`, V, `v v`, v1, `1`, `我aa`, `v2`, `v$`, `v_`, `v,`,`v@`, `int`, `$`, `_`, `我`, `t""t` INTO t_opengauss_fanyinhao_case0137_2 FROM t_opengauss_fanyinhao_case0137_1; +-- 清理环境 +DROP TABLE t_opengauss_fanyinhao_case0137_2 CASCADE; +DROP TABLE t_opengauss_fanyinhao_case0137_1 CASCADE; diff --git a/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_ZTeardown_Case0002.py b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_ZTeardown_Case0002.py new file mode 100644 index 0000000000000000000000000000000000000000..9a90cb5d918e2a0dcd68b9296a54e9ca265a391b --- /dev/null +++ b/openGaussBase/testcase/COMPATIBILITY/Grammar_B/FANYINHAO/Opengauss_Compatibility_ZTeardown_Case0002.py @@ -0,0 +1,70 @@ +""" +Copyright (c) 2022 Huawei Technologies Co.,Ltd. + +openGauss is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + + http://license.coscl.org.cn/MulanPSL2 + +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +case Type : dolphin +case Name : 创建dolphin插件库 +Description : + 1、创建b库 + 2、b库下查询dolphin插件 +Expect : + 1、成功 + 2、自动加载成功,无需手动创建 +History : +""" + +import os +import unittest + +from yat.test import Node +from yat.test import macro + +from testcase.utils.Common import Common +from testcase.utils.CommonSH import CommonSH +from testcase.utils.Constant import Constant +from testcase.utils.Logger import Logger + + +class CompatibilityTest01(unittest.Testcase): + def setUp(self): + self.log = Logger() + self.common = Common() + self.sh_primary = CommonSH('PrimaryDbUser') + self.user_node = Node('PrimaryDbUser') + self.constant = Constant() + + def test_dolphin(self): + self.log.info(f'----{os.path.basename(__file__)} start----') + text = '----step1:创建和node.yml同名且兼容b库的数据库;expect:成功----' + self.log.info(text) + sql_cmd = f"drop database if exists {self.user_node.db_name};" \ + f"create database {self.user_node.db_name} " \ + f"dbcompatibility ='B';" + self.log.info(sql_cmd) + sql_res = self.sh_primary.execut_db_sql(sql_cmd, dbname='postgres') + self.log.info(sql_res) + self.assertIn(self.constant.CREATE_DATABASE_SUCCESS, sql_res, + '执行失败' + text) + + text = '---step2:b库下查询dolphin插件;expect:自动加载成功,无需手动创建---' + self.log.info(text) + sql_cmd = "select extname from pg_extension where extname ='dolphin';" + self.log.info(sql_cmd) + sql_res = self.sh_primary.execut_db_sql(sql_cmd, + dbname=self.user_node.db_name) + self.log.info(sql_res) + self.assertEqual('dolphin', sql_res.splitlines()[-2].strip(), + '执行失败' + text) + + def tearDown(self): + self.log.info('--无须清理环境,待sql用例执行完后清理--') + self.log.info(f'----{os.path.basename(__file__)} end-----')