Commit ec85e7b1 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-28340 Add tests for versioning, sequence, I_S table

parent 489011dd
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v_t1;
CREATE TABLE t1 (id INT PRIMARY KEY); CREATE TABLE t1 (id INT PRIMARY KEY);
CREATE view v_t1 AS SELECT * FROM t1;
CALL sys.table_exists('test', 't1', @exists); CALL sys.table_exists('test', 't1', @exists);
SELECT @exists; SELECT @exists;
@exists @exists
BASE TABLE BASE TABLE
DROP TABLE t1;
CREATE view v_t1 AS SELECT 1;
CALL sys.table_exists('test', 'v_t1', @exists); CALL sys.table_exists('test', 'v_t1', @exists);
SELECT @exists; SELECT @exists;
@exists @exists
VIEW VIEW
DROP VIEW v_t1;
CREATE TABLE tv (i int) with system versioning;
CALL sys.table_exists('test','tv',@exists);
SELECT @exists;
@exists
BASE TABLE
DROP TABLE tv;
CREATE SEQUENCE s;
CALL sys.table_exists('test','s',@exists);
SELECT @exists;
@exists
SEQUENCE
DROP SEQUENCE s;
CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY);
CALL sys.table_exists('test', 't1', @exists); CALL sys.table_exists('test', 't1', @exists);
SELECT @exists; SELECT @exists;
@exists @exists
TEMPORARY TEMPORARY
DROP TEMPORARY TABLE t1;
CALL sys.table_exists('information_schema', 'all_plugins', @exists);
SELECT @exists;
@exists
SYSTEM VIEW
CALL sys.table_exists('test', 't2', @exists); CALL sys.table_exists('test', 't2', @exists);
SELECT @exists; SELECT @exists;
@exists @exists
...@@ -24,7 +41,4 @@ CALL sys.table_exists(@identifier, 't1', @exists); ...@@ -24,7 +41,4 @@ CALL sys.table_exists(@identifier, 't1', @exists);
ERROR 22001: Data too long for column 'in_db' at row 1 ERROR 22001: Data too long for column 'in_db' at row 1
CALL sys.table_exists('test', @identifier, @exists); CALL sys.table_exists('test', @identifier, @exists);
ERROR 22001: Data too long for column 'in_table' at row 1 ERROR 22001: Data too long for column 'in_table' at row 1
DROP TEMPORARY TABLE t1;
DROP TABLE t1;
DROP VIEW v_t1;
SET @identifier := NULL; SET @identifier := NULL;
-- source include/not_embedded.inc -- source include/not_embedded.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v_t1;
--enable_warnings
# Create a base table and a view # Create a base table and a view
CREATE TABLE t1 (id INT PRIMARY KEY); CREATE TABLE t1 (id INT PRIMARY KEY);
CREATE view v_t1 AS SELECT * FROM t1;
# Verify the base table and view is supported # Verify the base table and view is supported
CALL sys.table_exists('test', 't1', @exists); CALL sys.table_exists('test', 't1', @exists);
SELECT @exists; SELECT @exists;
DROP TABLE t1;
CREATE view v_t1 AS SELECT 1;
CALL sys.table_exists('test', 'v_t1', @exists); CALL sys.table_exists('test', 'v_t1', @exists);
SELECT @exists; SELECT @exists;
DROP VIEW v_t1;
CREATE TABLE tv (i int) with system versioning;
CALL sys.table_exists('test','tv',@exists);
SELECT @exists;
DROP TABLE tv;
CREATE SEQUENCE s;
CALL sys.table_exists('test','s',@exists);
SELECT @exists;
DROP SEQUENCE s;
# Replace the base table with a temporary table # Replace the base table with a temporary table
CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY);
CALL sys.table_exists('test', 't1', @exists); CALL sys.table_exists('test', 't1', @exists);
SELECT @exists; SELECT @exists;
DROP TEMPORARY TABLE t1;
CALL sys.table_exists('information_schema', 'all_plugins', @exists);
SELECT @exists;
# Try a non-existing table # Try a non-existing table
CALL sys.table_exists('test', 't2', @exists); CALL sys.table_exists('test', 't2', @exists);
...@@ -34,8 +45,4 @@ CALL sys.table_exists(@identifier, 't1', @exists); ...@@ -34,8 +45,4 @@ CALL sys.table_exists(@identifier, 't1', @exists);
-- error 1406 -- error 1406
CALL sys.table_exists('test', @identifier, @exists); CALL sys.table_exists('test', @identifier, @exists);
# Clean up
DROP TEMPORARY TABLE t1;
DROP TABLE t1;
DROP VIEW v_t1;
SET @identifier := NULL; SET @identifier := NULL;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment