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
550fff6b
Commit
550fff6b
authored
Apr 16, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mishka.local:/home/my/mysql-5.0
parents
ca662711
e77860b7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
19 deletions
+99
-19
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+35
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+47
-0
sql/item.cc
sql/item.cc
+13
-16
sql/item.h
sql/item.h
+2
-2
sql/item_subselect.h
sql/item_subselect.h
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-1
No files found.
mysql-test/r/subselect.result
View file @
550fff6b
...
...
@@ -2746,3 +2746,38 @@ NULL
2.00
4.00
drop table t1;
CREATE table t1 ( c1 integer );
INSERT INTO t1 VALUES ( 1 );
INSERT INTO t1 VALUES ( 2 );
INSERT INTO t1 VALUES ( 3 );
CREATE TABLE t2 ( c2 integer );
INSERT INTO t2 VALUES ( 1 );
INSERT INTO t2 VALUES ( 4 );
INSERT INTO t2 VALUES ( 5 );
SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2 WHERE c2 IN (1);
c1 c2
1 1
SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2
WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2 IN ( 1 ) );
c1 c2
1 1
DROP TABLE t1,t2;
CREATE TABLE t1 ( c1 integer );
INSERT INTO t1 VALUES ( 1 );
INSERT INTO t1 VALUES ( 2 );
INSERT INTO t1 VALUES ( 3 );
INSERT INTO t1 VALUES ( 6 );
CREATE TABLE t2 ( c2 integer );
INSERT INTO t2 VALUES ( 1 );
INSERT INTO t2 VALUES ( 4 );
INSERT INTO t2 VALUES ( 5 );
INSERT INTO t2 VALUES ( 6 );
CREATE TABLE t3 ( c3 integer );
INSERT INTO t3 VALUES ( 7 );
INSERT INTO t3 VALUES ( 8 );
SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
WHERE EXISTS (SELECT c3 FROM t3 WHERE c2 IS NULL );
c1 c2
2 NULL
3 NULL
DROP TABLE t1,t2,t3;
mysql-test/t/subselect.test
View file @
550fff6b
...
...
@@ -1752,3 +1752,50 @@ insert into t1 values (1, 1), (2, 2), (2, 3), (3, 4), (3, 5), (3, 6), (NULL, NUL
select
*
from
t1
;
select
min
(
a
)
from
t1
group
by
grp
;
drop
table
t1
;
#
# Test for bug #9338: lame substitution of c1 instead of c2
#
CREATE
table
t1
(
c1
integer
);
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t1
VALUES
(
2
);
INSERT
INTO
t1
VALUES
(
3
);
CREATE
TABLE
t2
(
c2
integer
);
INSERT
INTO
t2
VALUES
(
1
);
INSERT
INTO
t2
VALUES
(
4
);
INSERT
INTO
t2
VALUES
(
5
);
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
c1
=
c2
WHERE
c2
IN
(
1
);
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
c1
=
c2
WHERE
c2
IN
(
SELECT
c2
FROM
t2
WHERE
c2
IN
(
1
)
);
DROP
TABLE
t1
,
t2
;
#
# Test for bug #9516: wrong evaluation of not_null_tables attribute in SQ
#
CREATE
TABLE
t1
(
c1
integer
);
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t1
VALUES
(
2
);
INSERT
INTO
t1
VALUES
(
3
);
INSERT
INTO
t1
VALUES
(
6
);
CREATE
TABLE
t2
(
c2
integer
);
INSERT
INTO
t2
VALUES
(
1
);
INSERT
INTO
t2
VALUES
(
4
);
INSERT
INTO
t2
VALUES
(
5
);
INSERT
INTO
t2
VALUES
(
6
);
CREATE
TABLE
t3
(
c3
integer
);
INSERT
INTO
t3
VALUES
(
7
);
INSERT
INTO
t3
VALUES
(
8
);
SELECT
c1
,
c2
FROM
t1
LEFT
JOIN
t2
ON
c1
=
c2
WHERE
EXISTS
(
SELECT
c3
FROM
t3
WHERE
c2
IS
NULL
);
DROP
TABLE
t1
,
t2
,
t3
;
sql/item.cc
View file @
550fff6b
...
...
@@ -2978,41 +2978,38 @@ Item *Item_field::set_no_const_sub(byte *arg)
/*
Set a pointer to the multiple equality the field reference belongs to
Replace an Item_field for an equal Item_field that evaluated earlier
(if any)
SYNOPSIS
replace_equal_field_
processor
()
replace_equal_field_()
arg - a dummy parameter, is not used here
DESCRIPTION
The function replaces a pointer to a field in the Item_field object
by a pointer to another field.
The replacement field is taken from the very beginning of
the item_equal list which the Item_field object refers to (belongs to)
If the Item_field object does not refer any Item_equal object,
nothing is done.
The function returns a pointer to an item that is taken from
the very beginning of the item_equal list which the Item_field
object refers to (belongs to).
If the Item_field object does not refer any Item_equal object
'this' is returned
NOTES
This function is supposed to be called as a callback parameter in calls
of the
walk
method.
of the
thransformer
method.
RETURN VALUES
0
pointer to a replacement Item_field if there is a better equal item;
this - otherwise.
*/
bool
Item_field
::
replace_equal_field_processor
(
byte
*
arg
)
Item
*
Item_field
::
replace_equal_field
(
byte
*
arg
)
{
if
(
item_equal
)
{
Item_field
*
subst
=
item_equal
->
get_first
();
if
(
!
field
->
eq
(
subst
->
field
))
{
field
=
subst
->
field
;
return
0
;
}
return
subst
;
}
return
0
;
return
this
;
}
...
...
sql/item.h
View file @
550fff6b
...
...
@@ -520,7 +520,7 @@ class Item {
virtual
bool
collect_item_field_processor
(
byte
*
arg
)
{
return
0
;
}
virtual
Item
*
equal_fields_propagator
(
byte
*
arg
)
{
return
this
;
}
virtual
Item
*
set_no_const_sub
(
byte
*
arg
)
{
return
this
;
}
virtual
bool
replace_equal_field_processor
(
byte
*
arg
)
{
return
0
;
}
virtual
Item
*
replace_equal_field
(
byte
*
arg
)
{
return
this
;
}
virtual
Item
*
this_item
()
{
return
this
;
}
/* For SPs mostly. */
virtual
Item
*
this_const_item
()
const
{
return
const_cast
<
Item
*>
(
this
);
}
/* For SPs mostly. */
...
...
@@ -754,7 +754,7 @@ class Item_field :public Item_ident
Item_equal
*
find_item_equal
(
COND_EQUAL
*
cond_equal
);
Item
*
equal_fields_propagator
(
byte
*
arg
);
Item
*
set_no_const_sub
(
byte
*
arg
);
bool
replace_equal_field_processor
(
byte
*
arg
);
Item
*
replace_equal_field
(
byte
*
arg
);
inline
uint32
max_disp_length
()
{
return
field
->
max_length
();
}
Item_field
*
filed_for_view_update
()
{
return
this
;
}
Item
*
safe_charset_converter
(
CHARSET_INFO
*
tocs
);
...
...
sql/item_subselect.h
View file @
550fff6b
...
...
@@ -96,6 +96,7 @@ class Item_subselect :public Item_result_field
virtual
bool
exec
();
virtual
void
fix_length_and_dec
();
table_map
used_tables
()
const
;
table_map
not_null_tables
()
const
{
return
0
;
}
bool
const_item
()
const
;
inline
table_map
get_used_tables_cache
()
{
return
used_tables_cache
;
}
inline
bool
get_const_item_cache
()
{
return
const_item_cache
;
}
...
...
sql/sql_select.cc
View file @
550fff6b
...
...
@@ -7054,7 +7054,7 @@ static COND* substitute_for_best_equal_field(COND *cond,
return
eliminate_item_equal
(
0
,
cond_equal
,
item_equal
);
}
else
cond
->
walk
(
&
Item
::
replace_equal_field_processor
,
0
);
cond
->
transform
(
&
Item
::
replace_equal_field
,
0
);
return
cond
;
}
...
...
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