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
20c4dfd4
Commit
20c4dfd4
authored
Feb 22, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-9576 syntax error on view with nullif and count
don't transform Item_func_nullif if it's context_analysis_only
parent
216b5cc9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
mysql-test/r/null.result
mysql-test/r/null.result
+7
-0
mysql-test/t/null.test
mysql-test/t/null.test
+9
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+2
-2
No files found.
mysql-test/r/null.result
View file @
20c4dfd4
...
...
@@ -1524,6 +1524,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select nullif(<cache>(avg(`test`.`t1`.`a`)),0) AS `NULLIF(AVG(a),0)` from `test`.`t1`
DROP TABLE t1;
create table t1 (col1 varchar(50));
create view v1 AS select nullif(count(distinct col1),0) from t1;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select nullif(count(distinct `t1`.`col1`),0) AS `nullif(count(distinct col1),0)` from `t1` latin1 latin1_swedish_ci
drop view v1;
drop table t1;
#
# End of 10.1 tests
#
mysql-test/t/null.test
View file @
20c4dfd4
...
...
@@ -949,6 +949,15 @@ EXPLAIN EXTENDED SELECT NULLIF(AVG(a),0) FROM t1;
DROP
TABLE
t1
;
#
# MDEV-9576 syntax error on view with nullif and count
#
create
table
t1
(
col1
varchar
(
50
));
create
view
v1
AS
select
nullif
(
count
(
distinct
col1
),
0
)
from
t1
;
show
create
view
v1
;
drop
view
v1
;
drop
table
t1
;
--
echo
#
--
echo
# End of 10.1 tests
--
echo
#
sql/item_cmpfunc.cc
View file @
20c4dfd4
...
...
@@ -2584,7 +2584,7 @@ Item_func_nullif::fix_length_and_dec()
args[0] and args[2] should still point to the same original l_expr.
*/
DBUG_ASSERT
(
args
[
0
]
==
args
[
2
]
||
thd
->
stmt_arena
->
is_stmt_execute
());
if
(
args
[
0
]
->
type
()
==
SUM_FUNC_ITEM
)
if
(
args
[
0
]
->
type
()
==
SUM_FUNC_ITEM
&&
!
thd
->
lex
->
context_analysis_only
)
{
/*
NULLIF(l_expr, r_expr)
...
...
@@ -2757,7 +2757,7 @@ void Item_func_nullif::print(String *str, enum_query_type query_type)
Note, the EXPLAIN EXTENDED and EXPLAIN FORMAT=JSON routines
do pass QT_ITEM_FUNC_NULLIF_TO_CASE to print().
*/
DBUG_ASSERT
(
args
[
0
]
==
args
[
2
]);
DBUG_ASSERT
(
args
[
0
]
==
args
[
2
]
||
current_thd
->
lex
->
context_analysis_only
);
str
->
append
(
func_name
());
str
->
append
(
'('
);
args
[
2
]
->
print
(
str
,
query_type
);
...
...
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