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
7fac8214
Commit
7fac8214
authored
Aug 13, 2004
by
lenz@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge lgrimmer@build.mysql.com:/home/bk/mysql-4.0
into mysql.com:/space/my/mysql-4.0
parents
b1f5aa00
698a88b1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
2 deletions
+98
-2
mysql-test/r/having.result
mysql-test/r/having.result
+40
-0
mysql-test/t/having.test
mysql-test/t/having.test
+46
-0
sql/ha_heap.cc
sql/ha_heap.cc
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+10
-1
No files found.
mysql-test/r/having.result
View file @
7fac8214
...
@@ -78,3 +78,43 @@ sqty
...
@@ -78,3 +78,43 @@ sqty
5
5
9
9
drop table t1;
drop table t1;
CREATE TABLE t1 (
`id` bigint(20) NOT NULL default '0',
`description` text
) TYPE=MyISAM;
CREATE TABLE t2 (
`id` bigint(20) NOT NULL default '0',
`description` varchar(20)
) TYPE=MyISAM;
INSERT INTO t1 VALUES (1, 'test');
INSERT INTO t2 VALUES (1, 'test');
CREATE TABLE t3 (
`id` bigint(20) NOT NULL default '0',
`order_id` bigint(20) NOT NULL default '0'
) TYPE=MyISAM;
select
a.id, a.description,
count(b.id) as c
from t1 a left join t3 b on a.id=b.order_id
group by a.id, a.description
having (a.description is not null) and (c=0);
id description c
1 test 0
select
a.*,
count(b.id) as c
from t2 a left join t3 b on a.id=b.order_id
group by a.id, a.description
having (a.description is not null) and (c=0);
id description c
1 test 0
INSERT INTO t1 VALUES (2, 'test2');
select
a.id, a.description,
count(b.id) as c
from t1 a left join t3 b on a.id=b.order_id
group by a.id, a.description
having (a.description is not null) and (c=0);
id description c
1 test 0
2 test2 0
mysql-test/t/having.test
View file @
7fac8214
...
@@ -66,3 +66,49 @@ select id, sum(qty) as sqty from t1 group by id having sqty>2;
...
@@ -66,3 +66,49 @@ select id, sum(qty) as sqty from t1 group by id having sqty>2;
select
sum
(
qty
)
as
sqty
from
t1
group
by
id
having
count
(
id
)
>
0
;
select
sum
(
qty
)
as
sqty
from
t1
group
by
id
having
count
(
id
)
>
0
;
select
sum
(
qty
)
as
sqty
from
t1
group
by
id
having
count
(
distinct
id
)
>
0
;
select
sum
(
qty
)
as
sqty
from
t1
group
by
id
having
count
(
distinct
id
)
>
0
;
drop
table
t1
;
drop
table
t1
;
#
# Test case for Bug #4358 Problem with HAVING clause that uses alias from the
# select list and TEXT field
#
CREATE
TABLE
t1
(
`id`
bigint
(
20
)
NOT
NULL
default
'0'
,
`description`
text
)
TYPE
=
MyISAM
;
CREATE
TABLE
t2
(
`id`
bigint
(
20
)
NOT
NULL
default
'0'
,
`description`
varchar
(
20
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
,
'test'
);
INSERT
INTO
t2
VALUES
(
1
,
'test'
);
CREATE
TABLE
t3
(
`id`
bigint
(
20
)
NOT
NULL
default
'0'
,
`order_id`
bigint
(
20
)
NOT
NULL
default
'0'
)
TYPE
=
MyISAM
;
select
a
.
id
,
a
.
description
,
count
(
b
.
id
)
as
c
from
t1
a
left
join
t3
b
on
a
.
id
=
b
.
order_id
group
by
a
.
id
,
a
.
description
having
(
a
.
description
is
not
null
)
and
(
c
=
0
);
select
a
.*
,
count
(
b
.
id
)
as
c
from
t2
a
left
join
t3
b
on
a
.
id
=
b
.
order_id
group
by
a
.
id
,
a
.
description
having
(
a
.
description
is
not
null
)
and
(
c
=
0
);
INSERT
INTO
t1
VALUES
(
2
,
'test2'
);
select
a
.
id
,
a
.
description
,
count
(
b
.
id
)
as
c
from
t1
a
left
join
t3
b
on
a
.
id
=
b
.
order_id
group
by
a
.
id
,
a
.
description
having
(
a
.
description
is
not
null
)
and
(
c
=
0
);
sql/ha_heap.cc
View file @
7fac8214
...
@@ -264,7 +264,8 @@ THR_LOCK_DATA **ha_heap::store_lock(THD *thd,
...
@@ -264,7 +264,8 @@ THR_LOCK_DATA **ha_heap::store_lock(THD *thd,
int
ha_heap
::
delete_table
(
const
char
*
name
)
int
ha_heap
::
delete_table
(
const
char
*
name
)
{
{
int
error
=
heap_delete_table
(
name
);
char
buff
[
FN_REFLEN
];
int
error
=
heap_delete_table
(
fn_format
(
buff
,
name
,
""
,
""
,
4
+
2
));
return
error
==
ENOENT
?
0
:
error
;
return
error
==
ENOENT
?
0
:
error
;
}
}
...
...
sql/sql_select.cc
View file @
7fac8214
...
@@ -7172,7 +7172,16 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields)
...
@@ -7172,7 +7172,16 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields)
if
(
!
(
pos
=
new
Item_copy_string
(
pos
)))
if
(
!
(
pos
=
new
Item_copy_string
(
pos
)))
goto
err
;
goto
err
;
VOID
(
li
.
replace
(
pos
));
VOID
(
li
.
replace
(
pos
));
if
(
param
->
copy_funcs
.
push_back
(
pos
))
/*
Item_copy_string::copy for function can call
Item_copy_string::val_int for blob via Item_ref.
But if Item_copy_string::copy for blob isn't called before,
it's value will be wrong
so let's insert Item_copy_string for blobs in the beginning of
copy_funcs
(to see full test case look at having.test, BUG #4358)
*/
if
(
param
->
copy_funcs
.
push_front
(
pos
))
goto
err
;
goto
err
;
continue
;
continue
;
}
}
...
...
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