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
5a01be84
Commit
5a01be84
authored
Jan 09, 2008
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B33133-5.0-opt
parents
7fe932ed
2fc45f01
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
1 deletion
+57
-1
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+12
-0
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+15
-0
sql/sql_base.cc
sql/sql_base.cc
+30
-1
No files found.
mysql-test/r/func_group.result
View file @
5a01be84
...
...
@@ -1407,4 +1407,16 @@ SELECT COUNT(*), a FROM t1;
COUNT(*) a
4 1
DROP TABLE t1;
set SQL_MODE=ONLY_FULL_GROUP_BY;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4);
CREATE VIEW v1 AS SELECT a,(a + 1) AS y FROM t1;
EXPLAIN EXTENDED SELECT y FROM v1 GROUP BY v1.y;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
Warnings:
Note 1003 select (`test`.`t1`.`a` + 1) AS `y` from `test`.`t1` group by (`test`.`t1`.`a` + 1)
DROP VIEW v1;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
End of 5.0 tests
mysql-test/t/func_group.test
View file @
5a01be84
...
...
@@ -901,5 +901,20 @@ SELECT COUNT(*), a FROM t1;
DROP
TABLE
t1
;
#
# Bug #33133: Views are not transparent
#
set
SQL_MODE
=
ONLY_FULL_GROUP_BY
;
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
),(
4
);
CREATE
VIEW
v1
AS
SELECT
a
,(
a
+
1
)
AS
y
FROM
t1
;
EXPLAIN
EXTENDED
SELECT
y
FROM
v1
GROUP
BY
v1
.
y
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
SET
SQL_MODE
=
DEFAULT
;
###
--
echo
End
of
5.0
tests
sql/sql_base.cc
View file @
5a01be84
...
...
@@ -4255,6 +4255,35 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
break
;
}
}
else
if
(
table_name
&&
item
->
type
()
==
Item
::
REF_ITEM
&&
((
Item_ref
*
)
item
)
->
ref_type
()
==
Item_ref
::
VIEW_REF
)
{
/*
TODO:Here we process prefixed view references only. What we should
really do is process all types of Item_refs. But this will currently
lead to a clash with the way references to outer SELECTs (from the
HAVING clause) are handled in e.g. :
SELECT 1 FROM t1 AS t1_o GROUP BY a
HAVING (SELECT t1_o.a FROM t1 AS t1_i GROUP BY t1_i.a LIMIT 1).
Processing all Item_refs here will cause t1_o.a to resolve to itself.
We still need to process the special case of Item_direct_view_ref
because in the context of views they have the same meaning as
Item_field for tables.
*/
Item_ident
*
item_ref
=
(
Item_ident
*
)
item
;
if
(
item_ref
->
name
&&
item_ref
->
table_name
&&
!
my_strcasecmp
(
system_charset_info
,
item_ref
->
name
,
field_name
)
&&
!
my_strcasecmp
(
table_alias_charset
,
item_ref
->
table_name
,
table_name
)
&&
(
!
db_name
||
(
item_ref
->
db_name
&&
!
strcmp
(
item_ref
->
db_name
,
db_name
))))
{
found
=
li
.
ref
();
*
counter
=
i
;
*
resolution
=
RESOLVED_IGNORING_ALIAS
;
break
;
}
}
}
if
(
!
found
)
{
...
...
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