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
a1ff5239
Commit
a1ff5239
authored
Nov 10, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
parents
b48ff93e
55bc5ffa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
151 additions
and
0 deletions
+151
-0
mysql-test/r/default.result
mysql-test/r/default.result
+92
-0
mysql-test/t/default.test
mysql-test/t/default.test
+58
-0
sql/item.cc
sql/item.cc
+1
-0
No files found.
mysql-test/r/default.result
View file @
a1ff5239
...
@@ -104,3 +104,95 @@ 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
...
@@ -104,3 +104,95 @@ 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
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
drop table t1;
drop table t1;
drop table t2;
drop table t2;
create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
insert into bug20691 (i) values (2);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
desc bug20691;
Field Type Null Key Default Extra
i int(11) YES NULL
d datetime NO
dn datetime NO 0000-00-00 00:00:00
insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
insert into bug20691 (i) values (4);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
SET sql_mode = 'ALLOW_INVALID_DATES';
insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
SET sql_mode = 'STRICT_ALL_TABLES';
insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
ERROR HY000: Field 'd' doesn't have a default value
select * from bug20691 order by i asc;
i d dn
1 0000-00-00 00:00:00 0000-00-00 00:00:00
1 1975-07-10 07:10:03 1978-01-13 14:08:51
1 0000-00-00 00:00:00 0000-00-00 00:00:00
2 0000-00-00 00:00:00 0000-00-00 00:00:00
3 0000-00-00 00:00:00 0000-00-00 00:00:00
3 1975-07-10 07:10:03 1978-01-13 14:08:51
3 0000-00-00 00:00:00 0000-00-00 00:00:00
4 0000-00-00 00:00:00 0000-00-00 00:00:00
5 0000-00-00 00:00:00 0000-00-00 00:00:00
5 1975-07-10 07:10:03 1978-01-13 14:08:51
5 0000-00-00 00:00:00 0000-00-00 00:00:00
6 0000-00-00 00:00:00 0000-00-00 00:00:00
6 1975-07-10 07:10:03 1978-01-13 14:08:51
6 0000-00-00 00:00:00 0000-00-00 00:00:00
drop table bug20691;
SET sql_mode = '';
create table bug20691 (
a set('one', 'two', 'three') not null,
b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
c time not null,
d date not null,
e int not null,
f long not null,
g blob not null,
h datetime not null,
i decimal not null,
x int);
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1);
insert into bug20691 (x) values (2);
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'c' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'e' doesn't have a default value
Warning 1364 Field 'f' doesn't have a default value
Warning 1364 Field 'g' doesn't have a default value
Warning 1364 Field 'h' doesn't have a default value
Warning 1364 Field 'i' doesn't have a default value
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3);
insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
Warning 1364 Field 'c' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'e' doesn't have a default value
Warning 1364 Field 'f' doesn't have a default value
Warning 1364 Field 'g' doesn't have a default value
Warning 1364 Field 'h' doesn't have a default value
Warning 1364 Field 'i' doesn't have a default value
select * from bug20691 order by x asc;
a b c d e f g h i x
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 1
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 2
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 3
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
drop table bug20691;
End of 5.0 tests.
mysql-test/t/default.test
View file @
a1ff5239
...
@@ -82,3 +82,61 @@ SELECT * from t2;
...
@@ -82,3 +82,61 @@ SELECT * from t2;
drop
table
t1
;
drop
table
t1
;
drop
table
t2
;
drop
table
t2
;
#
# Bug#20691: DATETIME col (NOT NULL, NO DEFAULT) may insert garbage when specifying DEFAULT
#
# From the docs:
# If the column can take NULL as a value, the column is defined with an
# explicit DEFAULT NULL clause. This is the same as before 5.0.2.
#
# If the column cannot take NULL as the value, MySQL defines the column with
# no explicit DEFAULT clause. For data entry, if an INSERT or REPLACE
# statement includes no value for the column, MySQL handles the column
# according to the SQL mode in effect at the time:
#
# * If strict SQL mode is not enabled, MySQL sets the column to the
# implicit default value for the column data type.
#
# * If strict mode is enabled, an error occurs for transactional tables and
# the statement is rolled back. For non-transactional tables, an error
# occurs, but if this happens for the second or subsequent row of a
# multiple-row statement, the preceding rows will have been inserted.
#
create
table
bug20691
(
i
int
,
d
datetime
NOT
NULL
,
dn
datetime
not
null
default
'0000-00-00 00:00:00'
);
insert
into
bug20691
values
(
1
,
DEFAULT
,
DEFAULT
),
(
1
,
'1975-07-10 07:10:03'
,
'1978-01-13 14:08:51'
),
(
1
,
DEFAULT
,
DEFAULT
);
insert
into
bug20691
(
i
)
values
(
2
);
desc
bug20691
;
insert
into
bug20691
values
(
3
,
DEFAULT
,
DEFAULT
),
(
3
,
'1975-07-10 07:10:03'
,
'1978-01-13 14:08:51'
),
(
3
,
DEFAULT
,
DEFAULT
);
insert
into
bug20691
(
i
)
values
(
4
);
insert
into
bug20691
values
(
5
,
DEFAULT
,
DEFAULT
),
(
5
,
'1975-07-10 07:10:03'
,
'1978-01-13 14:08:51'
),
(
5
,
DEFAULT
,
DEFAULT
);
SET
sql_mode
=
'ALLOW_INVALID_DATES'
;
insert
into
bug20691
values
(
6
,
DEFAULT
,
DEFAULT
),
(
6
,
'1975-07-10 07:10:03'
,
'1978-01-13 14:08:51'
),
(
6
,
DEFAULT
,
DEFAULT
);
SET
sql_mode
=
'STRICT_ALL_TABLES'
;
--
error
1364
insert
into
bug20691
values
(
7
,
DEFAULT
,
DEFAULT
),
(
7
,
'1975-07-10 07:10:03'
,
'1978-01-13 14:08:51'
),
(
7
,
DEFAULT
,
DEFAULT
);
select
*
from
bug20691
order
by
i
asc
;
drop
table
bug20691
;
SET
sql_mode
=
''
;
create
table
bug20691
(
a
set
(
'one'
,
'two'
,
'three'
)
not
null
,
b
enum
(
'small'
,
'medium'
,
'large'
,
'enormous'
,
'ellisonego'
)
not
null
,
c
time
not
null
,
d
date
not
null
,
e
int
not
null
,
f
long
not
null
,
g
blob
not
null
,
h
datetime
not
null
,
i
decimal
not
null
,
x
int
);
insert
into
bug20691
values
(
2
,
3
,
5
,
'0007-01-01'
,
11
,
13
,
17
,
'0019-01-01 00:00:00'
,
23
,
1
);
insert
into
bug20691
(
x
)
values
(
2
);
insert
into
bug20691
values
(
2
,
3
,
5
,
'0007-01-01'
,
11
,
13
,
17
,
'0019-01-01 00:00:00'
,
23
,
3
);
insert
into
bug20691
values
(
DEFAULT
,
DEFAULT
,
DEFAULT
,
DEFAULT
,
DEFAULT
,
DEFAULT
,
DEFAULT
,
DEFAULT
,
DEFAULT
,
4
);
select
*
from
bug20691
order
by
x
asc
;
drop
table
bug20691
;
###
--
echo
End
of
5.0
tests
.
sql/item.cc
View file @
a1ff5239
...
@@ -5467,6 +5467,7 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
...
@@ -5467,6 +5467,7 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
ER
(
ER_NO_DEFAULT_FOR_FIELD
),
ER
(
ER_NO_DEFAULT_FOR_FIELD
),
field_arg
->
field_name
);
field_arg
->
field_name
);
}
}
field_arg
->
set_default
();
return
1
;
return
1
;
}
}
field_arg
->
set_default
();
field_arg
->
set_default
();
...
...
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