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
35d327fd
Commit
35d327fd
authored
Jun 04, 2020
by
Nikita Malyavin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-22599 WITHOUT OVERLAPS does not work with prefix indexes
cmp_max is used instead of cmp to compare key_parts
parent
0c595bde
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
3 deletions
+34
-3
mysql-test/suite/period/r/overlaps.result
mysql-test/suite/period/r/overlaps.result
+16
-1
mysql-test/suite/period/t/overlaps.test
mysql-test/suite/period/t/overlaps.test
+16
-1
sql/table.cc
sql/table.cc
+2
-1
No files found.
mysql-test/suite/period/r/overlaps.result
View file @
35d327fd
...
@@ -185,6 +185,7 @@ id u s e
...
@@ -185,6 +185,7 @@ id u s e
5 6 2003-05-01 2003-07-01
5 6 2003-05-01 2003-07-01
7 8 2003-05-01 2003-07-01
7 8 2003-05-01 2003-07-01
9 10 2003-05-01 2003-07-01
9 10 2003-05-01 2003-07-01
drop sequence seq;
create or replace table t(id int, s date, e date,
create or replace table t(id int, s date, e date,
period for p(s,e));
period for p(s,e));
insert into t values (1, '2003-01-01', '2003-03-01'),
insert into t values (1, '2003-01-01', '2003-03-01'),
...
@@ -281,4 +282,18 @@ Warnings:
...
@@ -281,4 +282,18 @@ Warnings:
Warning 1062 Duplicate entry '1-2020-03-05-2020-03-01' for key 'x'
Warning 1062 Duplicate entry '1-2020-03-05-2020-03-01' for key 'x'
load data infile 'tmp_t.txt' replace into table t;
load data infile 'tmp_t.txt' replace into table t;
ERROR 42000: This version of MariaDB doesn't yet support 'WITHOUT OVERLAPS'
ERROR 42000: This version of MariaDB doesn't yet support 'WITHOUT OVERLAPS'
create or replace database test;
# MDEV-22599 WITHOUT OVERLAPS does not work with prefix indexes
create or replace table t1 (a varchar(6), s timestamp, e timestamp,
period for p(s,e),
unique(a(3), p without overlaps));
insert into t1 values ('foo', '2012-01-01', '2015-12-31');
insert into t1 values ('foobar', '2013-01-01', '2014-01-01');
ERROR 23000: Duplicate entry 'foo-2014-01-01 00:00:00-2013-01-01 00:00:00' for key 'a'
insert into t1 values ('bar', '2012-01-01', '2015-12-31'),
('baz', '2013-01-01', '2014-01-01');
select * from t1;
a s e
foo 2012-01-01 00:00:00 2015-12-31 00:00:00
bar 2012-01-01 00:00:00 2015-12-31 00:00:00
baz 2013-01-01 00:00:00 2014-01-01 00:00:00
drop table t, t1;
mysql-test/suite/period/t/overlaps.test
View file @
35d327fd
...
@@ -163,6 +163,7 @@ update t set id= nextval(seq), u= nextval(seq), s='2003-05-01', e='2003-07-01'
...
@@ -163,6 +163,7 @@ update t set id= nextval(seq), u= nextval(seq), s='2003-05-01', e='2003-07-01'
--
sorted_result
--
sorted_result
select
*
from
t
;
select
*
from
t
;
drop
sequence
seq
;
create
or
replace
table
t
(
id
int
,
s
date
,
e
date
,
create
or
replace
table
t
(
id
int
,
s
date
,
e
date
,
period
for
p
(
s
,
e
));
period
for
p
(
s
,
e
));
...
@@ -270,4 +271,18 @@ load data infile 'tmp_t.txt' replace into table t;
...
@@ -270,4 +271,18 @@ load data infile 'tmp_t.txt' replace into table t;
remove_file
$MYSQLD_DATADIR
/
test
/
tmp_t
.
txt
;
remove_file
$MYSQLD_DATADIR
/
test
/
tmp_t
.
txt
;
create
or
replace
database
test
;
--
echo
# MDEV-22599 WITHOUT OVERLAPS does not work with prefix indexes
create
or
replace
table
t1
(
a
varchar
(
6
),
s
timestamp
,
e
timestamp
,
period
for
p
(
s
,
e
),
unique
(
a
(
3
),
p
without
overlaps
));
insert
into
t1
values
(
'foo'
,
'2012-01-01'
,
'2015-12-31'
);
--
error
ER_DUP_ENTRY
insert
into
t1
values
(
'foobar'
,
'2013-01-01'
,
'2014-01-01'
);
insert
into
t1
values
(
'bar'
,
'2012-01-01'
,
'2015-12-31'
),
(
'baz'
,
'2013-01-01'
,
'2014-01-01'
);
select
*
from
t1
;
drop
table
t
,
t1
;
sql/table.cc
View file @
35d327fd
...
@@ -8759,7 +8759,8 @@ bool TABLE::check_period_overlaps(const KEY &key,
...
@@ -8759,7 +8759,8 @@ bool TABLE::check_period_overlaps(const KEY &key,
if
(
key
.
key_part
[
part_nr
].
null_bit
)
if
(
key
.
key_part
[
part_nr
].
null_bit
)
if
(
f
->
is_null_in_record
(
lhs
)
||
f
->
is_null_in_record
(
rhs
))
if
(
f
->
is_null_in_record
(
lhs
)
||
f
->
is_null_in_record
(
rhs
))
return
false
;
return
false
;
if
(
f
->
cmp
(
f
->
ptr_in_record
(
lhs
),
f
->
ptr_in_record
(
rhs
))
!=
0
)
uint
kp_len
=
key
.
key_part
[
part_nr
].
length
;
if
(
f
->
cmp_max
(
f
->
ptr_in_record
(
lhs
),
f
->
ptr_in_record
(
rhs
),
kp_len
)
!=
0
)
return
false
;
return
false
;
}
}
...
...
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