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
e98e8531
Commit
e98e8531
authored
Feb 15, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix of illegal usage aggregate functions
parent
d7b5238b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+10
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+12
-0
sql/item_subselect.cc
sql/item_subselect.cc
+8
-1
No files found.
mysql-test/r/subselect.result
View file @
e98e8531
...
...
@@ -1012,3 +1012,13 @@ id select_type table type possible_keys key key_len ref rows Extra
2 UNCACHEABLE SUBSELECT t1 ALL NULL NULL NULL NULL 3
3 UNCACHEABLE SUBSELECT t1 ALL NULL NULL NULL NULL 3
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
PRIMARY KEY (`i`)
) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
Invalid use of group function
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
Invalid use of group function
drop table t1;
mysql-test/t/subselect.test
View file @
e98e8531
...
...
@@ -595,3 +595,15 @@ insert into t1 values (1), (2), (3);
explain
select
a
,(
select
(
select
rand
()
from
t1
limit
1
)
from
t1
limit
1
)
from
t1
;
drop
table
t1
;
CREATE
TABLE
`t1`
(
`i`
int
(
11
)
NOT
NULL
default
'0'
,
PRIMARY
KEY
(
`i`
)
)
TYPE
=
MyISAM
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
1
);
--
error
1111
UPDATE
t1
SET
i
=
i
+
(
SELECT
MAX
(
i
)
FROM
(
SELECT
1
)
t
)
WHERE
i
=
(
SELECT
MAX
(
i
));
--
error
1111
UPDATE
t1
SET
i
=
i
+
1
WHERE
i
=
(
SELECT
MAX
(
i
));
drop
table
t1
;
sql/item_subselect.cc
View file @
e98e8531
...
...
@@ -88,7 +88,14 @@ bool Item_subselect::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if
(
have_to_be_excluded
)
engine
->
exclude
();
substitution
=
0
;
return
(
*
ref
)
->
fix_fields
(
thd
,
tables
,
ref
);
int
ret
=
(
*
ref
)
->
fix_fields
(
thd
,
tables
,
ref
);
// We can't substitute aggregate functions (like (SELECT (max(i)))
if
((
*
ref
)
->
with_sum_func
)
{
my_error
(
ER_INVALID_GROUP_FUNC_USE
,
MYF
(
0
));
return
1
;
}
return
ret
;
}
char
const
*
save_where
=
thd
->
where
;
...
...
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