Bug in SQL_CALC_FOUND_ROWS and LIMIT 0 in MySQL-4.1
am 19.11.2002 18:01:30 von Jocelyn Fournier
Hi,
It seems it remains a bug with LIMIT 0 and SQL_CALC_FOUND_ROWS :)
How-to-repeat :
CREATE TABLE `threadhardwarefr7` (
`numeropost` mediumint(8) unsigned NOT NULL default '0',
`numreponse` int(10) unsigned NOT NULL auto_increment,
PRIMARY KEY (`numeropost`,`numreponse`),
UNIQUE KEY `numreponse` (`numreponse`)
) TYPE=MyISAM;
INSERT INTO threadhardwarefr7 VALUES (1,1),(1,2);
SELECT SQL_CALC_FOUND_ROWS numeropost FROM threadhardwarefr7 ORDER BY
numeropost DESC LIMIT 0;
+------------+
| numeropost |
+------------+
| 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-thread13036@lists.mysql.com
To unsubscribe, e-mail
Re: Bug in SQL_CALC_FOUND_ROWS and LIMIT 0 in MySQL-4.1
am 19.11.2002 18:32:29 von Sinisa Milivojevic
Jocelyn Fournier writes:
> Hi,
>
> It seems it remains a bug with LIMIT 0 and SQL_CALC_FOUND_ROWS :)
>
> How-to-repeat :
>
> CREATE TABLE `threadhardwarefr7` (
> `numeropost` mediumint(8) unsigned NOT NULL default '0',
> `numreponse` int(10) unsigned NOT NULL auto_increment,
> PRIMARY KEY (`numeropost`,`numreponse`),
> UNIQUE KEY `numreponse` (`numreponse`)
> ) TYPE=MyISAM;
>
> INSERT INTO threadhardwarefr7 VALUES (1,1),(1,2);
>
> SELECT SQL_CALC_FOUND_ROWS numeropost FROM threadhardwarefr7 ORDER BY
> numeropost DESC LIMIT 0;
>
> +------------+
> | numeropost |
> +------------+
> | 1 |
> +------------+
> 1 row in set (0.00 sec)
>
> Regards,
> Jocelyn
Thank you for your bug report, which enabled us to fix the above bug.
Here is a patch that fixes it, which will soon be in 4.1 BK tree:
===== sql/sql_select.cc 1.202 vs edited =====
*** /tmp/sql_select.cc-1.202-27079 Mon Nov 18 22:20:26 2002
--- edited/sql/sql_select.cc Tue Nov 19 19:23:08 2002
***************
*** 324,330 ****
this->group= group_list != 0;
row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
unit->select_limit_cnt);
! do_send_rows = (row_limit) ? 1 : 0;
this->unit= unit;
#ifdef RESTRICTED_GROUP
--- 324,330 ----
this->group= group_list != 0;
row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
unit->select_limit_cnt);
! do_send_rows = (unit->select_limit_cnt) ? 1 : 0;
this->unit= unit;
#ifdef RESTRICTED_GROUP
--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ 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-thread13037@lists.mysql.com
To unsubscribe, e-mail