Skip to content
Snippets Groups Projects
Commit 828b8b36 authored by Mergen Imeev's avatar Mergen Imeev Committed by Kirill Yukhin
Browse files

sql: remove test gh-3733-pragma.test.lua

@TarantoolBot document
Title: changes in EXPLAIN and PRAGMA

The most important change is that the column names for
the result of the "EXPLAIN ...", "EXPLAIN QUERY PLAN ..."
and "PRAGMA ..." commands are now defined.
Example:
box.cfg{listen = 3302}
cn = require('net.box').connect(box.cfg.listen)
cn:execute('EXPLAIN SELECT 1;')

In addition, the 'case_sensitive_like', 'parser_trace' and
'sql_default_engine' pragmas now return their values if
they are executed without arguments. For the first two
pragmas, this value is their state, and for the latter,
the default engine currently set in SQL.
Example:
box.sql.execute('PRAGMA case_sensitive_like;')

And the last change is that now the execution of the
“PRAGMA” command without determining which pragma to
execute returns status for all flag-type pragmas.
Flag-type pragmas are pragmas that have TRUE or FALSE as
status.
Example:
box.sql.execute('PRAGMA;')
parent 617dda85
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env tarantool
test = require("sqltester")
test:plan(16)
---
--- Prerequisites
---
test:do_execsql_test(
"pragma-0.1",
[[
DROP TABLE IF EXISTS gh3733;
CREATE TABLE gh3733(id INT primary key, f float);
INSERT INTO gh3733 VALUES(1, 0.1), (2, 0.2), (3, 0.3);
CREATE INDEX IDX ON GH3733 (id);
]], {
})
---
--- pragma query_only is not supported
---
test:do_catchsql_test(
"pragma-1.1",
[[
pragma query_only;
]], {
1, "Pragma 'QUERY_ONLY' does not exist"
})
---
--- pragma read_uncommitted is not supported
---
test:do_catchsql_test(
"pragma-2.1",
[[
pragma read_uncommitted;
]], {
1, "Pragma 'READ_UNCOMMITTED' does not exist"
})
---
--- pragma index_list returns three columns in a row
---
test:do_execsql_test(
"pragma-3.1",
[[
pragma index_list(gh3733)
]], {
-- <pragma-3.1>
0, 'pk_unnamed_GH3733_1', 1, 1, 'IDX', 0
-- </pragma-3.1>
})
---
--- pragma index_list returns an empty tuple for unknown table
---
test:do_execsql_test(
"pragma-4.1",
[[
pragma index_list(fufel);
]], {
-- <pragma-4.1>
-- </pragma-4.1>
})
---
--- pragma index_info returns an empty tuple for unknown index
---
test:do_execsql_test(
"pragma-5.1",
[[
pragma index_info(gh3733.IDX)
]], {
-- <pragma-5.1>
0, 0, 'ID', 0, 'BINARY', 'integer'
-- </pragma-5.1>
})
test:do_execsql_test(
"pragma-5.2",
[[
pragma index_info(no_table);
]], {
-- <pragma-5.2>
-- </pragma-5.2>
})
test:do_execsql_test(
"pragma-5.3",
[[
pragma index_info(wrong_table.IDX);
]], {
-- <pragma-5.3>
-- </pragma-5.3>
})
test:do_execsql_test(
"pragma-5.4",
[[
pragma index_info(gh3733.wrong_index);
]], {
-- <pragma-5.4>
-- </pragma-5.4>
})
---
--- pragma sql_default_engine accepts string values and rejects IDs
---
test:do_catchsql_test(
"pragma-7.1",
[[
pragma sql_default_engine(the_engine);
]], {
1, "Illegal parameters, string value is expected"
})
test:do_catchsql_test(
"pragma-7.2",
[[
pragma sql_default_engine(THE_ENGINE);
]], {
1, "Illegal parameters, string value is expected"
})
test:do_catchsql_test(
"pragma-7.3",
[[
pragma sql_default_engine("THE_ENGINE");
]], {
1, "Illegal parameters, string value is expected"
})
test:do_catchsql_test(
"pragma-7.4",
[[
pragma sql_default_engine('THE_ENGINE');
]], {
1, "Space engine 'THE_ENGINE' does not exist"
})
test:do_catchsql_test(
"pragma-7.5",
[[
pragma sql_default_engine(memtx);
]], {
1, "Illegal parameters, string value is expected"
})
test:do_catchsql_test(
"pragma-7.6",
[[
pragma sql_default_engine("memtx");
]], {
1, "Illegal parameters, string value is expected"
})
test:do_execsql_test(
"pragma-7.7",
[[
pragma sql_default_engine('memtx');
]], {
-- <pragma-7.7>
-- </pragma-7.7>
})
test:finish_test()
#!/usr/bin/env tarantool
test = require("sqltester")
test:plan(9)
test:plan(24)
test:do_catchsql_test(
"pragma-1.3",
......@@ -67,7 +67,7 @@ test:do_execsql_test(
]], {
-- <pragma-3.1>
'vinyl'
-- <pragma-3.1>
-- </pragma-3.1>
})
test:do_execsql_test(
......@@ -78,7 +78,7 @@ test:do_execsql_test(
]], {
-- <pragma-3.2>
'memtx'
-- <pragma-3.2>
-- </pragma-3.2>
})
-- Check that "PRAGMA case_sensitive_like" returns its status
......@@ -94,7 +94,185 @@ test:do_test(
end,
-- <pragma-3.3>
1
-- <pragma-3.3>
-- </pragma-3.3>
)
--
-- gh-3733: remove useless or obsolete pragmas
--
---
--- Prerequisites
---
test:execsql(
[[
DROP TABLE IF EXISTS gh3733;
CREATE TABLE gh3733(id INT primary key, f float);
INSERT INTO gh3733 VALUES(1, 0.1), (2, 0.2), (3, 0.3);
CREATE INDEX IDX ON GH3733 (id);
]])
---
--- pragma query_only is not supported
---
test:do_catchsql_test(
"pragma-4.1",
[[
pragma query_only;
]], {
-- <pragma-4.1>
1, "Pragma 'QUERY_ONLY' does not exist"
-- </pragma-4.1>
})
---
--- pragma read_uncommitted is not supported
---
test:do_catchsql_test(
"pragma-5.1",
[[
pragma read_uncommitted;
]], {
-- <pragma-5.1>
1, "Pragma 'READ_UNCOMMITTED' does not exist"
-- </pragma-5.1>
})
---
--- pragma index_list returns three columns in a row
---
test:do_execsql_test(
"pragma-6.1",
[[
pragma index_list(gh3733)
]], {
-- <pragma-6.1>
0, 'pk_unnamed_GH3733_1', 1, 1, 'IDX', 0
-- </pragma-6.1>
})
---
--- pragma index_list returns an empty tuple for unknown table
---
test:do_execsql_test(
"pragma-7.1",
[[
pragma index_list(fufel);
]], {
-- <pragma-7.1>
-- </pragma-7.1>
})
---
--- pragma index_info returns an empty tuple for unknown index
---
test:do_execsql_test(
"pragma-8.1",
[[
pragma index_info(gh3733.IDX)
]], {
-- <pragma-8.1>
0, 0, 'ID', 0, 'BINARY', 'integer'
-- </pragma-8.1>
})
test:do_execsql_test(
"pragma-8.2",
[[
pragma index_info(no_table);
]], {
-- <pragma-8.2>
-- </pragma-8.2>
})
test:do_execsql_test(
"pragma-8.3",
[[
pragma index_info(wrong_table.IDX);
]], {
-- <pragma-8.3>
-- </pragma-8.3>
})
test:do_execsql_test(
"pragma-8.4",
[[
pragma index_info(gh3733.wrong_index);
]], {
-- <pragma-8.4>
-- </pragma-8.4>
})
---
--- pragma sql_default_engine accepts string values and rejects IDs
---
test:do_catchsql_test(
"pragma-9.1",
[[
pragma sql_default_engine(the_engine);
]], {
-- <pragma-9.1>
1, "Illegal parameters, string value is expected"
-- </pragma-9.1>
})
test:do_catchsql_test(
"pragma-9.2",
[[
pragma sql_default_engine(THE_ENGINE);
]], {
-- <pragma-9.2>
1, "Illegal parameters, string value is expected"
-- </pragma-9.2>
})
test:do_catchsql_test(
"pragma-9.3",
[[
pragma sql_default_engine("THE_ENGINE");
]], {
-- <pragma-9.3>
1, "Illegal parameters, string value is expected"
-- </pragma-9.3>
})
test:do_catchsql_test(
"pragma-9.4",
[[
pragma sql_default_engine('THE_ENGINE');
]], {
-- <pragma-9.4>
1, "Space engine 'THE_ENGINE' does not exist"
-- </pragma-9.4>
})
test:do_catchsql_test(
"pragma-9.5",
[[
pragma sql_default_engine(memtx);
]], {
-- <pragma-9.5>
1, "Illegal parameters, string value is expected"
-- </pragma-9.5>
})
test:do_catchsql_test(
"pragma-9.6",
[[
pragma sql_default_engine("memtx");
]], {
-- <pragma-9.6>
1, "Illegal parameters, string value is expected"
-- </pragma-9.6>
})
test:do_execsql_test(
"pragma-9.7",
[[
pragma sql_default_engine('memtx');
]], {
-- <pragma-9.7>
-- </pragma-9.7>
})
test:finish_test()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment