Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ec85e7b1
Commit
ec85e7b1
authored
Apr 21, 2022
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-28340 Add tests for versioning, sequence, I_S table
parent
489011dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
16 deletions
+37
-16
mysql-test/suite/sysschema/r/pr_table_exists.result
mysql-test/suite/sysschema/r/pr_table_exists.result
+20
-6
mysql-test/suite/sysschema/t/pr_table_exists.test
mysql-test/suite/sysschema/t/pr_table_exists.test
+17
-10
No files found.
mysql-test/suite/sysschema/r/pr_table_exists.result
View file @
ec85e7b1
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;
mysql-test/suite/sysschema/t/pr_table_exists.test
View file @
ec85e7b1
--
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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment