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
802dcc7a
Commit
802dcc7a
authored
Jun 21, 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-bug29104
parents
372c5e23
c6cc5096
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
6 deletions
+52
-6
mysql-test/r/view.result
mysql-test/r/view.result
+24
-0
mysql-test/t/view.test
mysql-test/t/view.test
+24
-0
sql/item.cc
sql/item.cc
+4
-6
No files found.
mysql-test/r/view.result
View file @
802dcc7a
...
...
@@ -3476,4 +3476,28 @@ a1 c
2 0
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2);
CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1;
SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
b SUM(a)
3 4
EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
a SUM(b)
1 6
2 3
EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort
SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
a SUM(b)
1 10
EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests.
mysql-test/t/view.test
View file @
802dcc7a
...
...
@@ -3324,4 +3324,28 @@ SELECT * FROM t1;
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
#
# Bug #29104: assertion abort for a query with a view column reference
# in the GROUP BY list and a condition requiring the value
# of another view column to be equal to a constant
#
CREATE
TABLE
t1
(
a
int
,
b
int
);
INSERT
INTO
t1
VALUES
(
1
,
2
),
(
2
,
2
),
(
1
,
3
),
(
1
,
2
);
CREATE
VIEW
v1
AS
SELECT
a
,
b
+
1
as
b
FROM
t1
;
SELECT
b
,
SUM
(
a
)
FROM
v1
WHERE
b
=
3
GROUP
BY
b
;
EXPLAIN
SELECT
b
,
SUM
(
a
)
FROM
v1
WHERE
b
=
3
GROUP
BY
b
;
SELECT
a
,
SUM
(
b
)
FROM
v1
WHERE
b
=
3
GROUP
BY
a
;
EXPLAIN
SELECT
a
,
SUM
(
b
)
FROM
v1
WHERE
b
=
3
GROUP
BY
a
;
SELECT
a
,
SUM
(
b
)
FROM
v1
WHERE
a
=
1
GROUP
BY
a
;
EXPLAIN
SELECT
a
,
SUM
(
b
)
FROM
v1
WHERE
a
=
1
GROUP
BY
a
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
.
sql/item.cc
View file @
802dcc7a
...
...
@@ -1938,10 +1938,11 @@ bool Item_field::val_bool_result()
bool
Item_field
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
if
(
item
->
type
()
!=
FIELD_ITEM
)
Item
*
real_item
=
((
Item
*
)
item
)
->
real_item
();
if
(
real_item
->
type
()
!=
FIELD_ITEM
)
return
0
;
Item_field
*
item_field
=
(
Item_field
*
)
item
;
Item_field
*
item_field
=
(
Item_field
*
)
real_
item
;
if
(
item_field
->
field
&&
field
)
return
item_field
->
field
==
field
;
/*
...
...
@@ -5642,8 +5643,7 @@ bool Item_outer_ref::fix_fields(THD *thd, Item **reference)
DESCRIPTION
A view column reference is considered equal to another column
reference if the second one is a view column and if both column
references resolve to the same item. It is assumed that both
items are of the same type.
references resolve to the same item.
RETURN
TRUE Referenced item is equal to given item
...
...
@@ -5659,8 +5659,6 @@ bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
if
(
item_ref
->
ref_type
()
==
VIEW_REF
)
{
Item
*
item_ref_ref
=
*
(
item_ref
->
ref
);
DBUG_ASSERT
((
*
ref
)
->
real_item
()
->
type
()
==
item_ref_ref
->
real_item
()
->
type
());
return
((
*
ref
)
->
real_item
()
==
item_ref_ref
->
real_item
());
}
}
...
...
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