From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id D760526249 for ; Thu, 7 Feb 2019 13:17:57 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iy_YbGnE8peq for ; Thu, 7 Feb 2019 13:17:57 -0500 (EST) Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 7009E2610F for ; Thu, 7 Feb 2019 13:17:57 -0500 (EST) From: Ivan Koptelov Subject: [tarantool-patches] [PATCH] sql: remove tests on stmts with 'db table' Date: Thu, 7 Feb 2019 21:17:42 +0300 Message-Id: <20190207181742.85150-1-ivan.koptelov@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org, korablev@tarantool.org Cc: Ivan Koptelov We don't have such functionality, but some legacy tests were existed (disabled). --- Branch https://github.com/tarantool/tarantool/tree/sudobobo/gh-2172-rm-order-by-and-limit-from-delete test/sql-tap/e_delete.test.lua | 206 --------------------------------- 1 file changed, 206 deletions(-) diff --git a/test/sql-tap/e_delete.test.lua b/test/sql-tap/e_delete.test.lua index 0a81eb3bd..a58dc87c7 100755 --- a/test/sql-tap/e_delete.test.lua +++ b/test/sql-tap/e_delete.test.lua @@ -100,211 +100,5 @@ test:do_delete_tests("e_delete-1.2", { {9, "DELETE FROM t5 WHERE (SELECT max(x) FROM t6) ;SELECT x FROM t5", {}}, {10, "DELETE FROM t6 WHERE y>'seven' ; SELECT y FROM t6", {"one", "four", "five"}}, }) --- #------------------------------------------------------------------------- --- # Tests for restrictions on DELETE statements that appear within trigger --- # programs. --- # --- forcedelete test.db2 --- forcedelete test.db3 - --- MUST_WORK_TEST should be rewritten without spaces or deleted -if (0 > 0) then - test:drop_all_tables() - test:do_execsql_test("e_delete-2.0", --- ATTACH 'test.db2' AS aux; --- ATTACH 'test.db3' AS aux2; - [[ - CREATE TABLE temp.t7(a INT primary key, b INT); INSERT INTO temp.t7 VALUES(1, 2); - CREATE TABLE main.t7(a INT primary key, b INT); INSERT INTO main.t7 VALUES(3, 4); - CREATE TABLE aux.t7(a INT primary key, b INT); INSERT INTO aux.t7 VALUES(5, 6); - CREATE TABLE aux2.t7(a INT primary key, b INT); INSERT INTO aux2.t7 VALUES(7, 8); - CREATE TABLE main.t8(a INT primary key, b INT); INSERT INTO main.t8 VALUES(1, 2); - CREATE TABLE aux.t8(a INT primary key, b INT); INSERT INTO aux.t8 VALUES(3, 4); - CREATE TABLE aux2.t8(a INT primary key, b INT); INSERT INTO aux2.t8 VALUES(5, 6); - CREATE TABLE aux.t9(a INT primary key, b INT); INSERT INTO aux.t9 VALUES(1, 2); - CREATE TABLE aux2.t9(a INT primary key, b INT); INSERT INTO aux2.t9 VALUES(3, 4); - CREATE TABLE aux2.t10(a INT primary key, b INT); INSERT INTO aux2.t10 VALUES(1, 2);]] - , {}) - - -- EVIDENCE-OF: R-09681-58560 The table-name specified as part of a - -- DELETE statement within a trigger body must be unqualified. - -- - -- EVIDENCE-OF: R-12275-20298 In other words, the schema-name. prefix on - -- the table name is not allowed within triggers. - -- - - test:do_catchsql_test("e_delete-2.1.1",[[ - CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN - DELETE FROM main.t2; - END;]], - {1, "qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers"}) - test:do_catchsql_test("e_delete-2.1.2",[[ - CREATE TRIGGER tr1 BEFORE UPDATE ON t2 BEGIN - DELETE FROM temp.t7 WHERE a=new.a; - END;]], - {1, "qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers"}) - test:do_catchsql_test("e_delete-2.1.3",[[ - CREATE TRIGGER tr1 AFTER UPDATE ON t8 BEGIN - DELETE FROM aux2.t8 WHERE b!=a; - END;]], - {1, "qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers"}) - -- EVIDENCE-OF: R-28818-63526 If the table to which the trigger is - -- attached is not in the temp database, then DELETE statements within - -- the trigger body must operate on tables within the same database as - -- it. - -- - -- This is tested in two parts. First, check that if a table of the - -- specified name does not exist, an error is raised. Secondly, test - -- that if tables with the specified name exist in multiple databases, - -- the local database table is used. - -- - test:do_delete_tests("e_delete-2.2.1", "-error", " no such table: %s ", { - {1, [[ - CREATE TRIGGER tr1 AFTER INSERT ON t7 BEGIN - DELETE FROM t9; - END; - INSERT INTO main.t7 VALUES(1, 2);]], {"main.t9"}}, - - {2, [[ - CREATE TRIGGER aux.tr2 BEFORE UPDATE ON t9 BEGIN - DELETE FROM t10; - END; - UPDATE t9 SET a=1;]], {"aux.t10"}}, - }) - test:do_execsql_test( - "e_delete-2.2.X", - [[ - DROP TRIGGER main.tr1; - DROP TRIGGER aux.tr2; - ]], { - -- - - -- - }) - - test:do_delete_tests("e_delete-2.2.2", { - {1, [[ - CREATE TRIGGER aux.tr1 AFTER INSERT ON t8 BEGIN - DELETE FROM t9; - END; - INSERT INTO aux.t8 VALUES(1, 2); - - SELECT count(*) FROM aux.t9 - UNION ALL - SELECT count(*) FROM aux2.t9;]], {0, 1}}, - {2, [[ - CREATE TRIGGER main.tr1 AFTER INSERT ON t8 BEGIN - DELETE FROM t7; - END; - INSERT INTO main.t8 VALUES(1, 2); - - SELECT count(*) FROM temp.t7 - UNION ALL - SELECT count(*) FROM main.t7 - UNION ALL - SELECT count(*) FROM aux.t7 - UNION ALL - SELECT count(*) FROM aux2.t7;]], {1, 0, 1, 1}} - }) - -- EVIDENCE-OF: R-31567-38587 If the table to which the trigger is - -- attached is in the TEMP database, then the unqualified name of the - -- table being deleted is resolved in the same way as it is for a - -- top-level statement (by searching first the TEMP database, then the - -- main database, then any other databases in the order they were - -- attached). - -- - test:do_execsql_test( - "e_delete-2.3.0", - [[ - DROP TRIGGER aux.tr1; - DROP TRIGGER main.tr1; - DELETE FROM main.t8 WHERE oid>1; - DELETE FROM aux.t8 WHERE oid>1; - INSERT INTO aux.t9 VALUES(1, 2); - INSERT INTO main.t7 VALUES(3, 4); - ]], { - -- - - -- - }) - - test:do_execsql_test( - "e_delete-2.3.1", - [[ - SELECT count(*) FROM temp.t7 UNION ALL SELECT count(*) FROM main.t7 UNION ALL - SELECT count(*) FROM aux.t7 UNION ALL SELECT count(*) FROM aux2.t7; - - SELECT count(*) FROM main.t8 UNION ALL SELECT count(*) FROM aux.t8 - UNION ALL SELECT count(*) FROM aux2.t8; - - SELECT count(*) FROM aux.t9 UNION ALL SELECT count(*) FROM aux2.t9; - - SELECT count(*) FROM aux2.t10; - ]], { - -- - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - -- - }) - - test:do_execsql_test( - "e_delete-2.3.2", - [[ - CREATE TRIGGER temp.tr1 AFTER INSERT ON t7 BEGIN - DELETE FROM t7; - DELETE FROM t8; - DELETE FROM t9; - DELETE FROM t10; - END; - INSERT INTO temp.t7 VALUES('hello', 'world'); - ]], { - -- - - -- - }) - - test:do_execsql_test( - "e_delete-2.3.3", - [[ - SELECT count(*) FROM temp.t7 UNION ALL SELECT count(*) FROM main.t7 UNION ALL - SELECT count(*) FROM aux.t7 UNION ALL SELECT count(*) FROM aux2.t7; - - SELECT count(*) FROM main.t8 UNION ALL SELECT count(*) FROM aux.t8 - UNION ALL SELECT count(*) FROM aux2.t8; - - SELECT count(*) FROM aux.t9 UNION ALL SELECT count(*) FROM aux2.t9; - - SELECT count(*) FROM aux2.t10; - ]], { - -- - 0, 1, 1, 1, 0, 1, 1, 0, 1, 0 - -- - }) - - -- EVIDENCE-OF: R-28691-49464 The INDEXED BY and NOT INDEXED clauses are - -- not allowed on DELETE statements within triggers. - -- - test:do_execsql_test( - "e_delete-2.4.0", - [[ - CREATE INDEX i8 ON t8(a, b); - ]], { - -- - - -- - }) - - test:do_delete_tests("e_delete-2.4", "-error", [[ - the %s %s clause is not allowed on UPDATE or DELETE statements within triggers - ]], { - {1, [[ - CREATE TRIGGER tr3 AFTER INSERT ON t8 BEGIN - DELETE FROM t8 INDEXED BY i8 WHERE a=5; - END]], {"INDEXED BY"}}, - {2, [[ - CREATE TRIGGER tr3 AFTER INSERT ON t8 BEGIN - DELETE FROM t8 NOT INDEXED WHERE a=5; - END;]], {"NOT INDEXED"}}, - }) -end test:finish_test() -- 2.20.1