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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c5e2fbcc
Commit
c5e2fbcc
authored
Jul 30, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no_auto_value_on_zero + alter table bug
parent
97238e18
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
13 deletions
+29
-13
mysql-test/r/auto_increment.result
mysql-test/r/auto_increment.result
+11
-7
mysql-test/t/auto_increment.test
mysql-test/t/auto_increment.test
+5
-0
sql/sql_table.cc
sql/sql_table.cc
+13
-6
No files found.
mysql-test/r/auto_increment.result
View file @
c5e2fbcc
...
@@ -206,18 +206,25 @@ select * from t1 order by b;
...
@@ -206,18 +206,25 @@ select * from t1 order by b;
a b
a b
1 1
1 1
200 2
200 2
205
3
0
3
201 4
201 4
202 5
202 5
203 6
203 6
204 7
204 7
create table t2 (a int);
insert t2 values (1),(2);
alter table t2 add b int auto_increment primary key;
select * from t2;
a b
1 1
2 2
drop table t2;
delete from t1 where a=0;
delete from t1 where a=0;
update t1 set a=0 where b=5;
update t1 set a=0 where b=5;
select * from t1 order by b;
select * from t1 order by b;
a b
a b
1 1
1 1
200 2
200 2
205 3
201 4
201 4
0 5
0 5
203 6
203 6
...
@@ -225,7 +232,7 @@ a b
...
@@ -225,7 +232,7 @@ a b
delete from t1 where a=0;
delete from t1 where a=0;
update t1 set a=NULL where b=6;
update t1 set a=NULL where b=6;
Warnings:
Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row
5
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row
4
update t1 set a=300 where b=7;
update t1 set a=300 where b=7;
SET SQL_MODE='';
SET SQL_MODE='';
insert into t1(a,b)values(NULL,8);
insert into t1(a,b)values(NULL,8);
...
@@ -239,7 +246,6 @@ select * from t1 order by b;
...
@@ -239,7 +246,6 @@ select * from t1 order by b;
a b
a b
1 1
1 1
200 2
200 2
205 3
201 4
201 4
0 6
0 6
300 7
300 7
...
@@ -256,7 +262,6 @@ select * from t1 order by b;
...
@@ -256,7 +262,6 @@ select * from t1 order by b;
a b
a b
1 1
1 1
200 2
200 2
205 3
201 4
201 4
300 7
300 7
301 8
301 8
...
@@ -269,13 +274,12 @@ a b
...
@@ -269,13 +274,12 @@ a b
delete from t1 where a=0;
delete from t1 where a=0;
update t1 set a=NULL where b=13;
update t1 set a=NULL where b=13;
Warnings:
Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row
10
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row
9
update t1 set a=500 where b=14;
update t1 set a=500 where b=14;
select * from t1 order by b;
select * from t1 order by b;
a b
a b
1 1
1 1
200 2
200 2
205 3
201 4
201 4
300 7
300 7
301 8
301 8
...
...
mysql-test/t/auto_increment.test
View file @
c5e2fbcc
...
@@ -140,6 +140,11 @@ insert into t1(b)values(7);
...
@@ -140,6 +140,11 @@ insert into t1(b)values(7);
select
*
from
t1
order
by
b
;
select
*
from
t1
order
by
b
;
alter
table
t1
modify
b
mediumint
;
alter
table
t1
modify
b
mediumint
;
select
*
from
t1
order
by
b
;
select
*
from
t1
order
by
b
;
create
table
t2
(
a
int
);
insert
t2
values
(
1
),(
2
);
alter
table
t2
add
b
int
auto_increment
primary
key
;
select
*
from
t2
;
drop
table
t2
;
delete
from
t1
where
a
=
0
;
delete
from
t1
where
a
=
0
;
update
t1
set
a
=
0
where
b
=
5
;
update
t1
set
a
=
0
where
b
=
5
;
select
*
from
t1
order
by
b
;
select
*
from
t1
order
by
b
;
...
...
sql/sql_table.cc
View file @
c5e2fbcc
...
@@ -3271,13 +3271,12 @@ copy_data_between_tables(TABLE *from,TABLE *to,
...
@@ -3271,13 +3271,12 @@ copy_data_between_tables(TABLE *from,TABLE *to,
ha_rows
*
deleted
)
ha_rows
*
deleted
)
{
{
int
error
;
int
error
;
Copy_field
*
copy
,
*
copy_end
;
Copy_field
*
copy
,
*
copy_end
,
*
next_field
;
ulong
found_count
,
delete_count
;
ulong
found_count
,
delete_count
;
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
uint
length
;
uint
length
;
SORT_FIELD
*
sortorder
;
SORT_FIELD
*
sortorder
;
READ_RECORD
info
;
READ_RECORD
info
;
Field
*
next_field
;
TABLE_LIST
tables
;
TABLE_LIST
tables
;
List
<
Item
>
fields
;
List
<
Item
>
fields
;
List
<
Item
>
all_fields
;
List
<
Item
>
all_fields
;
...
@@ -3298,9 +3297,14 @@ copy_data_between_tables(TABLE *from,TABLE *to,
...
@@ -3298,9 +3297,14 @@ copy_data_between_tables(TABLE *from,TABLE *to,
{
{
def
=
it
++
;
def
=
it
++
;
if
(
def
->
field
)
if
(
def
->
field
)
{
if
(
*
ptr
==
to
->
next_number_field
)
next_field
=
copy_end
;
(
copy_end
++
)
->
set
(
*
ptr
,
def
->
field
,
0
);
(
copy_end
++
)
->
set
(
*
ptr
,
def
->
field
,
0
);
}
}
}
found_count
=
delete_count
=
0
;
found_count
=
delete_count
=
0
;
if
(
order
)
if
(
order
)
...
@@ -3343,7 +3347,6 @@ copy_data_between_tables(TABLE *from,TABLE *to,
...
@@ -3343,7 +3347,6 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if
(
handle_duplicates
==
DUP_IGNORE
||
if
(
handle_duplicates
==
DUP_IGNORE
||
handle_duplicates
==
DUP_REPLACE
)
handle_duplicates
==
DUP_REPLACE
)
to
->
file
->
extra
(
HA_EXTRA_IGNORE_DUP_KEY
);
to
->
file
->
extra
(
HA_EXTRA_IGNORE_DUP_KEY
);
next_field
=
to
->
next_number_field
;
thd
->
row_count
=
0
;
thd
->
row_count
=
0
;
while
(
!
(
error
=
info
.
read_record
(
&
info
)))
while
(
!
(
error
=
info
.
read_record
(
&
info
)))
{
{
...
@@ -3354,10 +3357,14 @@ copy_data_between_tables(TABLE *from,TABLE *to,
...
@@ -3354,10 +3357,14 @@ copy_data_between_tables(TABLE *from,TABLE *to,
break
;
break
;
}
}
thd
->
row_count
++
;
thd
->
row_count
++
;
if
(
next
_field
)
if
(
to
->
next_number
_field
)
next
_field
->
reset
();
to
->
next_number
_field
->
reset
();
for
(
Copy_field
*
copy_ptr
=
copy
;
copy_ptr
!=
copy_end
;
copy_ptr
++
)
for
(
Copy_field
*
copy_ptr
=
copy
;
copy_ptr
!=
copy_end
;
copy_ptr
++
)
{
if
(
copy_ptr
==
next_field
)
to
->
auto_increment_field_not_null
=
TRUE
;
copy_ptr
->
do_copy
(
copy_ptr
);
copy_ptr
->
do_copy
(
copy_ptr
);
}
if
((
error
=
to
->
file
->
write_row
((
byte
*
)
to
->
record
[
0
])))
if
((
error
=
to
->
file
->
write_row
((
byte
*
)
to
->
record
[
0
])))
{
{
if
((
handle_duplicates
!=
DUP_IGNORE
&&
if
((
handle_duplicates
!=
DUP_IGNORE
&&
...
...
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