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
d0a62312
Commit
d0a62312
authored
Mar 12, 2007
by
igor@olga.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug26963
parents
06a315de
e7284ace
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
2 deletions
+98
-2
mysql-test/r/select.result
mysql-test/r/select.result
+38
-0
mysql-test/t/select.test
mysql-test/t/select.test
+47
-0
sql/item.cc
sql/item.cc
+13
-2
No files found.
mysql-test/r/select.result
View file @
d0a62312
...
@@ -3942,4 +3942,42 @@ cc cc 7
...
@@ -3942,4 +3942,42 @@ cc cc 7
aa aa 2
aa aa 2
aa aa 2
aa aa 2
DROP TABLE t1,t2;
DROP TABLE t1,t2;
CREATE TABLE t1 (
access_id int NOT NULL default '0',
name varchar(20) default NULL,
rank int NOT NULL default '0',
KEY idx (access_id)
);
CREATE TABLE t2 (
faq_group_id int NOT NULL default '0',
faq_id int NOT NULL default '0',
access_id int default NULL,
UNIQUE KEY idx1 (faq_id),
KEY idx2 (faq_group_id,faq_id)
);
INSERT INTO t1 VALUES
(1,'Everyone',2),(2,'Help',3),(3,'Technical Support',1),(4,'Chat User',4);
INSERT INTO t2 VALUES
(261,265,1),(490,494,1);
SELECT t2.faq_id
FROM t1 INNER JOIN t2 IGNORE INDEX (idx1)
ON (t1.access_id = t2.access_id)
LEFT JOIN t2 t
ON (t.faq_group_id = t2.faq_group_id AND
find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
WHERE
t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
faq_id
265
SELECT t2.faq_id
FROM t1 INNER JOIN t2
ON (t1.access_id = t2.access_id)
LEFT JOIN t2 t
ON (t.faq_group_id = t2.faq_group_id AND
find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
WHERE
t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
faq_id
265
DROP TABLE t1,t2;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/select.test
View file @
d0a62312
...
@@ -3308,4 +3308,51 @@ SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
...
@@ -3308,4 +3308,51 @@ SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug #26963: join with predicates that contain fields from equalities evaluated
# to constants after constant table substitution
#
CREATE
TABLE
t1
(
access_id
int
NOT
NULL
default
'0'
,
name
varchar
(
20
)
default
NULL
,
rank
int
NOT
NULL
default
'0'
,
KEY
idx
(
access_id
)
);
CREATE
TABLE
t2
(
faq_group_id
int
NOT
NULL
default
'0'
,
faq_id
int
NOT
NULL
default
'0'
,
access_id
int
default
NULL
,
UNIQUE
KEY
idx1
(
faq_id
),
KEY
idx2
(
faq_group_id
,
faq_id
)
);
INSERT
INTO
t1
VALUES
(
1
,
'Everyone'
,
2
),(
2
,
'Help'
,
3
),(
3
,
'Technical Support'
,
1
),(
4
,
'Chat User'
,
4
);
INSERT
INTO
t2
VALUES
(
261
,
265
,
1
),(
490
,
494
,
1
);
SELECT
t2
.
faq_id
FROM
t1
INNER
JOIN
t2
IGNORE
INDEX
(
idx1
)
ON
(
t1
.
access_id
=
t2
.
access_id
)
LEFT
JOIN
t2
t
ON
(
t
.
faq_group_id
=
t2
.
faq_group_id
AND
find_in_set
(
t
.
access_id
,
'1,4'
)
<
find_in_set
(
t2
.
access_id
,
'1,4'
))
WHERE
t2
.
access_id
IN
(
1
,
4
)
AND
t
.
access_id
IS
NULL
AND
t2
.
faq_id
in
(
265
);
SELECT
t2
.
faq_id
FROM
t1
INNER
JOIN
t2
ON
(
t1
.
access_id
=
t2
.
access_id
)
LEFT
JOIN
t2
t
ON
(
t
.
faq_group_id
=
t2
.
faq_group_id
AND
find_in_set
(
t
.
access_id
,
'1,4'
)
<
find_in_set
(
t2
.
access_id
,
'1,4'
))
WHERE
t2
.
access_id
IN
(
1
,
4
)
AND
t
.
access_id
IS
NULL
AND
t2
.
faq_id
in
(
265
);
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/item.cc
View file @
d0a62312
...
@@ -4075,7 +4075,9 @@ bool Item_field::set_no_const_sub(byte *arg)
...
@@ -4075,7 +4075,9 @@ bool Item_field::set_no_const_sub(byte *arg)
DESCRIPTION
DESCRIPTION
The function returns a pointer to an item that is taken from
The function returns a pointer to an item that is taken from
the very beginning of the item_equal list which the Item_field
the very beginning of the item_equal list which the Item_field
object refers to (belongs to).
object refers to (belongs to) unless item_equal contains a constant
item. In this case the function returns this constant item,
(if the substitution does not require conversion).
If the Item_field object does not refer any Item_equal object
If the Item_field object does not refer any Item_equal object
'this' is returned
'this' is returned
...
@@ -4084,7 +4086,8 @@ bool Item_field::set_no_const_sub(byte *arg)
...
@@ -4084,7 +4086,8 @@ bool Item_field::set_no_const_sub(byte *arg)
of the thransformer method.
of the thransformer method.
RETURN VALUES
RETURN VALUES
pointer to a replacement Item_field if there is a better equal item;
pointer to a replacement Item_field if there is a better equal item or
a pointer to a constant equal item;
this - otherwise.
this - otherwise.
*/
*/
...
@@ -4092,6 +4095,14 @@ Item *Item_field::replace_equal_field(byte *arg)
...
@@ -4092,6 +4095,14 @@ Item *Item_field::replace_equal_field(byte *arg)
{
{
if
(
item_equal
)
if
(
item_equal
)
{
{
Item
*
const_item
=
item_equal
->
get_const
();
if
(
const_item
)
{
if
(
cmp_context
!=
(
Item_result
)
-
1
&&
const_item
->
cmp_context
!=
cmp_context
)
return
this
;
return
const_item
;
}
Item_field
*
subst
=
item_equal
->
get_first
();
Item_field
*
subst
=
item_equal
->
get_first
();
if
(
subst
&&
!
field
->
eq
(
subst
->
field
))
if
(
subst
&&
!
field
->
eq
(
subst
->
field
))
return
subst
;
return
subst
;
...
...
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