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
ecd18bc0
Commit
ecd18bc0
authored
Apr 05, 2017
by
kevg
Committed by
Aleksey Midenkov
May 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: allow FOR SYSTEM_TIME BEFORE for SELECT queries [closes #170]
parent
4af3cb82
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
13 deletions
+12
-13
mysql-test/suite/versioning/r/truncate_history.result
mysql-test/suite/versioning/r/truncate_history.result
+9
-2
mysql-test/suite/versioning/t/truncate_history.test
mysql-test/suite/versioning/t/truncate_history.test
+3
-3
sql/sql_select.cc
sql/sql_select.cc
+0
-8
No files found.
mysql-test/suite/versioning/r/truncate_history.result
View file @
ecd18bc0
...
...
@@ -122,6 +122,9 @@ a
22
1
2
select * from t for system_time before timestamp @ts1;
a
1
truncate t for system_time before timestamp @ts1;
select * from t for system_time all;
a
...
...
@@ -144,6 +147,12 @@ a
22
1
2
select * from t for system_time before timestamp @ts1;
a
select * from t for system_time before transaction 2000;
a
1
2
truncate t for system_time before timestamp @ts1;
select * from t for system_time all;
a
...
...
@@ -157,7 +166,5 @@ a
11
22
2
select * from t for system_time before timestamp now();
ERROR HY000: `FOR SYSTEM_TIME BEFORE` works only with `TRUNCATE` query type
drop table t;
drop procedure truncate_history_of_t;
mysql-test/suite/versioning/t/truncate_history.test
View file @
ecd18bc0
...
...
@@ -96,6 +96,7 @@ update t set a=11 where a=1;
set
@
ts1
=
now
(
6
);
update
t
set
a
=
22
where
a
=
2
;
select
*
from
t
for
system_time
all
;
select
*
from
t
for
system_time
before
timestamp
@
ts1
;
truncate
t
for
system_time
before
timestamp
@
ts1
;
select
*
from
t
for
system_time
all
;
truncate
t
for
system_time
before
timestamp
now
(
6
);
...
...
@@ -107,13 +108,12 @@ update t set a=11 where a=1;
set
@
ts1
=
now
(
6
);
update
t
set
a
=
22
where
a
=
2
;
select
*
from
t
for
system_time
all
;
select
*
from
t
for
system_time
before
timestamp
@
ts1
;
select
*
from
t
for
system_time
before
transaction
2000
;
truncate
t
for
system_time
before
timestamp
@
ts1
;
select
*
from
t
for
system_time
all
;
truncate
t
for
system_time
before
timestamp
now
(
6
);
select
*
from
t
for
system_time
all
;
--
error
ER_VERS_WRONG_QUERY_TYPE
select
*
from
t
for
system_time
before
timestamp
now
();
drop
table
t
;
drop
procedure
truncate_history_of_t
;
sql/sql_select.cc
View file @
ecd18bc0
...
...
@@ -786,14 +786,6 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr,
table
->
vers_conditions
.
type
==
FOR_SYSTEM_TIME_UNSPECIFIED
?
slex
->
vers_conditions
:
table
->
vers_conditions
;
if
(
vers_conditions
.
type
==
FOR_SYSTEM_TIME_BEFORE
&&
thd
->
lex
->
sql_command
!=
SQLCOM_TRUNCATE
)
{
my_error
(
ER_VERS_WRONG_QUERY_TYPE
,
MYF
(
0
),
"FOR SYSTEM_TIME BEFORE"
,
"TRUNCATE"
);
DBUG_RETURN
(
-
1
);
}
if
(
vers_conditions
.
type
==
FOR_SYSTEM_TIME_UNSPECIFIED
)
{
if
(
vers_conditions
.
init_from_sysvar
(
thd
))
...
...
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