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
f65e0547
Commit
f65e0547
authored
Nov 10, 2004
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0
parents
0e9cef6b
597781c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
5 deletions
+76
-5
mysql-test/r/select.result
mysql-test/r/select.result
+33
-0
mysql-test/t/select.test
mysql-test/t/select.test
+36
-0
sql/sql_select.cc
sql/sql_select.cc
+7
-5
No files found.
mysql-test/r/select.result
View file @
f65e0547
...
...
@@ -2333,3 +2333,36 @@ EXPLAIN SELECT i FROM t1 WHERE i=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
DROP TABLE t1;
CREATE TABLE t1 (
K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '',
K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000',
F2I4 int(11) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES
('W%RT', '0100', 1),
('W-RT', '0100', 1),
('WART', '0100', 1),
('WART', '0200', 1),
('WERT', '0100', 2),
('WORT','0200', 2),
('WT', '0100', 2),
('W_RT', '0100', 2),
('WaRT', '0100', 3),
('WART', '0300', 3),
('WRT' , '0400', 3),
('WURM', '0500', 3),
('W%T', '0600', 4),
('WA%T', '0700', 4),
('WA_T', '0800', 4);
SELECT K2C4, K4N4, F2I4 FROM t1
WHERE K2C4 = 'WART' AND
(F2I4 = 2 AND K2C4 = 'WART' OR (F2I4 = 2 OR K4N4 = '0200'));
K2C4 K4N4 F2I4
WART 0200 1
SELECT K2C4, K4N4, F2I4 FROM t1
WHERE K2C4 = 'WART' AND (K2C4 = 'WART' OR K4N4 = '0200');
K2C4 K4N4 F2I4
WART 0100 1
WART 0200 1
WART 0300 3
DROP TABLE t1;
mysql-test/t/select.test
View file @
f65e0547
...
...
@@ -1910,3 +1910,39 @@ EXPLAIN SELECT i FROM t1 WHERE i=1;
EXPLAIN
SELECT
i
FROM
t1
WHERE
i
=
1
;
DROP
TABLE
t1
;
#
# Test for bug #6474
#
CREATE
TABLE
t1
(
K2C4
varchar
(
4
)
character
set
latin1
collate
latin1_bin
NOT
NULL
default
''
,
K4N4
varchar
(
4
)
character
set
latin1
collate
latin1_bin
NOT
NULL
default
'0000'
,
F2I4
int
(
11
)
NOT
NULL
default
'0'
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
'W%RT'
,
'0100'
,
1
),
(
'W-RT'
,
'0100'
,
1
),
(
'WART'
,
'0100'
,
1
),
(
'WART'
,
'0200'
,
1
),
(
'WERT'
,
'0100'
,
2
),
(
'WORT'
,
'0200'
,
2
),
(
'WT'
,
'0100'
,
2
),
(
'W_RT'
,
'0100'
,
2
),
(
'WaRT'
,
'0100'
,
3
),
(
'WART'
,
'0300'
,
3
),
(
'WRT'
,
'0400'
,
3
),
(
'WURM'
,
'0500'
,
3
),
(
'W%T'
,
'0600'
,
4
),
(
'WA%T'
,
'0700'
,
4
),
(
'WA_T'
,
'0800'
,
4
);
SELECT
K2C4
,
K4N4
,
F2I4
FROM
t1
WHERE
K2C4
=
'WART'
AND
(
F2I4
=
2
AND
K2C4
=
'WART'
OR
(
F2I4
=
2
OR
K4N4
=
'0200'
));
SELECT
K2C4
,
K4N4
,
F2I4
FROM
t1
WHERE
K2C4
=
'WART'
AND
(
K2C4
=
'WART'
OR
K4N4
=
'0200'
);
DROP
TABLE
t1
;
sql/sql_select.cc
View file @
f65e0547
...
...
@@ -6645,10 +6645,7 @@ static Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
List
<
Item
>
eq_list
;
Item_func_eq
*
eq_item
=
0
;
if
(((
Item
*
)
item_equal
)
->
const_item
()
&&
!
item_equal
->
val_int
())
{
cond
=
new
Item_int
((
char
*
)
"FALSE"
,
0
,
1
);
return
cond
;
}
return
new
Item_int
((
longlong
)
0
,
1
);
Item
*
item_const
=
item_equal
->
get_const
();
Item_equal_iterator
it
(
*
item_equal
);
Item
*
head
;
...
...
@@ -6691,9 +6688,14 @@ static Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
}
if
(
!
cond
&&
!
eq_list
.
head
())
{
if
(
!
eq_item
)
return
new
Item_int
((
longlong
)
1
,
1
);
return
eq_item
;
}
eq_list
.
push_back
(
eq_item
);
if
(
eq_item
)
eq_list
.
push_back
(
eq_item
);
if
(
!
cond
)
cond
=
new
Item_cond_and
(
eq_list
);
else
...
...
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