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
e9e3cb0f
Commit
e9e3cb0f
authored
Sep 27, 2017
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: VTMD for SHOW CREATE fixes [related to #125]
parent
79e17b26
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
155 additions
and
163 deletions
+155
-163
mysql-test/suite/versioning/r/vtmd_show.result
mysql-test/suite/versioning/r/vtmd_show.result
+3
-3
mysql-test/suite/versioning/t/vtmd_show.test
mysql-test/suite/versioning/t/vtmd_show.test
+1
-1
sql/sql_show.cc
sql/sql_show.cc
+11
-14
sql/vtmd.cc
sql/vtmd.cc
+132
-142
sql/vtmd.h
sql/vtmd.h
+8
-3
No files found.
mysql-test/suite/versioning/r/vtmd_show.result
View file @
e9e3cb0f
...
...
@@ -51,7 +51,7 @@ drop table tt_vtmd;
end~~
create table t (a int) with system versioning;
show create table t for system_time as of now;
ERROR
42S02
: Table 'test.t_vtmd' doesn't exist
ERROR
HY000: VTMD error
: Table 'test.t_vtmd' doesn't exist
set versioning_alter_history=survive;
create or replace table t (a int) with system versioning;
show create table t for system_time between timestamp @tm1 and timestamp @tm1;
...
...
@@ -59,9 +59,9 @@ ERROR HY000: SYSTEM_TIME range selector is prohibited
show create table t for system_time from timestamp @tm1 to timestamp @tm1;
ERROR HY000: SYSTEM_TIME range selector is prohibited
show create table t for system_time as of timestamp '01-01-1990';
ERROR HY000: VTMD error:
failed to query VTMD table
ERROR HY000: VTMD error:
Table 'test.t' doesn't exist
show create table t for system_time as of timestamp '01-01-2020';
ERROR HY000: VTMD error:
failed to query VTMD table
ERROR HY000: VTMD error:
Table 'test.t' doesn't exist
drop table t;
call drop_archives('t_vtmd');
drop table t_vtmd;
...
...
mysql-test/suite/versioning/t/vtmd_show.test
View file @
e9e3cb0f
...
...
@@ -65,7 +65,7 @@ end~~
delimiter
;
~~
create
table
t
(
a
int
)
with
system
versioning
;
--
error
ER_
NO_SUCH_TABLE
--
error
ER_
VERS_VTMD_ERROR
show
create
table
t
for
system_time
as
of
now
;
set
versioning_alter_history
=
survive
;
...
...
sql/sql_show.cc
View file @
e9e3cb0f
...
...
@@ -1270,23 +1270,22 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
*/
MDL_savepoint
mdl_savepoint
=
thd
->
mdl_context
.
mdl_savepoint
();
TABLE_LIST
tl
;
bool
versioned_query
=
table_list
->
vers_conditions
.
type
!=
FOR_SYSTEM_TIME_UNSPECIFIED
;
String
archive_name
;
if
(
versioned_query
)
TABLE_LIST
archive
;
bool
versioned
=
table_list
->
vers_conditions
;
if
(
versioned
)
{
DBUG_ASSERT
(
table_list
->
vers_conditions
.
type
==
FOR_SYSTEM_TIME_AS_OF
);
String
archive_name
;
DBUG_ASSERT
(
table_list
->
vers_conditions
==
FOR_SYSTEM_TIME_AS_OF
);
VTMD_table
vtmd
(
*
table_list
);
if
(
vtmd
.
find_archive_name
(
thd
,
archive_name
))
goto
exit
;
tl
.
init_one_table
(
table_list
->
db
,
table_list
->
db_length
,
archive_name
.
ptr
(),
archive
.
init_one_table
(
table_list
->
db
,
table_list
->
db_length
,
archive_name
.
ptr
(),
archive_name
.
length
(),
archive_name
.
ptr
(),
TL_READ
);
tl
.
alias
=
table_list
->
table_name
;
tl
.
vers_force_alias
=
true
;
table_list
=
&
tl
;
archive
.
alias
=
table_list
->
table_name
;
archive
.
vers_force_alias
=
true
;
table_list
=
&
archive
;
}
if
(
mysqld_show_create_get_fields
(
thd
,
table_list
,
&
field_list
,
&
buffer
))
...
...
@@ -1302,9 +1301,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
protocol
->
store
(
table_list
->
view_name
.
str
,
system_charset_info
);
else
{
if
(
versioned_query
)
protocol
->
store
(
tl
.
alias
,
system_charset_info
);
else
if
(
table_list
->
schema_table
)
if
(
table_list
->
schema_table
)
protocol
->
store
(
table_list
->
schema_table
->
table_name
,
system_charset_info
);
else
...
...
@@ -1332,7 +1329,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
my_eof
(
thd
);
exit:
if
(
versioned
_query
)
if
(
versioned
)
{
/* If commit fails, we should be able to reset the OK status. */
thd
->
get_stmt_da
()
->
set_overwrite_status
(
true
);
...
...
sql/vtmd.cc
View file @
e9e3cb0f
This diff is collapsed.
Click to expand it.
sql/vtmd.h
View file @
e9e3cb0f
...
...
@@ -48,8 +48,10 @@ class THD;
class
VTMD_table
{
Open_tables_backup
open_tables_backup
;
protected:
TABLE
*
vtmd
;
TABLE
_LIST
vtmd
;
const
TABLE_LIST
&
about
;
SString_t
vtmd_name
;
...
...
@@ -72,13 +74,16 @@ class VTMD_table
};
VTMD_table
(
TABLE_LIST
&
_about
)
:
vtmd
(
NULL
),
about
(
_about
)
{}
{
vtmd
.
table
=
NULL
;
}
bool
create
(
THD
*
thd
);
bool
find_record
(
ulonglong
sys_trx_end
,
bool
&
found
);
bool
open
(
THD
*
thd
,
Local_da
&
local_da
,
bool
*
created
=
NULL
);
bool
update
(
THD
*
thd
,
const
char
*
archive_name
=
NULL
);
bool
setup_select
(
THD
*
thd
);
static
void
archive_name
(
THD
*
thd
,
const
char
*
table_name
,
char
*
new_name
,
size_t
new_name_size
);
void
archive_name
(
THD
*
thd
,
char
*
new_name
,
size_t
new_name_size
)
...
...
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