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
c3e09a2d
Commit
c3e09a2d
authored
Jun 01, 2020
by
Nikita Malyavin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-22439 Add FOR PORTION OF statements to the test for WITHOUT OVERLAPS
parent
b1ab211d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
0 deletions
+97
-0
mysql-test/suite/period/engines.combinations
mysql-test/suite/period/engines.combinations
+1
-0
mysql-test/suite/period/r/overlaps.result
mysql-test/suite/period/r/overlaps.result
+55
-0
mysql-test/suite/period/t/overlaps.test
mysql-test/suite/period/t/overlaps.test
+41
-0
No files found.
mysql-test/suite/period/engines.combinations
View file @
c3e09a2d
...
...
@@ -3,4 +3,5 @@ innodb
default-storage-engine=innodb
[myisam]
innodb
default-storage-engine=myisam
mysql-test/suite/period/r/overlaps.result
View file @
c3e09a2d
...
...
@@ -62,6 +62,61 @@ id s e
1 2003-01-01 2003-02-01
1 2003-03-01 2003-05-01
1 2003-05-01 2003-07-01
# UPDATE ... FOR PORTION test
insert t values (2, '2003-04-15', '2003-05-01');
update t for portion of p from '2003-01-01' to '2003-01-15'
set id= 2;
select * from t;
id s e
1 2003-01-15 2003-02-01
1 2003-03-01 2003-05-01
1 2003-05-01 2003-07-01
2 2003-01-01 2003-01-15
2 2003-04-15 2003-05-01
update t for portion of p from '2003-01-15' to '2003-02-01'
set id= 2;
select * from t;
id s e
1 2003-03-01 2003-05-01
1 2003-05-01 2003-07-01
2 2003-01-01 2003-01-15
2 2003-01-15 2003-02-01
2 2003-04-15 2003-05-01
# Next, test UPDATE ... FOR PORTION resulting with an error
# Since MyISAM/Aria engines lack atomicity, the results would differ with
# innodb. So a table is going to be copied to one with explicit engine.
create table t_myisam (id int, s date, e date,
period for p(s,e),
primary key(id, p without overlaps))
engine=myisam
select * from t;
update t_myisam for portion of p from '2003-04-01' to '2003-06-01'
set id= 2 order by s desc;
ERROR 23000: Duplicate entry '2-2003-05-01-2003-04-01' for key 'PRIMARY'
select * from t_myisam;
id s e
1 2003-03-01 2003-05-01
1 2003-06-01 2003-07-01
2 2003-01-01 2003-01-15
2 2003-01-15 2003-02-01
2 2003-04-15 2003-05-01
2 2003-05-01 2003-06-01
create table t_innodb (id int, s date, e date,
period for p(s,e),
primary key(id, p without overlaps))
engine=innodb
select * from t;
update t_innodb for portion of p from '2003-04-01' to '2003-06-01'
set id= 2 order by s desc;
ERROR 23000: Duplicate entry '2-2003-05-01-2003-04-01' for key 'PRIMARY'
select * from t_innodb;
id s e
1 2003-03-01 2003-05-01
1 2003-05-01 2003-07-01
2 2003-01-01 2003-01-15
2 2003-01-15 2003-02-01
2 2003-04-15 2003-05-01
drop table t_myisam, t_innodb;
create or replace table t(id int, s date, e date,
period for p(s,e),
primary key(id, q without overlaps));
...
...
mysql-test/suite/period/t/overlaps.test
View file @
c3e09a2d
...
...
@@ -67,6 +67,47 @@ update t set e= '2003-05-01' where s = '2003-01-01';
select
*
from
t
where
year
(
s
)
=
2003
;
--
echo
# UPDATE ... FOR PORTION test
insert
t
values
(
2
,
'2003-04-15'
,
'2003-05-01'
);
update
t
for
portion
of
p
from
'2003-01-01'
to
'2003-01-15'
set
id
=
2
;
--
sorted_result
select
*
from
t
;
update
t
for
portion
of
p
from
'2003-01-15'
to
'2003-02-01'
set
id
=
2
;
--
sorted_result
select
*
from
t
;
--
echo
# Next, test UPDATE ... FOR PORTION resulting with an error
--
echo
# Since MyISAM/Aria engines lack atomicity, the results would differ with
--
echo
# innodb. So a table is going to be copied to one with explicit engine.
create
table
t_myisam
(
id
int
,
s
date
,
e
date
,
period
for
p
(
s
,
e
),
primary
key
(
id
,
p
without
overlaps
))
engine
=
myisam
select
*
from
t
;
--
error
ER_DUP_ENTRY
update
t_myisam
for
portion
of
p
from
'2003-04-01'
to
'2003-06-01'
set
id
=
2
order
by
s
desc
;
--
sorted_result
select
*
from
t_myisam
;
create
table
t_innodb
(
id
int
,
s
date
,
e
date
,
period
for
p
(
s
,
e
),
primary
key
(
id
,
p
without
overlaps
))
engine
=
innodb
select
*
from
t
;
--
error
ER_DUP_ENTRY
update
t_innodb
for
portion
of
p
from
'2003-04-01'
to
'2003-06-01'
set
id
=
2
order
by
s
desc
;
--
sorted_result
select
*
from
t_innodb
;
drop
table
t_myisam
,
t_innodb
;
--
error
ER_PERIOD_NOT_FOUND
create
or
replace
table
t
(
id
int
,
s
date
,
e
date
,
period
for
p
(
s
,
e
),
...
...
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