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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d3ea79ff
Commit
d3ea79ff
authored
May 30, 2006
by
mikael@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#19801: Valgrind error in check_list_constants
Needed some special handling of the case when no_list_values == 0
parent
2e6b5157
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
22 deletions
+58
-22
mysql-test/r/partition.result
mysql-test/r/partition.result
+12
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+6
-0
sql/partition_info.cc
sql/partition_info.cc
+23
-18
sql/sql_partition.cc
sql/sql_partition.cc
+17
-4
No files found.
mysql-test/r/partition.result
View file @
d3ea79ff
...
...
@@ -757,6 +757,18 @@ insert into t1 values (null);
select * from t1 where f1 is null;
f1
NULL
select * from t1 where f1 < 1;
f1
select * from t1 where f1 <= NULL;
f1
select * from t1 where f1 < NULL;
f1
select * from t1 where f1 >= NULL;
f1
select * from t1 where f1 > NULL;
f1
select * from t1 where f1 > 1;
f1
drop table t1;
create table t1 (f1 smallint)
partition by range (f1) (partition p0 values less than (0));
...
...
mysql-test/t/partition.test
View file @
d3ea79ff
...
...
@@ -895,6 +895,12 @@ create table t1 (f1 smallint)
partition
by
list
(
f1
)
(
partition
p0
values
in
(
null
));
insert
into
t1
values
(
null
);
select
*
from
t1
where
f1
is
null
;
select
*
from
t1
where
f1
<
1
;
select
*
from
t1
where
f1
<=
NULL
;
select
*
from
t1
where
f1
<
NULL
;
select
*
from
t1
where
f1
>=
NULL
;
select
*
from
t1
where
f1
>
NULL
;
select
*
from
t1
where
f1
>
1
;
drop
table
t1
;
create
table
t1
(
f1
smallint
)
...
...
sql/partition_info.cc
View file @
d3ea79ff
...
...
@@ -612,7 +612,8 @@ bool partition_info::check_list_constants()
no_list_values
++
;
}
while
(
++
i
<
no_parts
);
list_func_it
.
rewind
();
list_array
=
(
LIST_PART_ENTRY
*
)
sql_alloc
(
no_list_values
*
sizeof
(
LIST_PART_ENTRY
));
list_array
=
(
LIST_PART_ENTRY
*
)
sql_alloc
((
no_list_values
+
1
)
*
sizeof
(
LIST_PART_ENTRY
));
if
(
unlikely
(
list_array
==
NULL
))
{
mem_alloc_error
(
no_list_values
*
sizeof
(
LIST_PART_ENTRY
));
...
...
@@ -631,25 +632,29 @@ bool partition_info::check_list_constants()
}
}
while
(
++
i
<
no_parts
);
qsort
((
void
*
)
list_array
,
no_list_values
,
sizeof
(
LIST_PART_ENTRY
),
&
list_part_cmp
);
not_first
=
FALSE
;
i
=
prev_value
=
0
;
//prev_value initialised to quiet compiler
do
if
(
no_list_values
)
{
curr_value
=
list_array
[
i
].
list_value
;
if
(
likely
(
!
not_first
||
prev_value
!=
curr_value
))
{
prev_value
=
curr_value
;
not_first
=
TRUE
;
}
else
qsort
((
void
*
)
list_array
,
no_list_values
,
sizeof
(
LIST_PART_ENTRY
),
&
list_part_cmp
);
not_first
=
FALSE
;
i
=
prev_value
=
0
;
//prev_value initialised to quiet compiler
do
{
my_error
(
ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
,
MYF
(
0
));
goto
end
;
}
}
while
(
++
i
<
no_list_values
);
DBUG_ASSERT
(
i
<
no_list_values
);
curr_value
=
list_array
[
i
].
list_value
;
if
(
likely
(
!
not_first
||
prev_value
!=
curr_value
))
{
prev_value
=
curr_value
;
not_first
=
TRUE
;
}
else
{
my_error
(
ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
,
MYF
(
0
));
goto
end
;
}
}
while
(
++
i
<
no_list_values
);
}
result
=
FALSE
;
end:
DBUG_RETURN
(
result
);
...
...
sql/sql_partition.cc
View file @
d3ea79ff
...
...
@@ -2257,8 +2257,8 @@ static uint32 get_part_id_linear_key(partition_info *part_info,
int
get_partition_id_list
(
partition_info
*
part_info
,
uint32
*
part_id
,
longlong
*
func_value
)
uint32
*
part_id
,
longlong
*
func_value
)
{
LIST_PART_ENTRY
*
list_array
=
part_info
->
list_array
;
int
list_index
;
...
...
@@ -2351,7 +2351,8 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
uint
min_list_index
=
0
,
max_list_index
=
part_info
->
no_list_values
-
1
;
/* Get the partitioning function value for the endpoint */
longlong
part_func_value
=
part_val_int
(
part_info
->
part_expr
);
while
(
max_list_index
>=
min_list_index
)
DBUG_ASSERT
(
part_info
->
no_list_values
);
do
{
list_index
=
(
max_list_index
+
min_list_index
)
>>
1
;
list_value
=
list_array
[
list_index
].
list_value
;
...
...
@@ -2367,7 +2368,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
{
DBUG_RETURN
(
list_index
+
test
(
left_endpoint
^
include_endpoint
));
}
}
}
while
(
max_list_index
>=
min_list_index
);
notfound:
if
(
list_value
<
part_func_value
)
list_index
++
;
...
...
@@ -6194,6 +6195,18 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
part_iter
->
get_next
=
get_next_partition_id_list
;
part_iter
->
part_info
=
part_info
;
part_iter
->
ret_null_part
=
part_iter
->
ret_null_part_orig
=
FALSE
;
if
(
max_endpoint_val
==
0
)
{
/*
We handle this special case without optimisations since it is
of little practical value but causes a great number of complex
checks later in the code.
*/
part_iter
->
part_nums
.
start
=
part_iter
->
part_nums
.
end
=
0
;
part_iter
->
part_nums
.
cur
=
0
;
part_iter
->
ret_null_part
=
part_iter
->
ret_null_part_orig
=
TRUE
;
return
-
1
;
}
}
else
DBUG_ASSERT
(
0
);
...
...
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