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
3cd67802
Commit
3cd67802
authored
Jul 22, 2006
by
gkodinov/kgeorge@macbook.mshome.net
Browse files
Options
Browse Files
Download
Plain Diff
Merge office:mysql/autopush/B20466-5.0-opt
into macbook.mshome.net:/Users/kgeorge/mysql/work/B20466-5.0-opt
parents
d45bd0ca
02820282
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
7 deletions
+57
-7
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+25
-0
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+23
-0
sql/sql_select.cc
sql/sql_select.cc
+9
-7
No files found.
mysql-test/r/group_by.result
View file @
3cd67802
...
...
@@ -796,3 +796,28 @@ aaa
show warnings;
Level Code Message
drop table t1, t2;
CREATE TABLE t1 (a tinyint(3), b varchar(255), PRIMARY KEY (a));
INSERT INTO t1 VALUES (1,'-----'), (6,'Allemagne'), (17,'Autriche'),
(25,'Belgique'), (54,'Danemark'), (62,'Espagne'), (68,'France');
CREATE TABLE t2 (a tinyint(3), b tinyint(3), PRIMARY KEY (a), KEY b (b));
INSERT INTO t2 VALUES (1,1), (2,1), (6,6), (18,17), (15,25), (16,25),
(17,25), (10,54), (5,62),(3,68);
CREATE VIEW v1 AS select t1.a, concat(t1.b,'') AS b, t1.b as real_b from t1;
explain
SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1
where t2.b=v1.a GROUP BY t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index b b 2 NULL 10 Using index
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 1 test.t2.b 1
SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1
where t2.b=v1.a GROUP BY t2.b;
a b real_b
1 ----- -----
6 Allemagne Allemagne
17 Autriche Autriche
25 Belgique Belgique
54 Danemark Danemark
62 Espagne Espagne
68 France France
DROP VIEW v1;
DROP TABLE t1,t2;
mysql-test/t/group_by.test
View file @
3cd67802
...
...
@@ -632,3 +632,26 @@ group by t1.c1;
show
warnings
;
drop
table
t1
,
t2
;
#
# Bug #20466: a view is mixing data when there's a trigger on the table
#
CREATE
TABLE
t1
(
a
tinyint
(
3
),
b
varchar
(
255
),
PRIMARY
KEY
(
a
));
INSERT
INTO
t1
VALUES
(
1
,
'-----'
),
(
6
,
'Allemagne'
),
(
17
,
'Autriche'
),
(
25
,
'Belgique'
),
(
54
,
'Danemark'
),
(
62
,
'Espagne'
),
(
68
,
'France'
);
CREATE
TABLE
t2
(
a
tinyint
(
3
),
b
tinyint
(
3
),
PRIMARY
KEY
(
a
),
KEY
b
(
b
));
INSERT
INTO
t2
VALUES
(
1
,
1
),
(
2
,
1
),
(
6
,
6
),
(
18
,
17
),
(
15
,
25
),
(
16
,
25
),
(
17
,
25
),
(
10
,
54
),
(
5
,
62
),(
3
,
68
);
CREATE
VIEW
v1
AS
select
t1
.
a
,
concat
(
t1
.
b
,
''
)
AS
b
,
t1
.
b
as
real_b
from
t1
;
explain
SELECT
straight_join
sql_no_cache
v1
.
a
,
v1
.
b
,
v1
.
real_b
from
t2
,
v1
where
t2
.
b
=
v1
.
a
GROUP
BY
t2
.
b
;
SELECT
straight_join
sql_no_cache
v1
.
a
,
v1
.
b
,
v1
.
real_b
from
t2
,
v1
where
t2
.
b
=
v1
.
a
GROUP
BY
t2
.
b
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
sql/sql_select.cc
View file @
3cd67802
...
...
@@ -13066,10 +13066,11 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
param
->
copy_funcs
.
empty
();
for
(
i
=
0
;
(
pos
=
li
++
);
i
++
)
{
if
(
pos
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
)
Item
*
real_pos
=
pos
->
real_item
();
if
(
real_pos
->
type
()
==
Item
::
FIELD_ITEM
)
{
Item_field
*
item
;
pos
=
pos
->
real_item
()
;
pos
=
real_pos
;
if
(
!
(
item
=
new
Item_field
(
thd
,
((
Item_field
*
)
pos
))))
goto
err
;
pos
=
item
;
...
...
@@ -13108,12 +13109,13 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
}
}
}
else
if
((
pos
->
type
()
==
Item
::
FUNC_ITEM
||
pos
->
type
()
==
Item
::
SUBSELECT_ITEM
||
pos
->
type
()
==
Item
::
CACHE_ITEM
||
pos
->
type
()
==
Item
::
COND_ITEM
)
&&
!
pos
->
with_sum_func
)
else
if
((
real_
pos
->
type
()
==
Item
::
FUNC_ITEM
||
real_
pos
->
type
()
==
Item
::
SUBSELECT_ITEM
||
real_
pos
->
type
()
==
Item
::
CACHE_ITEM
||
real_
pos
->
type
()
==
Item
::
COND_ITEM
)
&&
!
real_
pos
->
with_sum_func
)
{
// Save for send fields
pos
=
real_pos
;
/* TODO:
In most cases this result will be sent to the user.
This should be changed to use copy_int or copy_real depending
...
...
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