Bug with derived table and group function in MySQL-4.1

Bug with derived table and group function in MySQL-4.1

am 23.11.2002 18:46:44 von Jocelyn Fournier

Hi,

How-to-repeat :

SELECT (SELECT 1),MAX(1) FROM (SELECT 1);
ERROR 1111: Invalid use of group function

However :

SELECT 1,MAX(1) FROM (SELECT 1);
+---+--------+
| 1 | MAX(1) |
+---+--------+
| 1 | 1 |
+---+--------+
1 row in set (0.00 sec)

Regards,
Jocelyn

------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13089@lists.mysql.com
To unsubscribe, e-mail

Re: Bug with derived table and group function in MySQL-4.1

am 23.11.2002 20:56:53 von Sanja Byelkin

Hi!

On Sun, Nov 24, 2002 at 05:49:19PM -0000, Jocelyn Fournier wrote:
> Hi,
>
> How-to-repeat :
>
> SELECT (SELECT 1),MAX(1) FROM (SELECT 1);
> ERROR 1111: Invalid use of group function

Thank you for good bugreport. Here is fix of the bug:

*** a/sql/sql_base.cc Sat Nov 23 21:55:54 2002
--- b/sql/sql_base.cc Sat Nov 23 21:55:54 2002
***************
*** 2225,2232 ****
{
DBUG_ENTER("setup_conds");
thd->set_query_id=1;
! thd->cond_count=0;
! thd->allow_sum_func=0;
if (*conds)
{
thd->where="where clause";
--- 2225,2234 ----
{
DBUG_ENTER("setup_conds");
thd->set_query_id=1;
!
! thd->cond_count= 0;
! bool save_allow_sum_func= thd->allow_sum_func;
! thd->allow_sum_func= 0;
if (*conds)
{
thd->where="where clause";
***************
*** 2299,2304 ****
--- 2301,2307 ----
table->on_expr=and_conds(table->on_expr,cond_and);
}
}
+ thd->allow_sum_func= save_allow_sum_func;
DBUG_RETURN(test(thd->fatal_error));
}



[skip]

--
For technical support contracts, visit https://order.mysql.com/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Oleksandr Byelkin
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Lugansk, Ukraine
<___/ www.mysql.com

------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13090@lists.mysql.com
To unsubscribe, e-mail