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
b56308e6
Commit
b56308e6
authored
Jan 10, 2011
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
Manual merge from 5.1
parents
a5263d0a
2f474166
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
4658 additions
and
7291 deletions
+4658
-7291
mysql-test/r/partition.result
mysql-test/r/partition.result
+1
-1
mysql-test/r/partition_error.result
mysql-test/r/partition_error.result
+650
-0
mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc
mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc
+26
-22
mysql-test/suite/parts/r/part_supported_sql_func_innodb.result
...-test/suite/parts/r/part_supported_sql_func_innodb.result
+1583
-3627
mysql-test/suite/parts/r/part_supported_sql_func_myisam.result
...-test/suite/parts/r/part_supported_sql_func_myisam.result
+1583
-3627
mysql-test/t/partition.test
mysql-test/t/partition.test
+3
-2
mysql-test/t/partition_error.test
mysql-test/t/partition_error.test
+661
-0
sql/item.h
sql/item.h
+4
-4
sql/item_func.h
sql/item_func.h
+41
-1
sql/item_timefunc.h
sql/item_timefunc.h
+99
-1
sql/sql_partition.cc
sql/sql_partition.cc
+6
-5
sql/table.cc
sql/table.cc
+1
-1
No files found.
mysql-test/r/partition.result
View file @
b56308e6
...
...
@@ -1901,7 +1901,7 @@ c1 bigint,
c2 set('sweet'),
key (c2,c1,c0),
key(c0)
) engine=myisam partition by hash (
month(c0)
) partitions 5;
) engine=myisam partition by hash (
c0
) partitions 5;
insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019;
insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644;
select c1 from t1 group by (select c0 from t1 limit 1);
...
...
mysql-test/r/partition_error.result
View file @
b56308e6
This diff is collapsed.
Click to expand it.
mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc
View file @
b56308e6
...
...
@@ -88,8 +88,9 @@ let $val2 = '2006-01-17';
let
$val3
=
'2006-02-25'
;
let
$val4
=
'2006-02-05'
;
--
source
suite
/
parts
/
inc
/
partition_supported_sql_funcs
.
inc
let
$coltype
=
char
(
30
);
--
source
suite
/
parts
/
inc
/
partition_supported_sql_funcs
.
inc
# Disabled after fixing bug#54483.
#let $coltype = char(30);
#--source suite/parts/inc/partition_supported_sql_funcs.inc
let
$sqlfunc
=
extract
(
month
from
col1
);
let
$valsqlfunc
=
extract
(
year
from
'1998-11-23'
);
...
...
@@ -139,8 +140,9 @@ let $val2 = '14:30:20';
let
$val3
=
'21:59:22'
;
let
$val4
=
'10:22:33'
;
--
source
suite
/
parts
/
inc
/
partition_supported_sql_funcs
.
inc
let
$coltype
=
char
(
30
);
--
source
suite
/
parts
/
inc
/
partition_supported_sql_funcs
.
inc
# second(non_time_col) is disabled after bug#54483.
#let $coltype = char(30);
#--source suite/parts/inc/partition_supported_sql_funcs.inc
let
$sqlfunc
=
month
(
col1
);
let
$valsqlfunc
=
month
(
'2006-10-14'
);
...
...
@@ -172,26 +174,28 @@ let $val3 = '21:59:22';
let
$val4
=
'10:33:11'
;
--
source
suite
/
parts
/
inc
/
partition_supported_sql_funcs
.
inc
let
$sqlfunc
=
to_days
(
col1
)
-
to_days
(
'2006-01-01'
);
let
$valsqlfunc
=
to_days
(
'2006-02-02'
)
-
to_days
(
'2006-01-01'
);
let
$coltype
=
date
;
let
$infile
=
part_supported_sql_funcs_int_date
.
inc
;
let
$val1
=
'2006-02-03'
;
let
$val2
=
'2006-01-17'
;
let
$val3
=
'2006-01-25'
;
let
$val4
=
'2006-02-06'
;
--
source
suite
/
parts
/
inc
/
partition_supported_sql_funcs
.
inc
# to_days(non_date_col) is disabled after bug#54483.
#let $sqlfunc = to_days(col1)-to_days('2006-01-01');
#let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01');
#let $coltype = date;
#let $infile = part_supported_sql_funcs_int_date.inc;
#let $val1 = '2006-02-03';
#let $val2 = '2006-01-17';
#let $val3 = '2006-01-25';
#let $val4 = '2006-02-06';
#--source suite/parts/inc/partition_supported_sql_funcs.inc
# to_days(non_date_col) is disabled after bug#54483.
# DATEDIFF() is implemented as (TO_DAYS(d1) - TO_DAYS(d2))
let
$sqlfunc
=
datediff
(
col1
,
'2006-01-01'
);
let
$valsqlfunc
=
datediff
(
'2006-02-02'
,
'2006-01-01'
);
let
$coltype
=
date
;
let
$infile
=
part_supported_sql_funcs_int_date
.
inc
;
let
$val1
=
'2006-02-03'
;
let
$val2
=
'2006-01-17'
;
let
$val3
=
'2006-01-25'
;
let
$val4
=
'2006-02-06'
;
--
source
suite
/
parts
/
inc
/
partition_supported_sql_funcs
.
inc
#
let $sqlfunc = datediff(col1, '2006-01-01');
#
let $valsqlfunc = datediff('2006-02-02', '2006-01-01');
#
let $coltype = date;
#
let $infile = part_supported_sql_funcs_int_date.inc;
#
let $val1 = '2006-02-03';
#
let $val2 = '2006-01-17';
#
let $val3 = '2006-01-25';
#
let $val4 = '2006-02-06';
#
--source suite/parts/inc/partition_supported_sql_funcs.inc
let
$sqlfunc
=
weekday
(
col1
);
let
$valsqlfunc
=
weekday
(
'2006-10-14'
);
...
...
mysql-test/suite/parts/r/part_supported_sql_func_innodb.result
View file @
b56308e6
This diff is collapsed.
Click to expand it.
mysql-test/suite/parts/r/part_supported_sql_func_myisam.result
View file @
b56308e6
This diff is collapsed.
Click to expand it.
mysql-test/t/partition.test
View file @
b56308e6
...
...
@@ -1898,15 +1898,16 @@ while ($cnt)
drop
table
t1
;
#
# BUG#32
2
72: partition crash 1: enum column
# BUG#32
7
72: partition crash 1: enum column
#
# Note that month(int_col) is disallowed after bug#54483.
create
table
t1
(
c0
int
,
c1
bigint
,
c2
set
(
'sweet'
),
key
(
c2
,
c1
,
c0
),
key
(
c0
)
)
engine
=
myisam
partition
by
hash
(
month
(
c0
)
)
partitions
5
;
)
engine
=
myisam
partition
by
hash
(
c0
)
partitions
5
;
--
disable_warnings
insert
ignore
into
t1
set
c0
=
-
6502262
,
c1
=
3992917
,
c2
=
35019
;
...
...
mysql-test/t/partition_error.test
View file @
b56308e6
This diff is collapsed.
Click to expand it.
sql/item.h
View file @
b56308e6
...
...
@@ -1092,11 +1092,11 @@ class Item {
virtual
bool
set_no_const_sub
(
uchar
*
arg
)
{
return
FALSE
;
}
virtual
Item
*
replace_equal_field
(
uchar
*
arg
)
{
return
this
;
}
/*
Check if an expression value
depends on the current timezone. Used by
partitioning code to reject timezone-dependent expressions in a
(sub)partitioning function.
Check if an expression value
has allowed arguments, like DATE/DATETIME
for date functions. Also used by partitioning code to reject
timezone-dependent expressions in a
(sub)partitioning function.
*/
virtual
bool
is_timezone_dependent
_processor
(
uchar
*
bool_arg
)
virtual
bool
check_valid_arguments
_processor
(
uchar
*
bool_arg
)
{
return
FALSE
;
}
...
...
sql/item_func.h
View file @
b56308e6
...
...
@@ -237,6 +237,7 @@ class Item_func :public Item_result_field
{
return
(
error
==
E_DEC_OVERFLOW
)
?
raise_decimal_overflow
()
:
error
;
}
bool
has_timestamp_args
()
{
DBUG_ASSERT
(
fixed
==
TRUE
);
...
...
@@ -248,6 +249,45 @@ class Item_func :public Item_result_field
}
return
FALSE
;
}
bool
has_date_args
()
{
DBUG_ASSERT
(
fixed
==
TRUE
);
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
if
(
args
[
i
]
->
type
()
==
Item
::
FIELD_ITEM
&&
(
args
[
i
]
->
field_type
()
==
MYSQL_TYPE_DATE
||
args
[
i
]
->
field_type
()
==
MYSQL_TYPE_DATETIME
))
return
TRUE
;
}
return
FALSE
;
}
bool
has_time_args
()
{
DBUG_ASSERT
(
fixed
==
TRUE
);
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
if
(
args
[
i
]
->
type
()
==
Item
::
FIELD_ITEM
&&
(
args
[
i
]
->
field_type
()
==
MYSQL_TYPE_TIME
||
args
[
i
]
->
field_type
()
==
MYSQL_TYPE_DATETIME
))
return
TRUE
;
}
return
FALSE
;
}
bool
has_datetime_args
()
{
DBUG_ASSERT
(
fixed
==
TRUE
);
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
if
(
args
[
i
]
->
type
()
==
Item
::
FIELD_ITEM
&&
args
[
i
]
->
field_type
()
==
MYSQL_TYPE_DATETIME
)
return
TRUE
;
}
return
FALSE
;
}
/*
We assume the result of any function that has a TIMESTAMP argument to be
timezone-dependent, since a TIMESTAMP value in both numeric and string
...
...
@@ -256,7 +296,7 @@ class Item_func :public Item_result_field
representation of a TIMESTAMP argument verbatim, and thus does not depend on
the timezone.
*/
virtual
bool
is_timezone_dependent
_processor
(
uchar
*
bool_arg
)
virtual
bool
check_valid_arguments
_processor
(
uchar
*
bool_arg
)
{
return
has_timestamp_args
();
}
...
...
sql/item_timefunc.h
View file @
b56308e6
...
...
@@ -75,6 +75,10 @@ class Item_func_to_days :public Item_int_func
enum_monotonicity_info
get_monotonicity_info
()
const
;
longlong
val_int_endpoint
(
bool
left_endp
,
bool
*
incl_endp
);
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_date_args
();
}
};
...
...
@@ -102,6 +106,12 @@ class Item_func_to_seconds :public Item_int_func
*
input_version
=
output_version
;
return
0
;
}
/* Only meaningful with date part and optional time part */
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_date_args
();
}
};
...
...
@@ -118,6 +128,10 @@ class Item_func_dayofmonth :public Item_int_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_date_args
();
}
};
...
...
@@ -142,6 +156,10 @@ class Item_func_month :public Item_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_date_args
();
}
};
...
...
@@ -171,6 +189,10 @@ class Item_func_dayofyear :public Item_int_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_date_args
();
}
};
...
...
@@ -187,6 +209,10 @@ class Item_func_hour :public Item_int_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_time_args
();
}
};
...
...
@@ -203,6 +229,10 @@ class Item_func_minute :public Item_int_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_time_args
();
}
};
...
...
@@ -219,6 +249,10 @@ class Item_func_quarter :public Item_int_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_date_args
();
}
};
...
...
@@ -235,6 +269,10 @@ class Item_func_second :public Item_int_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_time_args
();
}
};
...
...
@@ -265,6 +303,10 @@ class Item_func_yearweek :public Item_int_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_date_args
();
}
};
...
...
@@ -283,6 +325,10 @@ class Item_func_year :public Item_int_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_date_args
();
}
};
...
...
@@ -312,6 +358,10 @@ class Item_func_weekday :public Item_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_date_args
();
}
};
class
Item_func_dayname
:
public
Item_func_weekday
...
...
@@ -341,7 +391,7 @@ class Item_func_unix_timestamp :public Item_int_func
(and thus may not be used as a partitioning function)
when its argument is NOT of the TIMESTAMP type.
*/
bool
is_timezone_dependent
_processor
(
uchar
*
int_arg
)
bool
check_valid_arguments
_processor
(
uchar
*
int_arg
)
{
return
!
has_timestamp_args
();
}
...
...
@@ -366,6 +416,10 @@ class Item_func_time_to_sec :public Item_int_func
max_length
=
10
*
MY_CHARSET_BIN_MB_MAXLEN
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_time_args
();
}
};
...
...
@@ -621,6 +675,10 @@ class Item_func_from_days :public Item_date
const
char
*
func_name
()
const
{
return
"from_days"
;
}
bool
get_date
(
MYSQL_TIME
*
res
,
uint
fuzzy_date
);
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
has_date_args
()
||
has_time_args
();
}
};
...
...
@@ -746,6 +804,42 @@ class Item_extract :public Item_int_func
bool
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
;
virtual
void
print
(
String
*
str
,
enum_query_type
query_type
);
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
switch
(
int_type
)
{
case
INTERVAL_YEAR
:
case
INTERVAL_YEAR_MONTH
:
case
INTERVAL_QUARTER
:
case
INTERVAL_MONTH
:
/* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */
case
INTERVAL_DAY
:
return
!
has_date_args
();
case
INTERVAL_DAY_HOUR
:
case
INTERVAL_DAY_MINUTE
:
case
INTERVAL_DAY_SECOND
:
case
INTERVAL_DAY_MICROSECOND
:
return
!
has_datetime_args
();
case
INTERVAL_HOUR
:
case
INTERVAL_HOUR_MINUTE
:
case
INTERVAL_HOUR_SECOND
:
case
INTERVAL_MINUTE
:
case
INTERVAL_MINUTE_SECOND
:
case
INTERVAL_SECOND
:
case
INTERVAL_MICROSECOND
:
case
INTERVAL_HOUR_MICROSECOND
:
case
INTERVAL_MINUTE_MICROSECOND
:
case
INTERVAL_SECOND_MICROSECOND
:
return
!
has_time_args
();
default:
/*
INTERVAL_LAST is only an end marker,
INTERVAL_WEEK depends on default_week_format which is a session
variable and cannot be used for partitioning. See bug#57071.
*/
break
;
}
return
true
;
}
};
...
...
@@ -991,6 +1085,10 @@ class Item_func_microsecond :public Item_int_func
maybe_null
=
1
;
}
bool
check_partition_func_processor
(
uchar
*
int_arg
)
{
return
FALSE
;}
bool
check_valid_arguments_processor
(
uchar
*
int_arg
)
{
return
!
has_time_args
();
}
};
...
...
sql/sql_partition.cc
View file @
b56308e6
...
...
@@ -1130,12 +1130,13 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
}
/*
We don't allow creating partitions with timezone-dependent expressions as
a (sub)partitioning function, but we want to allow such expressions when
opening existing tables for easier maintenance. This exception should be
deprecated at some point in future so that we always throw an error.
We don't allow creating partitions with expressions with non matching
arguments as a (sub)partitioning function,
but we want to allow such expressions when opening existing tables for
easier maintenance. This exception should be deprecated at some point
in future so that we always throw an error.
*/
if
(
func_expr
->
walk
(
&
Item
::
is_timezone_dependent
_processor
,
if
(
func_expr
->
walk
(
&
Item
::
check_valid_arguments
_processor
,
0
,
NULL
))
{
if
(
is_create_table_ind
)
...
...
sql/table.cc
View file @
b56308e6
...
...
@@ -1963,8 +1963,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
{
if
(
work_part_info_used
)
tmp
=
fix_partition_func
(
thd
,
outparam
,
is_create_table
);
outparam
->
part_info
->
item_free_list
=
part_func_arena
.
free_list
;
}
outparam
->
part_info
->
item_free_list
=
part_func_arena
.
free_list
;
partititon_err:
if
(
tmp
)
{
...
...
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