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
f6dba131
Commit
f6dba131
authored
Sep 16, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-sum-4.1
parents
ac554866
5d42c492
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
12 deletions
+24
-12
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+9
-1
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+4
-1
sql/item.cc
sql/item.cc
+4
-6
sql/item_subselect.cc
sql/item_subselect.cc
+0
-3
sql/sql_base.cc
sql/sql_base.cc
+5
-1
sql/sql_select.cc
sql/sql_select.cc
+2
-0
No files found.
mysql-test/r/subselect.result
View file @
f6dba131
...
...
@@ -1966,5 +1966,13 @@ howmanyvalues mycount
3 3
4 4
SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.avalue) as mycount from t1 a group by a.howmanyvalues;
ERROR 42S22: Unknown column 'a.avalue' in 'where clause'
howmanyvalues mycount
1 1
2 1
3 1
4 1
drop table t1;
create table t1 (x int);
select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
(select b.x from t1 as b where b.x=a.x)
drop table t1;
mysql-test/t/subselect.test
View file @
f6dba131
...
...
@@ -1264,6 +1264,9 @@ SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.how
CREATE
INDEX
t1_howmanyvalues_idx
ON
t1
(
howmanyvalues
);
SELECT
a
.
howmanyvalues
,
(
SELECT
count
(
*
)
from
t1
b
where
b
.
howmanyvalues
+
1
=
a
.
howmanyvalues
+
1
)
as
mycount
from
t1
a
group
by
a
.
howmanyvalues
;
SELECT
a
.
howmanyvalues
,
(
SELECT
count
(
*
)
from
t1
b
where
b
.
howmanyvalues
=
a
.
howmanyvalues
)
as
mycount
from
t1
a
group
by
a
.
howmanyvalues
;
--
error
1054
SELECT
a
.
howmanyvalues
,
(
SELECT
count
(
*
)
from
t1
b
where
b
.
howmanyvalues
=
a
.
avalue
)
as
mycount
from
t1
a
group
by
a
.
howmanyvalues
;
drop
table
t1
;
create
table
t1
(
x
int
);
select
(
select
b
.
x
from
t1
as
b
where
b
.
x
=
a
.
x
)
from
t1
as
a
where
a
.
x
=
2
group
by
a
.
x
;
drop
table
t1
;
sql/item.cc
View file @
f6dba131
...
...
@@ -1271,11 +1271,10 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
prev_subselect_item
->
parsing_place
;
/*
check table fields only if subquery used somewhere out of HAVING
or
SELECT list or outer SELECT do not use groupping (i.e. tables
a
re a
ccessable)
or
outer SELECT do not use groupping (i.e. tables are
accessable)
*/
if
(((
place
!=
IN_HAVING
&&
place
!=
SELECT_LIST
)
||
if
((
place
!=
IN_HAVING
||
(
sl
->
with_sum_func
==
0
&&
sl
->
group_list
.
elements
==
0
))
&&
(
tmp
=
find_field_in_tables
(
thd
,
this
,
table_list
,
&
where
,
...
...
@@ -1954,8 +1953,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
or SELECT list or outer SELECT do not use groupping (i.e. tables
are accessable)
*/
if
(((
place
!=
IN_HAVING
&&
place
!=
SELECT_LIST
)
||
if
((
place
!=
IN_HAVING
||
(
sl
->
with_sum_func
==
0
&&
sl
->
group_list
.
elements
==
0
))
&&
(
tmp
=
find_field_in_tables
(
thd
,
this
,
table_list
,
&
where
,
...
...
sql/item_subselect.cc
View file @
f6dba131
...
...
@@ -934,9 +934,6 @@ Item_in_subselect::row_value_transformer(JOIN *join)
}
select_lex
->
uncacheable
|=
UNCACHEABLE_DEPENDENT
;
select_lex
->
setup_ref_array
(
thd
,
select_lex
->
order_list
.
elements
+
select_lex
->
group_list
.
elements
);
{
uint
n
=
left_expr
->
cols
();
List_iterator_fast
<
Item
>
li
(
select_lex
->
item_list
);
...
...
sql/sql_base.cc
View file @
f6dba131
...
...
@@ -2142,8 +2142,12 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
case sensitive.
In cases where they are not case sensitive, they are always in lower
case.
item_field->field_name and item_field->table_name can be 0x0 if
item is not fix fielded yet.
*/
if
(
!
my_strcasecmp
(
system_charset_info
,
item_field
->
field_name
,
if
(
item_field
->
field_name
&&
item_field
->
table_name
&&
!
my_strcasecmp
(
system_charset_info
,
item_field
->
field_name
,
field_name
)
&&
!
strcmp
(
item_field
->
table_name
,
table_name
)
&&
(
!
db_name
||
(
item_field
->
db_name
&&
...
...
sql/sql_select.cc
View file @
f6dba131
...
...
@@ -8465,6 +8465,8 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
}
}
else
if
((
pos
->
type
()
==
Item
::
FUNC_ITEM
||
pos
->
type
()
==
Item
::
SUBSELECT_ITEM
||
pos
->
type
()
==
Item
::
CACHE_ITEM
||
pos
->
type
()
==
Item
::
COND_ITEM
)
&&
!
pos
->
with_sum_func
)
{
// Save for send fields
...
...
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