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
12fbe241
Commit
12fbe241
authored
Sep 26, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setting MODE_NO_AUTO_VALUE_ON_ZERO at copying in copy_data_between_tables
parent
a64953ed
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
mysql-test/r/ndb_alter_table.result
mysql-test/r/ndb_alter_table.result
+15
-0
mysql-test/t/ndb_alter_table.test
mysql-test/t/ndb_alter_table.test
+8
-0
sql/sql_table.cc
sql/sql_table.cc
+12
-0
No files found.
mysql-test/r/ndb_alter_table.result
View file @
12fbe241
...
...
@@ -72,6 +72,21 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 100 3 4 5 PENDING 0000-00-00 00:00:00
1 101 3 4 5 PENDING 0000-00-00 00:00:00
2 102 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
delete from t1;
insert into t1 values (0,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
SET SQL_MODE='';
insert into t1 values (1,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
0 0 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
1 103 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
alter table t1 drop column col4_5;
insert into t1 values (2,0,4,3,5,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
col6 col1 col3 fourth col4 col5 col7 col8
0 0 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
1 103 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
2 104 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
drop table t1;
CREATE TABLE t1 (
a INT NOT NULL,
...
...
mysql-test/t/ndb_alter_table.test
View file @
12fbe241
...
...
@@ -47,6 +47,14 @@ select * from t1 order by col1;
insert
into
t1
values
(
2
,
NULL
,
4
,
3
,
5
,
99
,
"PENDING"
,
"EXTRA"
,
'2004-01-01 00:00:00'
);
show
table
status
;
select
*
from
t1
order
by
col1
;
delete
from
t1
;
insert
into
t1
values
(
0
,
0
,
4
,
3
,
5
,
99
,
"PENDING"
,
"EXTRA"
,
'2004-01-01 00:00:00'
);
SET
SQL_MODE
=
''
;
insert
into
t1
values
(
1
,
0
,
4
,
3
,
5
,
99
,
"PENDING"
,
"EXTRA"
,
'2004-01-01 00:00:00'
);
select
*
from
t1
order
by
col1
;
alter
table
t1
drop
column
col4_5
;
insert
into
t1
values
(
2
,
0
,
4
,
3
,
5
,
"PENDING"
,
"EXTRA"
,
'2004-01-01 00:00:00'
);
select
*
from
t1
order
by
col1
;
drop
table
t1
;
...
...
sql/sql_table.cc
View file @
12fbe241
...
...
@@ -3303,6 +3303,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
List
<
Item
>
all_fields
;
ha_rows
examined_rows
;
bool
auto_increment_field_copied
=
0
;
ulong
old_sql_mode
;
bool
no_auto_on_zero
;
DBUG_ENTER
(
"copy_data_between_tables"
);
if
(
!
(
copy
=
new
Copy_field
[
to
->
fields
]))
...
...
@@ -3361,6 +3363,11 @@ copy_data_between_tables(TABLE *from,TABLE *to,
goto
err
;
}
/* Turn on NO_AUTO_VALUE_ON_ZERO if not already on */
old_sql_mode
=
thd
->
variables
.
sql_mode
;
if
(
!
(
no_auto_on_zero
=
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_VALUE_ON_ZERO
))
thd
->
variables
.
sql_mode
|=
MODE_NO_AUTO_VALUE_ON_ZERO
;
/* Handler must be told explicitly to retrieve all columns, because
this function does not set field->query_id in the columns to the
current query id */
...
...
@@ -3417,6 +3424,11 @@ copy_data_between_tables(TABLE *from,TABLE *to,
to
->
file
->
extra
(
HA_EXTRA_NO_IGNORE_DUP_KEY
);
ha_enable_transaction
(
thd
,
TRUE
);
/* Turn off NO_AUTO_VALUE_ON_ZERO if it was not already off */
if
(
!
no_auto_on_zero
)
thd
->
variables
.
sql_mode
=
old_sql_mode
;
/*
Ensure that the new table is saved properly to disk so that we
can do a rename
...
...
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