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
d1b667bd
Commit
d1b667bd
authored
Sep 01, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed staistic of subquery if outer field resolved in merged view (BUG#5247)
parent
d38bd725
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
10 deletions
+48
-10
mysql-test/r/view.result
mysql-test/r/view.result
+8
-0
mysql-test/t/view.test
mysql-test/t/view.test
+10
-0
sql/item.cc
sql/item.cc
+30
-10
No files found.
mysql-test/r/view.result
View file @
d1b667bd
...
...
@@ -1230,3 +1230,11 @@ c
drop view v;
drop table t;
create table t1 (a int, b int);
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
create view v1(c) as select a+1 from t1 where b >= 4;
select c from v1 where exists (select * from t1 where a=2 and b=c);
c
4
drop view v1;
drop table t1;
mysql-test/t/view.test
View file @
d1b667bd
...
...
@@ -1178,3 +1178,13 @@ insert into v
select
*
from
v
;
drop
view
v
;
drop
table
t
;
#
# problem with used_tables() of outer reference resolved in VIEW
#
create
table
t1
(
a
int
,
b
int
);
insert
into
t1
values
(
1
,
2
),
(
1
,
3
),
(
2
,
4
),
(
2
,
5
),
(
3
,
10
);
create
view
v1
(
c
)
as
select
a
+
1
from
t1
where
b
>=
4
;
select
c
from
v1
where
exists
(
select
*
from
t1
where
a
=
2
and
b
=
c
);
drop
view
v1
;
drop
table
t1
;
sql/item.cc
View file @
d1b667bd
...
...
@@ -1302,11 +1302,21 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
table_list
,
ref
,
0
,
1
))
!=
not_found_field
)
{
if
(
tmp
&&
tmp
!=
view_ref_found
)
{
prev_subselect_item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_subselect_item
->
const_item_cache
=
0
;
}
if
(
tmp
)
{
if
(
tmp
!=
view_ref_found
)
{
prev_subselect_item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_subselect_item
->
const_item_cache
=
0
;
}
else
{
prev_subselect_item
->
used_tables_cache
|=
(
*
ref
)
->
used_tables
();
prev_subselect_item
->
const_item_cache
&=
(
*
ref
)
->
const_item
();
}
}
break
;
}
if
(
sl
->
resolve_mode
==
SELECT_LEX
::
SELECT_MODE
&&
...
...
@@ -2029,11 +2039,21 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
table_list
,
reference
,
0
,
1
))
!=
not_found_field
)
{
if
(
tmp
&&
tmp
!=
view_ref_found
)
{
prev_subselect_item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_subselect_item
->
const_item_cache
=
0
;
}
if
(
tmp
)
{
if
(
tmp
!=
view_ref_found
)
{
prev_subselect_item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_subselect_item
->
const_item_cache
=
0
;
}
else
{
prev_subselect_item
->
used_tables_cache
|=
(
*
reference
)
->
used_tables
();
prev_subselect_item
->
const_item_cache
&=
(
*
reference
)
->
const_item
();
}
}
break
;
}
...
...
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