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
4230eae8
Commit
4230eae8
authored
Sep 18, 2004
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix and test case for bug#5510 "inserting Null in AutoIncrement primary
key Column Fails".
parent
c12c9af2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
7 deletions
+52
-7
mysql-test/r/ps.result
mysql-test/r/ps.result
+19
-0
mysql-test/r/ps_2myisam.result
mysql-test/r/ps_2myisam.result
+1
-1
mysql-test/r/ps_3innodb.result
mysql-test/r/ps_3innodb.result
+1
-1
mysql-test/r/ps_4heap.result
mysql-test/r/ps_4heap.result
+1
-1
mysql-test/r/ps_5merge.result
mysql-test/r/ps_5merge.result
+2
-2
mysql-test/r/ps_6bdb.result
mysql-test/r/ps_6bdb.result
+1
-1
mysql-test/t/ps.test
mysql-test/t/ps.test
+26
-0
sql/item.cc
sql/item.cc
+1
-1
No files found.
mysql-test/r/ps.result
View file @
4230eae8
...
@@ -270,3 +270,22 @@ execute stmt using @var;
...
@@ -270,3 +270,22 @@ execute stmt using @var;
a
a
deallocate prepare stmt;
deallocate prepare stmt;
drop table t1;
drop table t1;
create table t1 (a bigint(20) not null primary key auto_increment);
insert into t1 (a) values (null);
select * from t1;
a
1
prepare stmt from "insert into t1 (a) values (?)";
set @var=null;
execute stmt using @var;
select * from t1;
a
1
2
drop table t1;
create table t1 (a timestamp not null);
prepare stmt from "insert into t1 (a) values (?)";
execute stmt using @var;
select * from t1;
deallocate prepare stmt;
drop table t1;
mysql-test/r/ps_2myisam.result
View file @
4230eae8
...
@@ -1015,7 +1015,7 @@ set @arg00=NULL;
...
@@ -1015,7 +1015,7 @@ set @arg00=NULL;
set @arg01=2;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
execute stmt1 using @arg00, @arg01;
Warnings:
Warnings:
Warning 126
5 Data truncated for
column 'a' at row 1
Warning 126
3 Data truncated; NULL supplied to NOT NULL
column 'a' at row 1
select a,b from t1;
select a,b from t1;
a b
a b
1 one
1 one
...
...
mysql-test/r/ps_3innodb.result
View file @
4230eae8
...
@@ -1015,7 +1015,7 @@ set @arg00=NULL;
...
@@ -1015,7 +1015,7 @@ set @arg00=NULL;
set @arg01=2;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
execute stmt1 using @arg00, @arg01;
Warnings:
Warnings:
Warning 126
5 Data truncated for
column 'a' at row 1
Warning 126
3 Data truncated; NULL supplied to NOT NULL
column 'a' at row 1
select a,b from t1;
select a,b from t1;
a b
a b
0 two
0 two
...
...
mysql-test/r/ps_4heap.result
View file @
4230eae8
...
@@ -1016,7 +1016,7 @@ set @arg00=NULL;
...
@@ -1016,7 +1016,7 @@ set @arg00=NULL;
set @arg01=2;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
execute stmt1 using @arg00, @arg01;
Warnings:
Warnings:
Warning 126
5 Data truncated for
column 'a' at row 1
Warning 126
3 Data truncated; NULL supplied to NOT NULL
column 'a' at row 1
select a,b from t1;
select a,b from t1;
a b
a b
1 one
1 one
...
...
mysql-test/r/ps_5merge.result
View file @
4230eae8
...
@@ -1058,7 +1058,7 @@ set @arg00=NULL;
...
@@ -1058,7 +1058,7 @@ set @arg00=NULL;
set @arg01=2;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
execute stmt1 using @arg00, @arg01;
Warnings:
Warnings:
Warning 126
5 Data truncated for
column 'a' at row 1
Warning 126
3 Data truncated; NULL supplied to NOT NULL
column 'a' at row 1
select a,b from t1;
select a,b from t1;
a b
a b
3 three
3 three
...
@@ -2253,7 +2253,7 @@ set @arg00=NULL;
...
@@ -2253,7 +2253,7 @@ set @arg00=NULL;
set @arg01=2;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
execute stmt1 using @arg00, @arg01;
Warnings:
Warnings:
Warning 126
5 Data truncated for
column 'a' at row 1
Warning 126
3 Data truncated; NULL supplied to NOT NULL
column 'a' at row 1
select a,b from t1;
select a,b from t1;
a b
a b
3 three
3 three
...
...
mysql-test/r/ps_6bdb.result
View file @
4230eae8
...
@@ -1015,7 +1015,7 @@ set @arg00=NULL;
...
@@ -1015,7 +1015,7 @@ set @arg00=NULL;
set @arg01=2;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
execute stmt1 using @arg00, @arg01;
Warnings:
Warnings:
Warning 126
5 Data truncated for
column 'a' at row 1
Warning 126
3 Data truncated; NULL supplied to NOT NULL
column 'a' at row 1
select a,b from t1;
select a,b from t1;
a b
a b
0 two
0 two
...
...
mysql-test/t/ps.test
View file @
4230eae8
...
@@ -278,3 +278,29 @@ execute stmt using @var;
...
@@ -278,3 +278,29 @@ execute stmt using @var;
deallocate
prepare
stmt
;
deallocate
prepare
stmt
;
drop
table
t1
;
drop
table
t1
;
#
# BUG#5510 "inserting Null in AutoIncrement primary key Column Fails"
# (prepared statements)
# The cause: misuse of internal MySQL 'Field' API.
#
create
table
t1
(
a
bigint
(
20
)
not
null
primary
key
auto_increment
);
insert
into
t1
(
a
)
values
(
null
);
select
*
from
t1
;
prepare
stmt
from
"insert into t1 (a) values (?)"
;
set
@
var
=
null
;
execute
stmt
using
@
var
;
select
*
from
t1
;
drop
table
t1
;
#
# check the same for timestamps
#
create
table
t1
(
a
timestamp
not
null
);
prepare
stmt
from
"insert into t1 (a) values (?)"
;
execute
stmt
using
@
var
;
--
disable_result_log
select
*
from
t1
;
--
enable_result_log
deallocate
prepare
stmt
;
drop
table
t1
;
sql/item.cc
View file @
4230eae8
...
@@ -891,7 +891,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
...
@@ -891,7 +891,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
return
field
->
store
(
str_value
.
ptr
(),
str_value
.
length
(),
return
field
->
store
(
str_value
.
ptr
(),
str_value
.
length
(),
str_value
.
charset
());
str_value
.
charset
());
case
NULL_VALUE
:
case
NULL_VALUE
:
return
set_field_to_null
(
field
);
return
set_field_to_null
_with_conversions
(
field
,
no_conversions
);
case
NO_VALUE
:
case
NO_VALUE
:
default:
default:
DBUG_ASSERT
(
0
);
DBUG_ASSERT
(
0
);
...
...
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