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
7e0c8fc3
Commit
7e0c8fc3
authored
May 21, 2017
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12389 ADD CHECK leaves an orphaned .par file
parent
152aec01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
1 deletion
+83
-1
mysql-test/r/partition_alter.result
mysql-test/r/partition_alter.result
+41
-0
mysql-test/t/partition_alter.test
mysql-test/t/partition_alter.test
+39
-0
sql/sql_table.cc
sql/sql_table.cc
+3
-1
No files found.
mysql-test/r/partition_alter.result
View file @
7e0c8fc3
...
...
@@ -51,3 +51,44 @@ execute stmt;
execute stmt;
deallocate prepare stmt;
drop table test_data;
create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
engine=innodb
partition by range columns (d) (
partition p1 values less than ('2016-10-18'),
partition p2 values less than ('2020-10-19'));
insert t1 values (0, '2000-01-02', 0);
insert t1 values (1, '2020-01-02', 10);
alter table t1 add check (b in (0, 1));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`d` date NOT NULL,
`b` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`d`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50500 PARTITION BY RANGE COLUMNS(d)
(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = InnoDB) */
insert t1 values (2, '2020-01-03', 20);
drop table t1;
create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
partition by range columns (d) (
partition p1 values less than ('2016-10-18'),
partition p2 values less than ('2020-10-19'));
insert t1 values (0, '2000-01-02', 0);
insert t1 values (1, '2020-01-02', 10);
alter table t1 add check (b in (0, 1));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`d` date NOT NULL,
`b` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50500 PARTITION BY RANGE COLUMNS(d)
(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = MyISAM) */
insert t1 values (2, '2020-01-03', 20);
drop table t1;
mysql-test/t/partition_alter.test
View file @
7e0c8fc3
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_partition
.
inc
CREATE
TABLE
`test_data`
(
...
...
@@ -64,3 +65,41 @@ deallocate prepare stmt;
drop
table
test_data
;
#
# MDEV-12389 ADD CHECK leaves an orphaned .par file
#
--
let
$datadir
=
`SELECT @@datadir`
# InnoDB
create
table
t1
(
id
int
,
d
date
not
null
,
b
bool
not
null
default
0
,
primary
key
(
id
,
d
))
engine
=
innodb
partition
by
range
columns
(
d
)
(
partition
p1
values
less
than
(
'2016-10-18'
),
partition
p2
values
less
than
(
'2020-10-19'
));
insert
t1
values
(
0
,
'2000-01-02'
,
0
);
insert
t1
values
(
1
,
'2020-01-02'
,
10
);
# should fail in 10.2
alter
table
t1
add
check
(
b
in
(
0
,
1
));
# should have CHECK in 10.2
show
create
table
t1
;
# should fail in 10.2
insert
t1
values
(
2
,
'2020-01-03'
,
20
);
drop
table
t1
;
--
list_files
$datadir
/
test
# MyISAM, different execution path
create
table
t1
(
id
int
,
d
date
not
null
,
b
bool
not
null
default
0
,
primary
key
(
id
,
d
))
partition
by
range
columns
(
d
)
(
partition
p1
values
less
than
(
'2016-10-18'
),
partition
p2
values
less
than
(
'2020-10-19'
));
insert
t1
values
(
0
,
'2000-01-02'
,
0
);
insert
t1
values
(
1
,
'2020-01-02'
,
10
);
# should fail in 10.2
alter
table
t1
add
check
(
b
in
(
0
,
1
));
# should have CHECK in 10.2
show
create
table
t1
;
# should fail in 10.2
insert
t1
values
(
2
,
'2020-01-03'
,
20
);
drop
table
t1
;
--
list_files
$datadir
/
test
sql/sql_table.cc
View file @
7e0c8fc3
...
...
@@ -8856,7 +8856,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
TODO don't create the frm in the first place
*/
deletefrm
(
alter_ctx
.
get_tmp_path
());
const
char
*
path
=
alter_ctx
.
get_tmp_path
();
table
->
file
->
ha_create_partitioning_metadata
(
path
,
NULL
,
CHF_DELETE_FLAG
);
deletefrm
(
path
);
my_free
(
const_cast
<
uchar
*>
(
frm
.
str
));
goto
end_inplace
;
}
...
...
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