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
eefbc08b
Commit
eefbc08b
authored
Nov 25, 2008
by
Ingo Struewing
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
f65bd582
d47f9233
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
20 deletions
+110
-20
mysql-test/include/check-testcase.test
mysql-test/include/check-testcase.test
+19
-19
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+23
-0
mysql-test/r/partition.result
mysql-test/r/partition.result
+12
-0
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+29
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+15
-0
sql/ha_partition.cc
sql/ha_partition.cc
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+10
-0
No files found.
mysql-test/include/check-testcase.test
View file @
eefbc08b
...
@@ -11,12 +11,12 @@
...
@@ -11,12 +11,12 @@
#
#
# Dump all global variables
# Dump all global variables
#
#
show
global
variables
;
SHOW
GLOBAL
VARIABLES
WHERE
variable_name
!=
'timestamp'
;
#
#
# Dump all databases
# Dump all databases
#
#
show
databases
;
SHOW
DATABASES
;
#
#
# Dump the "test" database, all it's tables and their data
# Dump the "test" database, all it's tables and their data
...
@@ -29,23 +29,23 @@ show databases;
...
@@ -29,23 +29,23 @@ show databases;
#
#
--
exec
$MYSQL_DUMP
--
skip
-
comments
--
skip
-
lock
-
tables
--
no
-
data
mysql
--
exec
$MYSQL_DUMP
--
skip
-
comments
--
skip
-
lock
-
tables
--
no
-
data
mysql
use
mysql
;
use
mysql
;
select
*
from
columns_priv
;
SELECT
*
FROM
columns_priv
;
select
*
from
db
order
by
host
,
db
,
user
;
SELECT
*
FROM
db
ORDER
BY
host
,
db
,
user
;
select
*
from
func
;
SELECT
*
FROM
func
;
select
*
from
help_category
;
SELECT
*
FROM
help_category
;
select
*
from
help_keyword
;
SELECT
*
FROM
help_keyword
;
select
*
from
help_relation
;
SELECT
*
FROM
help_relation
;
select
*
from
help_relation
;
SELECT
*
FROM
help_relation
;
select
*
from
host
;
SELECT
*
FROM
host
;
select
*
from
proc
;
SELECT
*
FROM
proc
;
select
*
from
procs_priv
;
SELECT
*
FROM
procs_priv
;
select
*
from
tables_priv
;
SELECT
*
FROM
tables_priv
;
select
*
from
time_zone
;
SELECT
*
FROM
time_zone
;
select
*
from
time_zone_leap_second
;
SELECT
*
FROM
time_zone_leap_second
;
select
*
from
time_zone_name
;
SELECT
*
FROM
time_zone_name
;
select
*
from
time_zone_transition
;
SELECT
*
FROM
time_zone_transition
;
select
*
from
time_zone_transition_type
;
SELECT
*
FROM
time_zone_transition_type
;
select
*
from
user
;
SELECT
*
FROM
user
;
mysql-test/r/func_group.result
View file @
eefbc08b
...
@@ -1453,4 +1453,27 @@ LIMIT 1)
...
@@ -1453,4 +1453,27 @@ LIMIT 1)
1
1
DROP TABLE derived1;
DROP TABLE derived1;
DROP TABLE D;
DROP TABLE D;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
SET SQL_MODE='ONLY_FULL_GROUP_BY';
SELECT COUNT(*) FROM t1;
COUNT(*)
3
SELECT COUNT(*) FROM t1 where a=1;
COUNT(*)
3
SELECT COUNT(*),a FROM t1;
ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
COUNT(*)
9
SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
FROM t1 outr;
ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
SELECT COUNT(*) FROM t1 a JOIN t1 outr
ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
COUNT(*)
0
SET SQL_MODE=default;
DROP TABLE t1;
End of 5.0 tests
End of 5.0 tests
mysql-test/r/partition.result
View file @
eefbc08b
drop table if exists t1, t2;
drop table if exists t1, t2;
CREATE TABLE t1 (
pk INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (pk)
)
/*!50100 PARTITION BY HASH (pk)
PARTITIONS 2 */;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 WHERE pk < 0 ORDER BY pk;
pk
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL, KEY(a))
CREATE TABLE t1 (a INT NOT NULL, KEY(a))
PARTITION BY RANGE(a)
PARTITION BY RANGE(a)
(PARTITION p1 VALUES LESS THAN (200), PARTITION pmax VALUES LESS THAN MAXVALUE);
(PARTITION p1 VALUES LESS THAN (200), PARTITION pmax VALUES LESS THAN MAXVALUE);
...
...
mysql-test/t/func_group.test
View file @
eefbc08b
...
@@ -973,5 +973,34 @@ GROUP BY int_nokey LIMIT 1;
...
@@ -973,5 +973,34 @@ GROUP BY int_nokey LIMIT 1;
DROP
TABLE
derived1
;
DROP
TABLE
derived1
;
DROP
TABLE
D
;
DROP
TABLE
D
;
#
# Bug #39656: Behaviour different for agg functions with & without where -
# ONLY_FULL_GROUP_BY
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
);
INSERT
INTO
t1
VALUES
(
1
,
1
),
(
1
,
2
),
(
1
,
3
);
SET
SQL_MODE
=
'ONLY_FULL_GROUP_BY'
;
SELECT
COUNT
(
*
)
FROM
t1
;
SELECT
COUNT
(
*
)
FROM
t1
where
a
=
1
;
--
error
ER_MIX_OF_GROUP_FUNC_AND_FIELDS
SELECT
COUNT
(
*
),
a
FROM
t1
;
SELECT
COUNT
(
*
)
FROM
t1
a
JOIN
t1
b
ON
a
.
a
=
b
.
a
;
--
error
ER_MIX_OF_GROUP_FUNC_AND_FIELDS
SELECT
COUNT
(
*
),
(
SELECT
count
(
*
)
FROM
t1
inr
WHERE
inr
.
a
=
outr
.
a
)
FROM
t1
outr
;
SELECT
COUNT
(
*
)
FROM
t1
a
JOIN
t1
outr
ON
a
.
a
=
(
SELECT
count
(
*
)
FROM
t1
inr
WHERE
inr
.
a
=
outr
.
a
);
SET
SQL_MODE
=
default
;
DROP
TABLE
t1
;
###
###
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
mysql-test/t/partition.test
View file @
eefbc08b
...
@@ -14,6 +14,21 @@
...
@@ -14,6 +14,21 @@
drop
table
if
exists
t1
,
t2
;
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
enable_warnings
#
# Bug#40954: Crash if range search and order by.
#
CREATE
TABLE
t1
(
pk
INT
NOT
NULL
AUTO_INCREMENT
,
PRIMARY
KEY
(
pk
)
)
/*!50100 PARTITION BY HASH (pk)
PARTITIONS 2 */
;
INSERT
INTO
t1
VALUES
(
NULL
);
INSERT
INTO
t1
VALUES
(
NULL
);
INSERT
INTO
t1
VALUES
(
NULL
);
SELECT
*
FROM
t1
WHERE
pk
<
0
ORDER
BY
pk
;
DROP
TABLE
t1
;
#
#
# Bug#40494: Crash MYSQL server crashes on range access with partitioning
# Bug#40494: Crash MYSQL server crashes on range access with partitioning
# and order by
# and order by
...
...
sql/ha_partition.cc
View file @
eefbc08b
...
@@ -4490,7 +4490,8 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
...
@@ -4490,7 +4490,8 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
This can only read record to table->record[0], as it was set when
This can only read record to table->record[0], as it was set when
the table was being opened. We have to memcpy data ourselves.
the table was being opened. We have to memcpy data ourselves.
*/
*/
error
=
file
->
read_range_first
(
&
m_start_key
,
end_range
,
eq_range
,
TRUE
);
error
=
file
->
read_range_first
(
m_start_key
.
key
?
&
m_start_key
:
NULL
,
end_range
,
eq_range
,
TRUE
);
memcpy
(
rec_buf_ptr
,
table
->
record
[
0
],
m_rec_length
);
memcpy
(
rec_buf_ptr
,
table
->
record
[
0
],
m_rec_length
);
reverse_order
=
FALSE
;
reverse_order
=
FALSE
;
break
;
break
;
...
...
sql/sql_select.cc
View file @
eefbc08b
...
@@ -402,11 +402,21 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array,
...
@@ -402,11 +402,21 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array,
{
{
int
res
;
int
res
;
nesting_map
save_allow_sum_func
=
thd
->
lex
->
allow_sum_func
;
nesting_map
save_allow_sum_func
=
thd
->
lex
->
allow_sum_func
;
/*
Need to save the value, so we can turn off only the new NON_AGG_FIELD
additions coming from the WHERE
*/
uint8
saved_flag
=
thd
->
lex
->
current_select
->
full_group_by_flag
;
DBUG_ENTER
(
"setup_without_group"
);
DBUG_ENTER
(
"setup_without_group"
);
thd
->
lex
->
allow_sum_func
&=
~
(
1
<<
thd
->
lex
->
current_select
->
nest_level
);
thd
->
lex
->
allow_sum_func
&=
~
(
1
<<
thd
->
lex
->
current_select
->
nest_level
);
res
=
setup_conds
(
thd
,
tables
,
leaves
,
conds
);
res
=
setup_conds
(
thd
,
tables
,
leaves
,
conds
);
/* it's not wrong to have non-aggregated columns in a WHERE */
if
(
thd
->
variables
.
sql_mode
&
MODE_ONLY_FULL_GROUP_BY
)
thd
->
lex
->
current_select
->
full_group_by_flag
=
saved_flag
|
(
thd
->
lex
->
current_select
->
full_group_by_flag
&
~
NON_AGG_FIELD_USED
);
thd
->
lex
->
allow_sum_func
|=
1
<<
thd
->
lex
->
current_select
->
nest_level
;
thd
->
lex
->
allow_sum_func
|=
1
<<
thd
->
lex
->
current_select
->
nest_level
;
res
=
res
||
setup_order
(
thd
,
ref_pointer_array
,
tables
,
fields
,
all_fields
,
res
=
res
||
setup_order
(
thd
,
ref_pointer_array
,
tables
,
fields
,
all_fields
,
order
);
order
);
...
...
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