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
264de67f
Commit
264de67f
authored
May 25, 2005
by
tulin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #10838 CREATE TABLE produces strange DEFAULT value
parent
bedc2e3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
228 additions
and
2 deletions
+228
-2
mysql-test/r/bugs.result
mysql-test/r/bugs.result
+138
-0
mysql-test/t/bugs.test
mysql-test/t/bugs.test
+85
-0
sql/unireg.cc
sql/unireg.cc
+5
-2
No files found.
mysql-test/r/bugs.result
0 → 100644
View file @
264de67f
drop table if exists t1,t2,t3,t4,t5,t6;
drop database if exists mysqltest;
CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
b varchar(1) binary NOT NULL DEFAULT ' ',
c varchar(4) binary NOT NULL DEFAULT '0000',
d tinyblob NULL,
e tinyblob NULL,
f tinyblob NULL,
g tinyblob NULL,
h tinyblob NULL,
i tinyblob NULL,
j tinyblob NULL,
k tinyblob NULL,
l tinyblob NULL,
m tinyblob NULL,
n tinyblob NULL,
o tinyblob NULL,
p tinyblob NULL,
q varchar(30) binary NOT NULL DEFAULT ' ',
r varchar(30) binary NOT NULL DEFAULT ' ',
s tinyblob NULL,
t varchar(4) binary NOT NULL DEFAULT ' ',
u varchar(1) binary NOT NULL DEFAULT ' ',
v varchar(30) binary NOT NULL DEFAULT ' ',
w varchar(30) binary NOT NULL DEFAULT ' ',
x tinyblob NULL,
y varchar(5) binary NOT NULL DEFAULT ' ',
z varchar(20) binary NOT NULL DEFAULT ' ',
a1 varchar(30) binary NOT NULL DEFAULT ' ',
b1 tinyblob NULL)
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(30) collate latin1_bin NOT NULL default ' ',
`b` varchar(1) collate latin1_bin NOT NULL default ' ',
`c` varchar(4) collate latin1_bin NOT NULL default '0000',
`d` tinyblob,
`e` tinyblob,
`f` tinyblob,
`g` tinyblob,
`h` tinyblob,
`i` tinyblob,
`j` tinyblob,
`k` tinyblob,
`l` tinyblob,
`m` tinyblob,
`n` tinyblob,
`o` tinyblob,
`p` tinyblob,
`q` varchar(30) collate latin1_bin NOT NULL default ' ',
`r` varchar(30) collate latin1_bin NOT NULL default ' ',
`s` tinyblob,
`t` varchar(4) collate latin1_bin NOT NULL default ' ',
`u` varchar(1) collate latin1_bin NOT NULL default ' ',
`v` varchar(30) collate latin1_bin NOT NULL default ' ',
`w` varchar(30) collate latin1_bin NOT NULL default ' ',
`x` tinyblob,
`y` varchar(5) collate latin1_bin NOT NULL default ' ',
`z` varchar(20) collate latin1_bin NOT NULL default ' ',
`a1` varchar(30) collate latin1_bin NOT NULL default ' ',
`b1` tinyblob
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin
INSERT into t1 (b) values ('1');
SHOW WARNINGS;
Level Code Message
SELECT * from t1;
a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
CREATE TABLE t2 (a varchar(30) binary NOT NULL DEFAULT ' ',
b varchar(1) binary NOT NULL DEFAULT ' ',
c varchar(4) binary NOT NULL DEFAULT '0000',
d tinyblob NULL,
e tinyblob NULL,
f tinyblob NULL,
g tinyblob NULL,
h tinyblob NULL,
i tinyblob NULL,
j tinyblob NULL,
k tinyblob NULL,
l tinyblob NULL,
m tinyblob NULL,
n tinyblob NULL,
o tinyblob NULL,
p tinyblob NULL,
q varchar(30) binary NOT NULL DEFAULT ' ',
r varchar(30) binary NOT NULL DEFAULT ' ',
s tinyblob NULL,
t varchar(4) binary NOT NULL DEFAULT ' ',
u varchar(1) binary NOT NULL DEFAULT ' ',
v varchar(30) binary NOT NULL DEFAULT ' ',
w varchar(30) binary NOT NULL DEFAULT ' ',
x tinyblob NULL,
y varchar(5) binary NOT NULL DEFAULT ' ',
z varchar(20) binary NOT NULL DEFAULT ' ',
a1 varchar(30) binary NOT NULL DEFAULT ' ',
b1 tinyblob NULL)
ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(30) collate latin1_bin NOT NULL default ' ',
`b` varchar(1) collate latin1_bin NOT NULL default ' ',
`c` varchar(4) collate latin1_bin NOT NULL default '0000',
`d` tinyblob,
`e` tinyblob,
`f` tinyblob,
`g` tinyblob,
`h` tinyblob,
`i` tinyblob,
`j` tinyblob,
`k` tinyblob,
`l` tinyblob,
`m` tinyblob,
`n` tinyblob,
`o` tinyblob,
`p` tinyblob,
`q` varchar(30) collate latin1_bin NOT NULL default ' ',
`r` varchar(30) collate latin1_bin NOT NULL default ' ',
`s` tinyblob,
`t` varchar(4) collate latin1_bin NOT NULL default ' ',
`u` varchar(1) collate latin1_bin NOT NULL default ' ',
`v` varchar(30) collate latin1_bin NOT NULL default ' ',
`w` varchar(30) collate latin1_bin NOT NULL default ' ',
`x` tinyblob,
`y` varchar(5) collate latin1_bin NOT NULL default ' ',
`z` varchar(20) collate latin1_bin NOT NULL default ' ',
`a1` varchar(30) collate latin1_bin NOT NULL default ' ',
`b1` tinyblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
INSERT into t2 (b) values ('1');
SHOW WARNINGS;
Level Code Message
SELECT * from t2;
a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
drop table t1;
drop table t2;
mysql-test/t/bugs.test
0 → 100644
View file @
264de67f
#
# test of already fixed bugs
#
--
disable_warnings
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
t5
,
t6
;
drop
database
if
exists
mysqltest
;
--
enable_warnings
#
# Bug 10838
# Insert causes warnings for no default values and corrupts tables
#
CREATE
TABLE
t1
(
a
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
b
varchar
(
1
)
binary
NOT
NULL
DEFAULT
' '
,
c
varchar
(
4
)
binary
NOT
NULL
DEFAULT
'0000'
,
d
tinyblob
NULL
,
e
tinyblob
NULL
,
f
tinyblob
NULL
,
g
tinyblob
NULL
,
h
tinyblob
NULL
,
i
tinyblob
NULL
,
j
tinyblob
NULL
,
k
tinyblob
NULL
,
l
tinyblob
NULL
,
m
tinyblob
NULL
,
n
tinyblob
NULL
,
o
tinyblob
NULL
,
p
tinyblob
NULL
,
q
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
r
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
s
tinyblob
NULL
,
t
varchar
(
4
)
binary
NOT
NULL
DEFAULT
' '
,
u
varchar
(
1
)
binary
NOT
NULL
DEFAULT
' '
,
v
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
w
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
x
tinyblob
NULL
,
y
varchar
(
5
)
binary
NOT
NULL
DEFAULT
' '
,
z
varchar
(
20
)
binary
NOT
NULL
DEFAULT
' '
,
a1
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
b1
tinyblob
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARACTER
SET
=
latin1
COLLATE
latin1_bin
;
SHOW
CREATE
TABLE
t1
;
INSERT
into
t1
(
b
)
values
(
'1'
);
SHOW
WARNINGS
;
SELECT
*
from
t1
;
CREATE
TABLE
t2
(
a
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
b
varchar
(
1
)
binary
NOT
NULL
DEFAULT
' '
,
c
varchar
(
4
)
binary
NOT
NULL
DEFAULT
'0000'
,
d
tinyblob
NULL
,
e
tinyblob
NULL
,
f
tinyblob
NULL
,
g
tinyblob
NULL
,
h
tinyblob
NULL
,
i
tinyblob
NULL
,
j
tinyblob
NULL
,
k
tinyblob
NULL
,
l
tinyblob
NULL
,
m
tinyblob
NULL
,
n
tinyblob
NULL
,
o
tinyblob
NULL
,
p
tinyblob
NULL
,
q
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
r
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
s
tinyblob
NULL
,
t
varchar
(
4
)
binary
NOT
NULL
DEFAULT
' '
,
u
varchar
(
1
)
binary
NOT
NULL
DEFAULT
' '
,
v
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
w
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
x
tinyblob
NULL
,
y
varchar
(
5
)
binary
NOT
NULL
DEFAULT
' '
,
z
varchar
(
20
)
binary
NOT
NULL
DEFAULT
' '
,
a1
varchar
(
30
)
binary
NOT
NULL
DEFAULT
' '
,
b1
tinyblob
NULL
)
ENGINE
=
MyISAM
DEFAULT
CHARACTER
SET
=
latin1
COLLATE
latin1_bin
;
SHOW
CREATE
TABLE
t2
;
INSERT
into
t2
(
b
)
values
(
'1'
);
SHOW
WARNINGS
;
SELECT
*
from
t2
;
drop
table
t1
;
drop
table
t2
;
sql/unireg.cc
View file @
264de67f
...
...
@@ -755,8 +755,11 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
}
DBUG_ASSERT
(
data_offset
==
((
null_count
+
7
)
/
8
));
/* Fill not used startpos */
if
(
null_count
)
/*
We need to set the unused bits to 1. If the number of bits is a multiple
of 8 there are no unused bits.
*/
if
(
null_count
&
7
)
*
(
null_pos
+
null_count
/
8
)
|=
~
(((
uchar
)
1
<<
(
null_count
&
7
))
-
1
);
error
=
(
int
)
my_write
(
file
,(
byte
*
)
buff
,
(
uint
)
reclength
,
MYF_RW
);
...
...
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