mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed problem with ansi mode and GROUP BY with constants. (Bug #387)
sql/sql_select.cc: Fixed problem with ansi mode and GROUP BY with constants
This commit is contained in:
10
mysql-test/r/ansi.result
Normal file
10
mysql-test/r/ansi.result
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
drop table if exists t1;
|
||||||
|
SELECT 'A' || 'B';
|
||||||
|
'A' || 'B'
|
||||||
|
AB
|
||||||
|
CREATE TABLE t1 (id INT, id2 int);
|
||||||
|
SELECT id,NULL,1,1.1,'a' FROM t1 GROUP BY id;
|
||||||
|
id NULL 1 1.1 a
|
||||||
|
SELECT id FROM t1 GROUP BY id2;
|
||||||
|
't1.id' isn't in GROUP BY
|
||||||
|
drop table t1;
|
1
mysql-test/t/ansi-master.opt
Normal file
1
mysql-test/t/ansi-master.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--ansi
|
17
mysql-test/t/ansi.test
Normal file
17
mysql-test/t/ansi.test
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# Test of ansi mode
|
||||||
|
#
|
||||||
|
|
||||||
|
drop table if exists t1;
|
||||||
|
|
||||||
|
# Test some functions that works different in ansi mode
|
||||||
|
|
||||||
|
SELECT 'A' || 'B';
|
||||||
|
|
||||||
|
# Test GROUP BY behaviour
|
||||||
|
|
||||||
|
CREATE TABLE t1 (id INT, id2 int);
|
||||||
|
SELECT id,NULL,1,1.1,'a' FROM t1 GROUP BY id;
|
||||||
|
--error 1055
|
||||||
|
SELECT id FROM t1 GROUP BY id2;
|
||||||
|
drop table t1;
|
@ -6668,7 +6668,8 @@ setup_group(THD *thd,TABLE_LIST *tables,List<Item> &fields,
|
|||||||
|
|
||||||
while ((item=li++))
|
while ((item=li++))
|
||||||
{
|
{
|
||||||
if (item->type() != Item::SUM_FUNC_ITEM && !item->marker)
|
if (item->type() != Item::SUM_FUNC_ITEM && !item->marker &&
|
||||||
|
!item->const_item())
|
||||||
{
|
{
|
||||||
my_printf_error(ER_WRONG_FIELD_WITH_GROUP,
|
my_printf_error(ER_WRONG_FIELD_WITH_GROUP,
|
||||||
ER(ER_WRONG_FIELD_WITH_GROUP),
|
ER(ER_WRONG_FIELD_WITH_GROUP),
|
||||||
|
Reference in New Issue
Block a user