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
7fc82862
Commit
7fc82862
authored
Jan 16, 2009
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
auto merge
parents
23fac1b5
f1a1e89f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
1 deletion
+49
-1
mysql-test/r/having.result
mysql-test/r/having.result
+7
-0
mysql-test/t/having.test
mysql-test/t/having.test
+11
-0
sql/item.cc
sql/item.cc
+18
-1
sql/item.h
sql/item.h
+3
-0
sql/item_func.cc
sql/item_func.cc
+9
-0
sql/item_func.h
sql/item_func.h
+1
-0
No files found.
mysql-test/r/having.result
View file @
7fc82862
...
...
@@ -424,3 +424,10 @@ select f1 from t1 group by f1 having max(f1)=f1;
f1
set session sql_mode='';
drop table t1;
CREATE TABLE t1 ( a INT, b INT);
INSERT INTO t1 VALUES (1, 1), (2,2), (3, NULL);
SELECT b, COUNT(DISTINCT a) FROM t1 GROUP BY b HAVING b is NULL;
b COUNT(DISTINCT a)
NULL 1
DROP TABLE t1;
End of 5.0 tests
mysql-test/t/having.test
View file @
7fc82862
...
...
@@ -432,3 +432,14 @@ select f1 from t1 having max(f1)=f1;
select
f1
from
t1
group
by
f1
having
max
(
f1
)
=
f1
;
set
session
sql_mode
=
''
;
drop
table
t1
;
#
# Bug #38637: COUNT DISTINCT prevents NULL testing in HAVING clause
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
);
INSERT
INTO
t1
VALUES
(
1
,
1
),
(
2
,
2
),
(
3
,
NULL
);
SELECT
b
,
COUNT
(
DISTINCT
a
)
FROM
t1
GROUP
BY
b
HAVING
b
is
NULL
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
sql/item.cc
View file @
7fc82862
...
...
@@ -2041,6 +2041,12 @@ bool Item_field::val_bool_result()
}
bool
Item_field
::
is_null_result
()
{
return
(
null_value
=
result_field
->
is_null
());
}
bool
Item_field
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
Item
*
real_item
=
((
Item
*
)
item
)
->
real_item
();
...
...
@@ -5629,6 +5635,15 @@ double Item_ref::val_result()
}
bool
Item_ref
::
is_null_result
()
{
if
(
result_field
)
return
(
null_value
=
result_field
->
is_null
());
return
is_null
();
}
longlong
Item_ref
::
val_int_result
()
{
if
(
result_field
)
...
...
@@ -5734,7 +5749,9 @@ String *Item_ref::val_str(String* tmp)
bool
Item_ref
::
is_null
()
{
DBUG_ASSERT
(
fixed
);
return
(
*
ref
)
->
is_null
();
bool
tmp
=
(
*
ref
)
->
is_null_result
();
null_value
=
(
*
ref
)
->
null_value
;
return
tmp
;
}
...
...
sql/item.h
View file @
7fc82862
...
...
@@ -652,6 +652,7 @@ public:
virtual
my_decimal
*
val_decimal_result
(
my_decimal
*
val
)
{
return
val_decimal
(
val
);
}
virtual
bool
val_bool_result
()
{
return
val_bool
();
}
virtual
bool
is_null_result
()
{
return
is_null
();
}
/* bit map of tables used by item */
virtual
table_map
used_tables
()
const
{
return
(
table_map
)
0L
;
}
...
...
@@ -1301,6 +1302,7 @@ public:
String
*
str_result
(
String
*
tmp
);
my_decimal
*
val_decimal_result
(
my_decimal
*
);
bool
val_bool_result
();
bool
is_null_result
();
bool
send
(
Protocol
*
protocol
,
String
*
str_arg
);
void
reset_field
(
Field
*
f
);
bool
fix_fields
(
THD
*
,
Item
**
);
...
...
@@ -1942,6 +1944,7 @@ public:
String
*
str_result
(
String
*
tmp
);
my_decimal
*
val_decimal_result
(
my_decimal
*
);
bool
val_bool_result
();
bool
is_null_result
();
bool
send
(
Protocol
*
prot
,
String
*
tmp
);
void
make_field
(
Send_field
*
field
);
bool
fix_fields
(
THD
*
,
Item
**
);
...
...
sql/item_func.cc
View file @
7fc82862
...
...
@@ -4285,6 +4285,15 @@ my_decimal *Item_func_set_user_var::val_decimal_result(my_decimal *val)
}
bool
Item_func_set_user_var
::
is_null_result
()
{
DBUG_ASSERT
(
fixed
==
1
);
check
(
TRUE
);
update
();
// Store expression
return
is_null
();
}
void
Item_func_set_user_var
::
print
(
String
*
str
)
{
str
->
append
(
STRING_WITH_LEN
(
"(@"
));
...
...
sql/item_func.h
View file @
7fc82862
...
...
@@ -1302,6 +1302,7 @@ public:
longlong
val_int_result
();
String
*
str_result
(
String
*
str
);
my_decimal
*
val_decimal_result
(
my_decimal
*
);
bool
is_null_result
();
bool
update_hash
(
void
*
ptr
,
uint
length
,
enum
Item_result
type
,
CHARSET_INFO
*
cs
,
Derivation
dv
,
bool
unsigned_arg
);
bool
send
(
Protocol
*
protocol
,
String
*
str_arg
);
...
...
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