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
7e778e11
Commit
7e778e11
authored
Aug 24, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed aggregate function processing in VIEWs (BUG#4665)
parent
be31afd1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
+27
-0
mysql-test/r/view.result
mysql-test/r/view.result
+9
-0
mysql-test/t/view.test
mysql-test/t/view.test
+11
-0
sql/table.cc
sql/table.cc
+7
-0
No files found.
mysql-test/r/view.result
View file @
7e778e11
...
...
@@ -1074,3 +1074,12 @@ s1 s2
2 3
drop view v1;
drop tables t1, t2;
create table t1 (col1 int);
insert into t1 values (1);
create view v1 as select count(*) from t1;
insert into t1 values (null);
select * from v1;
count(*)
2
drop view v1;
drop table t1;
mysql-test/t/view.test
View file @
7e778e11
...
...
@@ -1016,3 +1016,14 @@ create view v1 as select * from t1,t2 union all select * from t1,t2;
select
*
from
v1
;
drop
view
v1
;
drop
tables
t1
,
t2
;
#
# Aggregate functions in view list
#
create
table
t1
(
col1
int
);
insert
into
t1
values
(
1
);
create
view
v1
as
select
count
(
*
)
from
t1
;
insert
into
t1
values
(
null
);
select
*
from
v1
;
drop
view
v1
;
drop
table
t1
;
sql/table.cc
View file @
7e778e11
...
...
@@ -1506,6 +1506,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
uint
i
=
0
;
bool
save_set_query_id
=
thd
->
set_query_id
;
bool
save_wrapper
=
thd
->
lex
->
select_lex
.
no_wrap_view_item
;
bool
save_allow_sum_func
=
thd
->
allow_sum_func
;
DBUG_ENTER
(
"st_table_list::setup_ancestor"
);
if
(
ancestor
->
ancestor
&&
...
...
@@ -1525,6 +1526,8 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
uint
want_privilege
=
ancestor
->
table
->
grant
.
want_privilege
;
/* real rights will be checked in VIEW field */
ancestor
->
table
->
grant
.
want_privilege
=
0
;
/* aggregate function are allowed */
thd
->
allow_sum_func
=
1
;
if
(
!
(
*
i
)
->
fixed
&&
(
*
i
)
->
fix_fields
(
thd
,
ancestor
,
i
))
goto
err
;
ancestor
->
table
->
grant
.
want_privilege
=
want_privilege
;
...
...
@@ -1558,6 +1561,8 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
uint
want_privilege
=
ancestor
->
table
->
grant
.
want_privilege
;
/* real rights will be checked in VIEW field */
ancestor
->
table
->
grant
.
want_privilege
=
0
;
/* aggregate function are allowed */
thd
->
allow_sum_func
=
1
;
if
(
!
item
->
fixed
&&
item
->
fix_fields
(
thd
,
ancestor
,
&
item
))
{
goto
err
;
...
...
@@ -1602,6 +1607,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
thd
->
lex
->
select_lex
.
no_wrap_view_item
=
save_wrapper
;
thd
->
lex
->
current_select
=
current_select_save
;
thd
->
set_query_id
=
save_set_query_id
;
thd
->
allow_sum_func
=
save_allow_sum_func
;
DBUG_RETURN
(
0
);
err:
...
...
@@ -1614,6 +1620,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
thd
->
lex
->
select_lex
.
no_wrap_view_item
=
save_wrapper
;
thd
->
lex
->
current_select
=
current_select_save
;
thd
->
set_query_id
=
save_set_query_id
;
thd
->
allow_sum_func
=
save_allow_sum_func
;
DBUG_RETURN
(
1
);
}
...
...
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