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
ace00f9f
Commit
ace00f9f
authored
Oct 11, 2007
by
gshchepa/uchum@gleb.loc
Browse files
Options
Browse Files
Download
Plain Diff
Merge gleb.loc:/home/uchum/work/bk/PA/5.0-opt-31471
into gleb.loc:/home/uchum/work/bk/5.1-opt
parents
da023efb
356007a8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
8 deletions
+64
-8
mysql-test/r/create.result
mysql-test/r/create.result
+1
-1
mysql-test/r/null.result
mysql-test/r/null.result
+24
-1
mysql-test/t/null.test
mysql-test/t/null.test
+25
-2
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+14
-4
No files found.
mysql-test/r/create.result
View file @
ace00f9f
...
...
@@ -438,7 +438,7 @@ explain t2;
Field Type Null Key Default Extra
a int(11) YES NULL
b bigint(11) NO 0
c bigint(11) NO 0
c bigint(11)
unsigned
NO 0
d date YES NULL
e varchar(1) NO
f datetime YES NULL
...
...
mysql-test/r/null.result
View file @
ace00f9f
drop table if exists t1;
drop table if exists t1
, t2
;
select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null
NULL NULL 1 1 1 1 TRUE TRUE 1 1
...
...
@@ -320,3 +320,26 @@ bug19145c CREATE TABLE `bug19145c` (
drop table bug19145a;
drop table bug19145b;
drop table bug19145c;
# End of 4.1 tests
#
# Bug #31471: decimal_bin_size: Assertion `scale >= 0 &&
# precision > 0 && scale <= precision'
#
CREATE TABLE t1 (a DECIMAL (1, 0) ZEROFILL, b DECIMAL (1, 0) ZEROFILL);
INSERT INTO t1 (a, b) VALUES (0, 0);
CREATE TABLE t2 SELECT IFNULL(a, b) FROM t1;
DESCRIBE t2;
Field Type Null Key Default Extra
IFNULL(a, b) decimal(1,0) unsigned YES NULL
DROP TABLE t2;
CREATE TABLE t2 SELECT IFNULL(a, NULL) FROM t1;
DESCRIBE t2;
Field Type Null Key Default Extra
IFNULL(a, NULL) decimal(1,0) YES NULL
DROP TABLE t2;
CREATE TABLE t2 SELECT IFNULL(NULL, b) FROM t1;
DESCRIBE t2;
Field Type Null Key Default Extra
IFNULL(NULL, b) decimal(1,0) YES NULL
DROP TABLE t1, t2;
# End of 5.0 tests
mysql-test/t/null.test
View file @
ace00f9f
# Initialise
--
disable_warnings
drop
table
if
exists
t1
;
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
#
...
...
@@ -231,4 +231,27 @@ drop table bug19145a;
drop
table
bug19145b
;
drop
table
bug19145c
;
# End of 4.1 tests
--
echo
# End of 4.1 tests
--
echo
#
--
echo
# Bug #31471: decimal_bin_size: Assertion `scale >= 0 &&
--
echo
# precision > 0 && scale <= precision'
--
echo
#
CREATE
TABLE
t1
(
a
DECIMAL
(
1
,
0
)
ZEROFILL
,
b
DECIMAL
(
1
,
0
)
ZEROFILL
);
INSERT
INTO
t1
(
a
,
b
)
VALUES
(
0
,
0
);
CREATE
TABLE
t2
SELECT
IFNULL
(
a
,
b
)
FROM
t1
;
DESCRIBE
t2
;
DROP
TABLE
t2
;
CREATE
TABLE
t2
SELECT
IFNULL
(
a
,
NULL
)
FROM
t1
;
DESCRIBE
t2
;
DROP
TABLE
t2
;
CREATE
TABLE
t2
SELECT
IFNULL
(
NULL
,
b
)
FROM
t1
;
DESCRIBE
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
# End of 5.0 tests
sql/item_cmpfunc.cc
View file @
ace00f9f
...
...
@@ -2075,10 +2075,20 @@ Item_func_ifnull::fix_length_and_dec()
agg_result_type
(
&
hybrid_type
,
args
,
2
);
maybe_null
=
args
[
1
]
->
maybe_null
;
decimals
=
max
(
args
[
0
]
->
decimals
,
args
[
1
]
->
decimals
);
max_length
=
(
hybrid_type
==
DECIMAL_RESULT
||
hybrid_type
==
INT_RESULT
)
?
(
max
(
args
[
0
]
->
max_length
-
args
[
0
]
->
decimals
,
args
[
1
]
->
max_length
-
args
[
1
]
->
decimals
)
+
decimals
)
:
max
(
args
[
0
]
->
max_length
,
args
[
1
]
->
max_length
);
unsigned_flag
=
args
[
0
]
->
unsigned_flag
&&
args
[
1
]
->
unsigned_flag
;
if
(
hybrid_type
==
DECIMAL_RESULT
||
hybrid_type
==
INT_RESULT
)
{
int
len0
=
args
[
0
]
->
max_length
-
args
[
0
]
->
decimals
-
(
args
[
0
]
->
unsigned_flag
?
0
:
1
);
int
len1
=
args
[
1
]
->
max_length
-
args
[
1
]
->
decimals
-
(
args
[
1
]
->
unsigned_flag
?
0
:
1
);
max_length
=
max
(
len0
,
len1
)
+
decimals
+
(
unsigned_flag
?
0
:
1
);
}
else
max_length
=
max
(
args
[
0
]
->
max_length
,
args
[
1
]
->
max_length
);
switch
(
hybrid_type
)
{
case
STRING_RESULT
:
...
...
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