1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#!/usr/bin/env tarantool
test = require("sqltester")
test:plan(9)
-- box.cfg{wal_mode='none'}
table_count = 31
select_string_last = ''
for _, term in ipairs({'UNION', 'UNION ALL', 'INTERSECT', 'EXCEPT'}) do
select_string = ''
test:do_test("Positive COMPOUND "..term,
function()
for i = 1,table_count do
drop_string = 'DROP TABLE IF EXISTS t' .. i .. ';\n'
test:execsql(drop_string)
end
for i = 1,table_count do
create_string = 'CREATE TABLE t' .. i .. ' (s1 int primary key, s2 int);\n'
test:execsql(create_string)
end
for i = 1,table_count do
insert_string = 'INSERT INTO t' .. i .. ' VALUES (0,' .. i .. ');\n'
test:execsql(insert_string)
end
for i = 1,table_count-1 do
if i > 1 then select_string = select_string .. ' ' .. term .. ' ' end
select_string = select_string .. 'SELECT * FROM t' .. i
end
return pcall( function() test:execsql(select_string) end)
end,
true)
test:do_test("Negative COMPOUND "..term,
function()
select_string = select_string .. ' ' .. term ..' ' .. 'SELECT * FROM t' .. table_count
return pcall(function() test:execsql(select_string) end)
end,
false)
select_string_last = select_string
-- if not pcall(function() box.execute(select_string) end) then
-- print('not ok')
-- end
-- select_string = select_string .. ' ' .. term ..' ' .. 'SELECT * FROM t' .. table_count
-- if pcall(function() box.execute(select_string) end) then
-- print('not ok')
-- end
end
test:do_catchsql_test(
"gh2548-select-compound-limit-2",
select_string_last, {
-- <gh2548-select-compound-limit-2>
1, "The number of UNION or EXCEPT or INTERSECT operations 31 exceeds the limit (30)"
-- </gh2548-select-compound-limit-2>
})
test:finish_test()
|