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
6d71acf0
Commit
6d71acf0
authored
Jan 24, 2005
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed way of forward reference detection to support literal constant (BUG#8025)
parent
2371c992
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
2 deletions
+48
-2
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+14
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+16
-0
sql/item.cc
sql/item.cc
+4
-2
sql/sql_base.cc
sql/sql_base.cc
+14
-0
No files found.
mysql-test/r/subselect.result
View file @
6d71acf0
...
@@ -2182,3 +2182,17 @@ ERROR 21000: Operand should contain 2 column(s)
...
@@ -2182,3 +2182,17 @@ ERROR 21000: Operand should contain 2 column(s)
select (select * from t1) = row(1,(2,2));
select (select * from t1) = row(1,(2,2));
ERROR 21000: Operand should contain 1 column(s)
ERROR 21000: Operand should contain 1 column(s)
drop table t1;
drop table t1;
create table t1 (a integer);
insert into t1 values (1);
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
xx 1 = ALL ( select 1 from t1 where 1 = xx )
1 1
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
drop table t1;
mysql-test/t/subselect.test
View file @
6d71acf0
...
@@ -1449,3 +1449,19 @@ select row(1,(2,2)) = (select * from t1 );
...
@@ -1449,3 +1449,19 @@ select row(1,(2,2)) = (select * from t1 );
--
error
1241
--
error
1241
select
(
select
*
from
t1
)
=
row
(
1
,(
2
,
2
));
select
(
select
*
from
t1
)
=
row
(
1
,(
2
,
2
));
drop
table
t1
;
drop
table
t1
;
#
# Forward reference detection
#
create
table
t1
(
a
integer
);
insert
into
t1
values
(
1
);
--
error
1247
select
1
=
ALL
(
select
1
from
t1
where
1
=
xx
),
1
as
xx
;
--
error
1247
select
1
=
ALL
(
select
1
from
t1
where
1
=
xx
),
1
as
xx
;
select
1
as
xx
,
1
=
ALL
(
select
1
from
t1
where
1
=
xx
);
--
error
1247
select
1
=
ALL
(
select
1
from
t1
where
1
=
xx
),
1
as
xx
;
--
error
1247
select
1
=
ALL
(
select
1
from
t1
where
1
=
xx
),
1
as
xx
from
DUAL
;
drop
table
t1
;
sql/item.cc
View file @
6d71acf0
...
@@ -1482,12 +1482,13 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -1482,12 +1482,13 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
}
}
else
if
(
refer
!=
(
Item
**
)
not_found_item
)
else
if
(
refer
!=
(
Item
**
)
not_found_item
)
{
{
if
(
!
(
*
refer
)
->
fixed
)
if
(
!
last
->
ref_pointer_array
[
counter
]
)
{
{
my_error
(
ER_ILLEGAL_REFERENCE
,
MYF
(
0
),
name
,
my_error
(
ER_ILLEGAL_REFERENCE
,
MYF
(
0
),
name
,
"forward reference in item list"
);
"forward reference in item list"
);
return
-
1
;
return
-
1
;
}
}
DBUG_ASSERT
((
*
refer
)
->
fixed
);
/*
/*
Here, a subset of actions performed by Item_ref::set_properties
Here, a subset of actions performed by Item_ref::set_properties
is not enough. So we pass ptr to NULL into Item_[direct]_ref
is not enough. So we pass ptr to NULL into Item_[direct]_ref
...
@@ -2173,12 +2174,13 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
...
@@ -2173,12 +2174,13 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
mark_as_dependent
(
thd
,
last
,
thd
->
lex
->
current_select
,
fld
);
mark_as_dependent
(
thd
,
last
,
thd
->
lex
->
current_select
,
fld
);
return
0
;
return
0
;
}
}
if
(
!
(
*
ref
)
->
fixed
)
if
(
!
last
->
ref_pointer_array
[
counter
]
)
{
{
my_error
(
ER_ILLEGAL_REFERENCE
,
MYF
(
0
),
name
,
my_error
(
ER_ILLEGAL_REFERENCE
,
MYF
(
0
),
name
,
"forward reference in item list"
);
"forward reference in item list"
);
return
-
1
;
return
-
1
;
}
}
DBUG_ASSERT
((
*
ref
)
->
fixed
);
mark_as_dependent
(
thd
,
last
,
thd
->
lex
->
current_select
,
mark_as_dependent
(
thd
,
last
,
thd
->
lex
->
current_select
,
this
);
this
);
if
(
place
==
IN_HAVING
)
if
(
place
==
IN_HAVING
)
...
...
sql/sql_base.cc
View file @
6d71acf0
...
@@ -2405,6 +2405,20 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
...
@@ -2405,6 +2405,20 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
thd
->
allow_sum_func
=
allow_sum_func
;
thd
->
allow_sum_func
=
allow_sum_func
;
thd
->
where
=
"field list"
;
thd
->
where
=
"field list"
;
/*
To prevent fail on forward lookup we fill it with zerows,
then if we got pointer on zero after find_item_in_list we will know
that it is forward lookup.
There is other way to solve problem: fill array with pointers to list,
but it will be slower.
TODO: remove it when (if) we made one list for allfields and
ref_pointer_array
*/
if
(
ref_pointer_array
)
bzero
(
ref_pointer_array
,
sizeof
(
Item
*
)
*
fields
.
elements
);
Item
**
ref
=
ref_pointer_array
;
Item
**
ref
=
ref_pointer_array
;
while
((
item
=
it
++
))
while
((
item
=
it
++
))
{
{
...
...
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