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
37a86b93
Commit
37a86b93
authored
Oct 06, 2022
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.3 into 10.4
parents
3708bef6
074e3582
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
6 deletions
+97
-6
mysql-test/main/create_or_replace.result
mysql-test/main/create_or_replace.result
+9
-0
mysql-test/main/create_or_replace.test
mysql-test/main/create_or_replace.test
+12
-0
mysql-test/main/partition_alter.result
mysql-test/main/partition_alter.result
+11
-0
mysql-test/main/partition_alter.test
mysql-test/main/partition_alter.test
+11
-0
sql/sql_list.h
sql/sql_list.h
+6
-6
sql/sql_table.cc
sql/sql_table.cc
+48
-0
No files found.
mysql-test/main/create_or_replace.result
View file @
37a86b93
...
@@ -567,4 +567,13 @@ SELECT * FROM t3;
...
@@ -567,4 +567,13 @@ SELECT * FROM t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES
ERROR HY000: Table 't3' was not locked with LOCK TABLES
UNLOCK TABLES;
UNLOCK TABLES;
DROP TABLE t3;
DROP TABLE t3;
#
# MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status
# upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED
#
CREATE TABLE t (a INT) ENGINE=MyISAM;
CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t);
CREATE OR REPLACE TABLE t LIKE tm;
ERROR HY000: Table 'tm' is specified twice, both as a target for 'CREATE' and as a separate source for data
DROP TABLE IF EXISTS tm, t;
# End of 10.4 tests
# End of 10.4 tests
mysql-test/main/create_or_replace.test
View file @
37a86b93
...
@@ -507,4 +507,16 @@ SELECT * FROM t3;
...
@@ -507,4 +507,16 @@ SELECT * FROM t3;
UNLOCK
TABLES
;
UNLOCK
TABLES
;
DROP
TABLE
t3
;
DROP
TABLE
t3
;
--
echo
#
--
echo
# MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status
--
echo
# upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED
--
echo
#
CREATE
TABLE
t
(
a
INT
)
ENGINE
=
MyISAM
;
CREATE
TABLE
tm
(
a
INT
)
ENGINE
=
MERGE
UNION
(
t
);
--
error
ER_UPDATE_TABLE_USED
CREATE
OR
REPLACE
TABLE
t
LIKE
tm
;
# Cleanup
DROP
TABLE
IF
EXISTS
tm
,
t
;
--
echo
# End of 10.4 tests
--
echo
# End of 10.4 tests
mysql-test/main/partition_alter.result
View file @
37a86b93
...
@@ -200,4 +200,15 @@ pk
...
@@ -200,4 +200,15 @@ pk
2
2
delete from t1;
delete from t1;
drop table t1;
drop table t1;
#
# MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
#
create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2));
insert into t values (0, 1), (2, 2);
alter table t change b f int, change a b int, algorithm=nocopy;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
delete from t order by b limit 1;
drop table t;
# End of 10.3 tests
# End of 10.3 tests
mysql-test/main/partition_alter.test
View file @
37a86b93
...
@@ -185,4 +185,15 @@ select * from t1 partition(p1);
...
@@ -185,4 +185,15 @@ select * from t1 partition(p1);
delete
from
t1
;
delete
from
t1
;
drop
table
t1
;
drop
table
t1
;
--
echo
#
--
echo
# MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
--
echo
#
create
table
t
(
a
int
,
b
int
)
partition
by
list
(
b
)
(
partition
p1
values
in
(
1
,
2
));
insert
into
t
values
(
0
,
1
),
(
2
,
2
);
alter
table
t
change
b
f
int
,
change
a
b
int
,
algorithm
=
nocopy
;
check
table
t
;
delete
from
t
order
by
b
limit
1
;
# cleanup
drop
table
t
;
--
echo
# End of 10.3 tests
--
echo
# End of 10.3 tests
sql/sql_list.h
View file @
37a86b93
...
@@ -119,8 +119,8 @@ struct list_node :public Sql_alloc
...
@@ -119,8 +119,8 @@ struct list_node :public Sql_alloc
{
{
list_node
*
next
;
list_node
*
next
;
void
*
info
;
void
*
info
;
list_node
(
void
*
info_par
,
list_node
*
next_par
)
list_node
(
const
void
*
info_par
,
list_node
*
next_par
)
:
next
(
next_par
),
info
(
info_par
)
:
next
(
next_par
),
info
(
const_cast
<
void
*>
(
info_par
)
)
{}
{}
list_node
()
/* For end_of_list */
list_node
()
/* For end_of_list */
{
{
...
@@ -385,7 +385,7 @@ class base_list :public Sql_alloc
...
@@ -385,7 +385,7 @@ class base_list :public Sql_alloc
#endif // LIST_EXTRA_DEBUG
#endif // LIST_EXTRA_DEBUG
protected:
protected:
void
after
(
void
*
info
,
list_node
*
node
)
void
after
(
const
void
*
info
,
list_node
*
node
)
{
{
list_node
*
new_node
=
new
list_node
(
info
,
node
->
next
);
list_node
*
new_node
=
new
list_node
(
info
,
node
->
next
);
node
->
next
=
new_node
;
node
->
next
=
new_node
;
...
@@ -446,11 +446,11 @@ class base_list_iterator
...
@@ -446,11 +446,11 @@ class base_list_iterator
{
{
el
=
&
list
->
first
;
el
=
&
list
->
first
;
}
}
inline
void
*
replace
(
void
*
element
)
inline
void
*
replace
(
const
void
*
element
)
{
// Return old element
{
// Return old element
void
*
tmp
=
current
->
info
;
void
*
tmp
=
current
->
info
;
DBUG_ASSERT
(
current
->
info
!=
0
);
DBUG_ASSERT
(
current
->
info
!=
0
);
current
->
info
=
element
;
current
->
info
=
const_cast
<
void
*>
(
element
)
;
return
tmp
;
return
tmp
;
}
}
void
*
replace
(
base_list
&
new_list
)
void
*
replace
(
base_list
&
new_list
)
...
@@ -473,7 +473,7 @@ class base_list_iterator
...
@@ -473,7 +473,7 @@ class base_list_iterator
el
=
prev
;
el
=
prev
;
current
=
0
;
// Safeguard
current
=
0
;
// Safeguard
}
}
void
after
(
void
*
element
)
// Insert element after current
void
after
(
const
void
*
element
)
// Insert element after current
{
{
list
->
after
(
element
,
current
);
list
->
after
(
element
,
current
);
current
=
current
->
next
;
current
=
current
->
next
;
...
...
sql/sql_table.cc
View file @
37a86b93
...
@@ -5772,6 +5772,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
...
@@ -5772,6 +5772,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
if
((
duplicate
=
unique_table
(
thd
,
table
,
src_table
,
0
)))
if
((
duplicate
=
unique_table
(
thd
,
table
,
src_table
,
0
)))
{
{
update_non_unique_table_error
(
src_table
,
"CREATE"
,
duplicate
);
update_non_unique_table_error
(
src_table
,
"CREATE"
,
duplicate
);
res
=
1
;
goto
err
;
goto
err
;
}
}
}
}
...
@@ -8055,6 +8056,20 @@ void append_drop_column(THD *thd, String *str, Field *field)
...
@@ -8055,6 +8056,20 @@ void append_drop_column(THD *thd, String *str, Field *field)
}
}
static
inline
void
rename_field_in_list
(
Create_field
*
field
,
List
<
const
char
>
*
field_list
)
{
DBUG_ASSERT
(
field
->
change
.
str
);
List_iterator
<
const
char
>
it
(
*
field_list
);
while
(
const
char
*
name
=
it
++
)
{
if
(
my_strcasecmp
(
system_charset_info
,
name
,
field
->
change
.
str
))
continue
;
it
.
replace
(
field
->
field_name
.
str
);
}
}
/**
/**
Prepare column and key definitions for CREATE TABLE in ALTER TABLE.
Prepare column and key definitions for CREATE TABLE in ALTER TABLE.
...
@@ -8365,6 +8380,39 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
...
@@ -8365,6 +8380,39 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
new_create_tail
.
push_back
(
def
,
thd
->
mem_root
);
new_create_tail
.
push_back
(
def
,
thd
->
mem_root
);
}
}
}
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
if
(
alter_info
->
flags
&
ALTER_RENAME_COLUMN
)
{
if
(
thd
->
work_part_info
)
{
partition_info
*
part_info
=
thd
->
work_part_info
;
List_iterator
<
Create_field
>
def_it
(
column_rename_param
.
fields
);
const
bool
part_field_list
=
!
part_info
->
part_field_list
.
is_empty
();
const
bool
subpart_field_list
=
!
part_info
->
subpart_field_list
.
is_empty
();
if
(
part_info
->
part_expr
)
part_info
->
part_expr
->
walk
(
&
Item
::
rename_fields_processor
,
1
,
&
column_rename_param
);
if
(
part_info
->
subpart_expr
)
part_info
->
subpart_expr
->
walk
(
&
Item
::
rename_fields_processor
,
1
,
&
column_rename_param
);
if
(
part_field_list
||
subpart_field_list
)
{
while
(
Create_field
*
def
=
def_it
++
)
{
if
(
def
->
change
.
str
)
{
if
(
part_field_list
)
rename_field_in_list
(
def
,
&
part_info
->
part_field_list
);
if
(
subpart_field_list
)
rename_field_in_list
(
def
,
&
part_info
->
subpart_field_list
);
}
/* if (def->change.str) */
}
/* while (def) */
}
/* if (part_field_list || subpart_field_list) */
}
/* if (part_info) */
}
#endif
dropped_sys_vers_fields
&=
VERS_SYSTEM_FIELD
;
dropped_sys_vers_fields
&=
VERS_SYSTEM_FIELD
;
if
((
dropped_sys_vers_fields
||
if
((
dropped_sys_vers_fields
||
alter_info
->
flags
&
ALTER_DROP_PERIOD
)
&&
alter_info
->
flags
&
ALTER_DROP_PERIOD
)
&&
...
...
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