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
2abf030a
Commit
2abf030a
authored
May 25, 2010
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
c99e6287
b183e7c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
15 deletions
+130
-15
mysql-test/r/partition_error.result
mysql-test/r/partition_error.result
+70
-0
mysql-test/t/partition_error.test
mysql-test/t/partition_error.test
+34
-1
sql/partition_info.cc
sql/partition_info.cc
+26
-14
No files found.
mysql-test/r/partition_error.result
View file @
2abf030a
drop table if exists t1;
#
# Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with
# subpartitions
SET @org_mode=@@sql_mode;
SET @@sql_mode='NO_DIR_IN_CREATE';
SELECT @@sql_mode;
@@sql_mode
NO_DIR_IN_CREATE
CREATE TABLE t1 (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN MAXVALUE
DATA DIRECTORY = '/tmp/not-existing'
INDEX DIRECTORY = '/tmp/not-existing');
Warnings:
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (YEAR(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
DROP TABLE t1;
CREATE TABLE t1 (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased)) SUBPARTITIONS 2
(PARTITION p0 VALUES LESS THAN MAXVALUE
(SUBPARTITION sp0
DATA DIRECTORY = '/tmp/not-existing'
INDEX DIRECTORY = '/tmp/not-existing',
SUBPARTITION sp1));
Warnings:
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (YEAR(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN MAXVALUE
(SUBPARTITION sp0 ENGINE = MyISAM,
SUBPARTITION sp1 ENGINE = MyISAM)) */
DROP TABLE t1;
CREATE TABLE t1 (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
(PARTITION p0 VALUES LESS THAN MAXVALUE
DATA DIRECTORY = '/tmp/not-existing'
INDEX DIRECTORY = '/tmp/not-existing');
Warnings:
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (YEAR(purchased))
(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
DROP TABLE t1;
SET @@sql_mode= @org_mode;
#
# Bug#50392: insert_id is not reset for partitioned tables
# auto_increment on duplicate entry
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
...
...
mysql-test/t/partition_error.test
View file @
2abf030a
...
...
@@ -7,7 +7,40 @@
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
--
echo
#
--
echo
# Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with
--
echo
# subpartitions
SET
@
org_mode
=@@
sql_mode
;
SET
@@
sql_mode
=
'NO_DIR_IN_CREATE'
;
SELECT
@@
sql_mode
;
CREATE
TABLE
t1
(
id
INT
,
purchased
DATE
)
PARTITION
BY
RANGE
(
YEAR
(
purchased
))
SUBPARTITION
BY
HASH
(
TO_DAYS
(
purchased
))
(
PARTITION
p0
VALUES
LESS
THAN
MAXVALUE
DATA
DIRECTORY
=
'/tmp/not-existing'
INDEX
DIRECTORY
=
'/tmp/not-existing'
);
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
id
INT
,
purchased
DATE
)
PARTITION
BY
RANGE
(
YEAR
(
purchased
))
SUBPARTITION
BY
HASH
(
TO_DAYS
(
purchased
))
SUBPARTITIONS
2
(
PARTITION
p0
VALUES
LESS
THAN
MAXVALUE
(
SUBPARTITION
sp0
DATA
DIRECTORY
=
'/tmp/not-existing'
INDEX
DIRECTORY
=
'/tmp/not-existing'
,
SUBPARTITION
sp1
));
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
id
INT
,
purchased
DATE
)
PARTITION
BY
RANGE
(
YEAR
(
purchased
))
(
PARTITION
p0
VALUES
LESS
THAN
MAXVALUE
DATA
DIRECTORY
=
'/tmp/not-existing'
INDEX
DIRECTORY
=
'/tmp/not-existing'
);
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
SET
@@
sql_mode
=
@
org_mode
;
--
echo
#
--
echo
# Bug#50392: insert_id is not reset for partitioned tables
--
echo
# auto_increment on duplicate entry
...
...
sql/partition_info.cc
View file @
2abf030a
...
...
@@ -1032,6 +1032,30 @@ bool partition_info::check_list_constants(THD *thd)
DBUG_RETURN
(
result
);
}
/**
Check if we allow DATA/INDEX DIRECTORY, if not warn and set them to NULL.
@param thd THD also containing sql_mode (looks from MODE_NO_DIR_IN_CREATE).
@param part_elem partition_element to check.
*/
static
void
warn_if_dir_in_part_elem
(
THD
*
thd
,
partition_element
*
part_elem
)
{
#ifdef HAVE_READLINK
if
(
!
my_use_symdir
||
(
thd
->
variables
.
sql_mode
&
MODE_NO_DIR_IN_CREATE
))
#endif
{
if
(
part_elem
->
data_file_name
)
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_OPTION_IGNORED
,
ER
(
WARN_OPTION_IGNORED
),
"DATA DIRECTORY"
);
if
(
part_elem
->
index_file_name
)
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_OPTION_IGNORED
,
ER
(
WARN_OPTION_IGNORED
),
"INDEX DIRECTORY"
);
part_elem
->
data_file_name
=
part_elem
->
index_file_name
=
NULL
;
}
}
/*
This code is used early in the CREATE TABLE and ALTER TABLE process.
...
...
@@ -1169,20 +1193,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
do
{
partition_element
*
part_elem
=
part_it
++
;
#ifdef HAVE_READLINK
if
(
!
my_use_symdir
||
(
thd
->
variables
.
sql_mode
&
MODE_NO_DIR_IN_CREATE
))
#endif
{
if
(
part_elem
->
data_file_name
)
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_OPTION_IGNORED
,
ER
(
WARN_OPTION_IGNORED
),
"DATA DIRECTORY"
);
if
(
part_elem
->
index_file_name
)
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_OPTION_IGNORED
,
ER
(
WARN_OPTION_IGNORED
),
"INDEX DIRECTORY"
);
part_elem
->
data_file_name
=
part_elem
->
index_file_name
=
NULL
;
}
warn_if_dir_in_part_elem
(
thd
,
part_elem
);
if
(
!
is_sub_partitioned
())
{
if
(
part_elem
->
engine_type
==
NULL
)
...
...
@@ -1208,6 +1219,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
do
{
sub_elem
=
sub_it
++
;
warn_if_dir_in_part_elem
(
thd
,
sub_elem
);
if
(
check_table_name
(
sub_elem
->
partition_name
,
strlen
(
sub_elem
->
partition_name
)))
{
...
...
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