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
3fe656e6
Commit
3fe656e6
authored
Apr 26, 2021
by
Federico Razzoli
Committed by
Vladislav Vaintroub
Apr 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-28340 On table_type='SYSTEM VERSIONED' return 'BASE TABLE' instead of failing
parent
81862dbb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
scripts/sys_schema/procedures/table_exists.sql
scripts/sys_schema/procedures/table_exists.sql
+19
-1
No files found.
scripts/sys_schema/procedures/table_exists.sql
View file @
3fe656e6
...
@@ -97,6 +97,16 @@ CREATE DEFINER='mariadb.sys'@'localhost' PROCEDURE table_exists (
...
@@ -97,6 +97,16 @@ CREATE DEFINER='mariadb.sys'@'localhost' PROCEDURE table_exists (
+---------+
+---------+
1 row in set (0.00 sec)
1 row in set (0.00 sec)
MariaDB [sys]> CALL sys.table_exists(
''
db1
''
,
''
s
''
, @exists); SELECT @exists;
Query OK, 0 rows affected (0.006 sec)
+----------+
| @exists |
+----------+
| SEQUENCE |
+----------+
1 row in set (0.000 sec)
mysql> CALL sys.table_exists(
''
db1
''
,
''
t3
''
, @exists); SELECT @exists;
mysql> CALL sys.table_exists(
''
db1
''
,
''
t3
''
, @exists); SELECT @exists;
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
...
@@ -112,6 +122,7 @@ CREATE DEFINER='mariadb.sys'@'localhost' PROCEDURE table_exists (
...
@@ -112,6 +122,7 @@ CREATE DEFINER='mariadb.sys'@'localhost' PROCEDURE table_exists (
CONTAINS
SQL
CONTAINS
SQL
BEGIN
BEGIN
DECLARE
v_error
BOOLEAN
DEFAULT
FALSE
;
DECLARE
v_error
BOOLEAN
DEFAULT
FALSE
;
DECLARE
v_table_type
VARCHAR
(
16
)
DEFAULT
''
;
DECLARE
CONTINUE
HANDLER
FOR
1050
SET
v_error
=
TRUE
;
DECLARE
CONTINUE
HANDLER
FOR
1050
SET
v_error
=
TRUE
;
DECLARE
CONTINUE
HANDLER
FOR
1146
SET
v_error
=
TRUE
;
DECLARE
CONTINUE
HANDLER
FOR
1146
SET
v_error
=
TRUE
;
...
@@ -133,7 +144,14 @@ BEGIN
...
@@ -133,7 +144,14 @@ BEGIN
PREPARE
stmt_drop_table
FROM
@
sys
.
tmp
.
table_exists
.
SQL
;
PREPARE
stmt_drop_table
FROM
@
sys
.
tmp
.
table_exists
.
SQL
;
EXECUTE
stmt_drop_table
;
EXECUTE
stmt_drop_table
;
DEALLOCATE
PREPARE
stmt_drop_table
;
DEALLOCATE
PREPARE
stmt_drop_table
;
SET
out_exists
=
(
SELECT
TABLE_TYPE
FROM
information_schema
.
TABLES
WHERE
TABLE_SCHEMA
=
in_db
AND
TABLE_NAME
=
in_table
);
SET
v_table_type
=
(
SELECT
TABLE_TYPE
FROM
information_schema
.
TABLES
WHERE
TABLE_SCHEMA
=
in_db
AND
TABLE_NAME
=
in_table
);
-- Don't fail on table_type='SYSTEM VERSIONED'
-- but return 'BASE TABLE' for compatibility with existing tooling
IF
v_table_type
=
'SYSTEM VERSIONED'
THEN
SET
out_exists
=
'BASE TABLE'
;
ELSE
SET
out_exists
=
v_table_type
;
END
IF
;
END
IF
;
END
IF
;
ELSE
ELSE
-- Check whether a temporary table exists with the same name.
-- Check whether a temporary table exists with the same name.
...
...
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