Bug in MySQL-4.1 : wrong error message with dependant UNION

Bug in MySQL-4.1 : wrong error message with dependant UNION

am 10.11.2002 04:17:12 von Jocelyn Fournier

Hi,

How-to-repeat :

CREATE TABLE iftest (field char(1) NOT NULL DEFAULT 'b');
INSERT INTO iftest VALUES ();

mysql> SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM
(SELECT 1) HAVING field='b');
ERROR 1041: Out of memory; Check if mysqld or some other process uses all
available memory. If not you may have to use 'ulimit' to allow mysqld to use
more memory or you can add more swap space

EXPLAIN returns the correct error message :

mysql> EXPLAIN SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1
FROM (SELECT 1) HAVING field='b');
ERROR 1240: Subselect returns more than 1 record

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-thread12934@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 10.11.2002 09:43:56 von Sanja Byelkin

Hi!

On Sun, Nov 10, 2002 at 03:17:12AM -0000, Jocelyn Fournier wrote:
> Hi,
>
> How-to-repeat :
>
> CREATE TABLE iftest (field char(1) NOT NULL DEFAULT 'b');
> INSERT INTO iftest VALUES ();
>
> mysql> SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM
> (SELECT 1) HAVING field='b');
> ERROR 1041: Out of memory; Check if mysqld or some other process uses all
> available memory. If not you may have to use 'ulimit' to allow mysqld to use
> more memory or you can add more swap space
>
> EXPLAIN returns the correct error message :
>
> mysql> EXPLAIN SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1
> FROM (SELECT 1) HAVING field='b');
> ERROR 1240: Subselect returns more than 1 record

Thank you for your excellent work of testing mysql.

As I understand, this test is based on patch provided by Sinisa about
"1146: Table 'test.' doesn't exist".

I have some problem with that patch, but when that problems will be solved
I'll test your example, and if problem will not gone I'll provide patch for
it.

--
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-thread12937@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 11.11.2002 12:14:18 von Jocelyn Fournier

Hi,

It seems I have reproduced the bug without the sinisa patch :

How-to-repeat :

CREATE TABLE `forumconthardwarefr7` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
`maxnumrep` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`numeropost`),
UNIQUE KEY `maxnumrep` (`maxnumrep`)
) TYPE=MyISAM ROW_FORMAT=FIXED

INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES (1,0),(2,1);

mysql> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1
FROM forumconthardwarefr7 HAVING a=1);
ERROR 1041: Out of memory; Check if mysqld or some other process uses all
available memory. If not you may have to use 'ulimit' to allow mysqld to use
more memory or you can add more swap space

Regards,
Jocelyn

----- Original Message -----
From: "Sanja Byelkin"
To: "Jocelyn Fournier"
Cc:
Sent: Sunday, November 10, 2002 8:43 AM
Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION


> Hi!
>
> On Sun, Nov 10, 2002 at 03:17:12AM -0000, Jocelyn Fournier wrote:
> > Hi,
> >
> > How-to-repeat :
> >
> > CREATE TABLE iftest (field char(1) NOT NULL DEFAULT 'b');
> > INSERT INTO iftest VALUES ();
> >
> > mysql> SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1
FROM
> > (SELECT 1) HAVING field='b');
> > ERROR 1041: Out of memory; Check if mysqld or some other process uses
all
> > available memory. If not you may have to use 'ulimit' to allow mysqld to
use
> > more memory or you can add more swap space
> >
> > EXPLAIN returns the correct error message :
> >
> > mysql> EXPLAIN SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL
SELECT 1
> > FROM (SELECT 1) HAVING field='b');
> > ERROR 1240: Subselect returns more than 1 record
>
> Thank you for your excellent work of testing mysql.
>
> As I understand, this test is based on patch provided by Sinisa about
> "1146: Table 'test.' doesn't exist".
>
> I have some problem with that patch, but when that problems will be solved
> I'll test your example, and if problem will not gone I'll provide patch
for
> it.
>
> --
> 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-thread12943@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 11.11.2002 13:14:52 von Jocelyn Fournier

Hi,

A little variant which crashes (just in case) :

mysql> select numeropost FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM
forumconthardwarefr7 HAVING a=1);
ERROR 2006: MySQL server has gone away

Stack trace :

0x80a1971 handle_segfault(int) + 481
0x8286968 pthread_sighandler + 176
0x8084506 Field::offset() + 6
0x80cb9ef create_tmp_table(THD*, TMP_TABLE_PARAM*, List&, st_order*,
bool, bool, bool, unsigned long, st_select_lex_unit*) + 2287
0x80c99d4 JOIN::exec() + 932
0x80ca79f mysql_select(THD*, st_table_list*, List&, Item*, st_order*,
st_order*, Item*, st_order*, unsigned long, select_result*,
st_select_lex_unit*, st_select_lex*) + 111
0x80c86f7 handle_select(THD*, st_lex*, select_result*) + 247
0x80abbe9 mysql_execute_command(THD*) + 585
0x80b0585 mysql_parse(THD*, char*, unsigned) + 149
0x80aab27 dispatch_command(enum_server_command, THD*, char*, unsigned) + 855
0x80aa7b6 do_command(THD*) + 118
0x80aa08f handle_one_connection(void*) + 895
0x82841fa pthread_start_thread + 218
0x82b86aa thread_start + 4

Regards,
Jocelyn

----- Original Message -----
From: "Jocelyn Fournier"
To: "Sanja Byelkin"
Cc:
Sent: Monday, November 11, 2002 11:14 AM
Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION


> Hi,
>
> It seems I have reproduced the bug without the sinisa patch :
>
> How-to-repeat :
>
> CREATE TABLE `forumconthardwarefr7` (
> `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
> `maxnumrep` int(10) unsigned NOT NULL default '0',
> PRIMARY KEY (`numeropost`),
> UNIQUE KEY `maxnumrep` (`maxnumrep`)
> ) TYPE=MyISAM ROW_FORMAT=FIXED
>
> INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES
(1,0),(2,1);
>
> mysql> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1
> FROM forumconthardwarefr7 HAVING a=1);
> ERROR 1041: Out of memory; Check if mysqld or some other process uses all
> available memory. If not you may have to use 'ulimit' to allow mysqld to
use
> more memory or you can add more swap space
>
> Regards,
> Jocelyn
>
> ----- Original Message -----
> From: "Sanja Byelkin"
> To: "Jocelyn Fournier"
> Cc:
> Sent: Sunday, November 10, 2002 8:43 AM
> Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION
>
>
> > Hi!
> >
> > On Sun, Nov 10, 2002 at 03:17:12AM -0000, Jocelyn Fournier wrote:
> > > Hi,
> > >
> > > How-to-repeat :
> > >
> > > CREATE TABLE iftest (field char(1) NOT NULL DEFAULT 'b');
> > > INSERT INTO iftest VALUES ();
> > >
> > > mysql> SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1
> FROM
> > > (SELECT 1) HAVING field='b');
> > > ERROR 1041: Out of memory; Check if mysqld or some other process uses
> all
> > > available memory. If not you may have to use 'ulimit' to allow mysqld
to
> use
> > > more memory or you can add more swap space
> > >
> > > EXPLAIN returns the correct error message :
> > >
> > > mysql> EXPLAIN SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL
> SELECT 1
> > > FROM (SELECT 1) HAVING field='b');
> > > ERROR 1240: Subselect returns more than 1 record
> >
> > Thank you for your excellent work of testing mysql.
> >
> > As I understand, this test is based on patch provided by Sinisa about
> > "1146: Table 'test.' doesn't exist".
> >
> > I have some problem with that patch, but when that problems will be
solved
> > I'll test your example, and if problem will not gone I'll provide patch
> for
> > it.
> >
> > --
> > 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-thread12945@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 11.11.2002 17:35:49 von Jocelyn Fournier

Hi,

A small error in my bug report, the right query is :

How-to-repeat :

select numeropost as a FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM
forumconthardwarefr7 HAVING a=1);

Regards,
Jocelyn
----- Original Message -----
From: "Jocelyn Fournier"
To: "Sanja Byelkin"
Cc:
Sent: Monday, November 11, 2002 12:14 PM
Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION


> Hi,
>
> A little variant which crashes (just in case) :
>
> mysql> select numeropost FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM
> forumconthardwarefr7 HAVING a=1);
> ERROR 2006: MySQL server has gone away
>
> Stack trace :
>
> 0x80a1971 handle_segfault(int) + 481
> 0x8286968 pthread_sighandler + 176
> 0x8084506 Field::offset() + 6
> 0x80cb9ef create_tmp_table(THD*, TMP_TABLE_PARAM*, List&, st_order*,
> bool, bool, bool, unsigned long, st_select_lex_unit*) + 2287
> 0x80c99d4 JOIN::exec() + 932
> 0x80ca79f mysql_select(THD*, st_table_list*, List&, Item*,
st_order*,
> st_order*, Item*, st_order*, unsigned long, select_result*,
> st_select_lex_unit*, st_select_lex*) + 111
> 0x80c86f7 handle_select(THD*, st_lex*, select_result*) + 247
> 0x80abbe9 mysql_execute_command(THD*) + 585
> 0x80b0585 mysql_parse(THD*, char*, unsigned) + 149
> 0x80aab27 dispatch_command(enum_server_command, THD*, char*, unsigned) +
855
> 0x80aa7b6 do_command(THD*) + 118
> 0x80aa08f handle_one_connection(void*) + 895
> 0x82841fa pthread_start_thread + 218
> 0x82b86aa thread_start + 4
>
> Regards,
> Jocelyn
>
> ----- Original Message -----
> From: "Jocelyn Fournier"
> To: "Sanja Byelkin"
> Cc:
> Sent: Monday, November 11, 2002 11:14 AM
> Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION
>
>
> > Hi,
> >
> > It seems I have reproduced the bug without the sinisa patch :
> >
> > How-to-repeat :
> >
> > CREATE TABLE `forumconthardwarefr7` (
> > `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
> > `maxnumrep` int(10) unsigned NOT NULL default '0',
> > PRIMARY KEY (`numeropost`),
> > UNIQUE KEY `maxnumrep` (`maxnumrep`)
> > ) TYPE=MyISAM ROW_FORMAT=FIXED
> >
> > INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES
> (1,0),(2,1);
> >
> > mysql> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT
1
> > FROM forumconthardwarefr7 HAVING a=1);
> > ERROR 1041: Out of memory; Check if mysqld or some other process uses
all
> > available memory. If not you may have to use 'ulimit' to allow mysqld to
> use
> > more memory or you can add more swap space
> >
> > Regards,
> > Jocelyn
> >
> > ----- Original Message -----
> > From: "Sanja Byelkin"
> > To: "Jocelyn Fournier"
> > Cc:
> > Sent: Sunday, November 10, 2002 8:43 AM
> > Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION
> >
> >
> > > Hi!
> > >
> > > On Sun, Nov 10, 2002 at 03:17:12AM -0000, Jocelyn Fournier wrote:
> > > > Hi,
> > > >
> > > > How-to-repeat :
> > > >
> > > > CREATE TABLE iftest (field char(1) NOT NULL DEFAULT 'b');
> > > > INSERT INTO iftest VALUES ();
> > > >
> > > > mysql> SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1
> > FROM
> > > > (SELECT 1) HAVING field='b');
> > > > ERROR 1041: Out of memory; Check if mysqld or some other process
uses
> > all
> > > > available memory. If not you may have to use 'ulimit' to allow
mysqld
> to
> > use
> > > > more memory or you can add more swap space
> > > >
> > > > EXPLAIN returns the correct error message :
> > > >
> > > > mysql> EXPLAIN SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL
> > SELECT 1
> > > > FROM (SELECT 1) HAVING field='b');
> > > > ERROR 1240: Subselect returns more than 1 record
> > >
> > > Thank you for your excellent work of testing mysql.
> > >
> > > As I understand, this test is based on patch provided by Sinisa about
> > > "1146: Table 'test.' doesn't exist".
> > >
> > > I have some problem with that patch, but when that problems will be
> solved
> > > I'll test your example, and if problem will not gone I'll provide
patch
> > for
> > > it.
> > >
> > > --
> > > 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-thread12948@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 13.11.2002 00:19:35 von Sanja Byelkin

Hi!

On Mon, Nov 11, 2002 at 11:14:18AM -0000, Jocelyn Fournier wrote:
> Hi,
>
> It seems I have reproduced the bug without the sinisa patch :
>
> How-to-repeat :
>
> CREATE TABLE `forumconthardwarefr7` (
> `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
> `maxnumrep` int(10) unsigned NOT NULL default '0',
> PRIMARY KEY (`numeropost`),
> UNIQUE KEY `maxnumrep` (`maxnumrep`)
> ) TYPE=MyISAM ROW_FORMAT=FIXED
>
> INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES (1,0),(2,1);
>
> mysql> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1
> FROM forumconthardwarefr7 HAVING a=1);
> ERROR 1041: Out of memory; Check if mysqld or some other process uses all
> available memory. If not you may have to use 'ulimit' to allow mysqld to use
> more memory or you can add more swap space

Thank you for bug report, it help me to fix 2 bugs, here is putch:

diff -Nrc a/sql/item_subselect.cc b/sql/item_subselect.cc
*** a/sql/item_subselect.cc Wed Nov 13 01:18:10 2002
--- b/sql/item_subselect.cc Wed Nov 13 01:18:10 2002
***************
*** 33,39 ****
#include "sql_select.h"

Item_subselect::Item_subselect():
! Item(), engine_owner(1), value_assigned(0)
{
assign_null();
/*
--- 33,39 ----
#include "sql_select.h"

Item_subselect::Item_subselect():
! Item_result_field(), engine_owner(1), value_assigned(0)
{
assign_null();
/*
diff -Nrc a/sql/item_subselect.h b/sql/item_subselect.h
*** a/sql/item_subselect.h Wed Nov 13 01:18:10 2002
--- b/sql/item_subselect.h Wed Nov 13 01:18:10 2002
***************
*** 28,34 ****

/* base class for subselects */

! class Item_subselect :public Item
{
my_bool engine_owner; /* Is this item owner of engine */
my_bool value_assigned; /* value already assigned to subselect */
--- 28,34 ----

/* base class for subselects */

! class Item_subselect :public Item_result_field
{
my_bool engine_owner; /* Is this item owner of engine */
my_bool value_assigned; /* value already assigned to subselect */
***************
*** 116,121 ****
--- 116,122 ----
Item *new_item() { return new Item_singleval_subselect(this); }
enum Item_result result_type() const { return res_type; }
void fix_length_and_dec();
+
friend class select_singleval_subselect;
};

diff -Nrc a/sql/sql_select.cc b/sql/sql_select.cc
*** a/sql/sql_select.cc Wed Nov 13 01:18:10 2002
--- b/sql/sql_select.cc Wed Nov 13 01:18:10 2002
***************
*** 4528,4534 ****
if (error == -1)
table->file->print_error(my_errno,MYF(0));
}
! DBUG_RETURN(error);
}


--- 4528,4534 ----
if (error == -1)
table->file->print_error(my_errno,MYF(0));
}
! DBUG_RETURN(error || join->thd->net.report_error);
}



--
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-thread12970@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 13.11.2002 00:21:37 von Sanja Byelkin

Hi!

On Mon, Nov 11, 2002 at 12:14:52PM -0000, Jocelyn Fournier wrote:
> Hi,
>
> A little variant which crashes (just in case) :
>
> mysql> select numeropost FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM
> forumconthardwarefr7 HAVING a=1);
> ERROR 2006: MySQL server has gone away

Thank you for bug report. This problem fixed by patch it previous letter.

--
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-thread12971@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 13.11.2002 09:45:58 von Jocelyn Fournier

Hi Sanja,

select numeropost as a FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM
forumconthardwarefr7 HAVING a=1);
is fixed, but
select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1 FROM
forumconthardwarefr7 HAVING a=1);
still failed :

mysql> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1
FROM forumconthardwarefr7 HAVING a=1);
ERROR 1041: Out of memory; Check if mysqld or some other process uses all
available memory. If not you may have to use 'ulimit' to allow mysqld to use
more memory or you can add more swap space

(but perhaps it's linked to the "1146: Table 'test.' doesn't exist" problem
?)

Regards,
Jocelyn

----- Original Message -----
From: "Sanja Byelkin"
To: "Jocelyn Fournier"
Cc:
Sent: Tuesday, November 12, 2002 11:19 PM
Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION


> Hi!
>
> On Mon, Nov 11, 2002 at 11:14:18AM -0000, Jocelyn Fournier wrote:
> > Hi,
> >
> > It seems I have reproduced the bug without the sinisa patch :
> >
> > How-to-repeat :
> >
> > CREATE TABLE `forumconthardwarefr7` (
> > `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
> > `maxnumrep` int(10) unsigned NOT NULL default '0',
> > PRIMARY KEY (`numeropost`),
> > UNIQUE KEY `maxnumrep` (`maxnumrep`)
> > ) TYPE=MyISAM ROW_FORMAT=FIXED
> >
> > INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES
(1,0),(2,1);
> >
> > mysql> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT
1
> > FROM forumconthardwarefr7 HAVING a=1);
> > ERROR 1041: Out of memory; Check if mysqld or some other process uses
all
> > available memory. If not you may have to use 'ulimit' to allow mysqld to
use
> > more memory or you can add more swap space
>
> Thank you for bug report, it help me to fix 2 bugs, here is putch:
>
> diff -Nrc a/sql/item_subselect.cc b/sql/item_subselect.cc
> *** a/sql/item_subselect.cc Wed Nov 13 01:18:10 2002
> --- b/sql/item_subselect.cc Wed Nov 13 01:18:10 2002
> ***************
> *** 33,39 ****
> #include "sql_select.h"
>
> Item_subselect::Item_subselect():
> ! Item(), engine_owner(1), value_assigned(0)
> {
> assign_null();
> /*
> --- 33,39 ----
> #include "sql_select.h"
>
> Item_subselect::Item_subselect():
> ! Item_result_field(), engine_owner(1), value_assigned(0)
> {
> assign_null();
> /*
> diff -Nrc a/sql/item_subselect.h b/sql/item_subselect.h
> *** a/sql/item_subselect.h Wed Nov 13 01:18:10 2002
> --- b/sql/item_subselect.h Wed Nov 13 01:18:10 2002
> ***************
> *** 28,34 ****
>
> /* base class for subselects */
>
> ! class Item_subselect :public Item
> {
> my_bool engine_owner; /* Is this item owner of engine */
> my_bool value_assigned; /* value already assigned to subselect */
> --- 28,34 ----
>
> /* base class for subselects */
>
> ! class Item_subselect :public Item_result_field
> {
> my_bool engine_owner; /* Is this item owner of engine */
> my_bool value_assigned; /* value already assigned to subselect */
> ***************
> *** 116,121 ****
> --- 116,122 ----
> Item *new_item() { return new Item_singleval_subselect(this); }
> enum Item_result result_type() const { return res_type; }
> void fix_length_and_dec();
> +
> friend class select_singleval_subselect;
> };
>
> diff -Nrc a/sql/sql_select.cc b/sql/sql_select.cc
> *** a/sql/sql_select.cc Wed Nov 13 01:18:10 2002
> --- b/sql/sql_select.cc Wed Nov 13 01:18:10 2002
> ***************
> *** 4528,4534 ****
> if (error == -1)
> table->file->print_error(my_errno,MYF(0));
> }
> ! DBUG_RETURN(error);
> }
>
>
> --- 4528,4534 ----
> if (error == -1)
> table->file->print_error(my_errno,MYF(0));
> }
> ! DBUG_RETURN(error || join->thd->net.report_error);
> }
>
>
>
> --
> 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-thread12973@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 13.11.2002 14:09:58 von Jocelyn Fournier

Hi,

With your latest push, it works fine now :)
Just in case you missed it, it still remains this bug :

SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;

(no stack trace available)

Regards,
Jocelyn
----- Original Message -----
From: "Jocelyn Fournier"
To: "Sanja Byelkin"
Cc:
Sent: Wednesday, November 13, 2002 8:45 AM
Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION


> Hi Sanja,
>
> select numeropost as a FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM
> forumconthardwarefr7 HAVING a=1);
> is fixed, but
> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1 FROM
> forumconthardwarefr7 HAVING a=1);
> still failed :
>
> mysql> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1
> FROM forumconthardwarefr7 HAVING a=1);
> ERROR 1041: Out of memory; Check if mysqld or some other process uses all
> available memory. If not you may have to use 'ulimit' to allow mysqld to
use
> more memory or you can add more swap space
>
> (but perhaps it's linked to the "1146: Table 'test.' doesn't exist"
problem
> ?)
>
> Regards,
> Jocelyn
>
> ----- Original Message -----
> From: "Sanja Byelkin"
> To: "Jocelyn Fournier"
> Cc:
> Sent: Tuesday, November 12, 2002 11:19 PM
> Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION
>
>
> > Hi!
> >
> > On Mon, Nov 11, 2002 at 11:14:18AM -0000, Jocelyn Fournier wrote:
> > > Hi,
> > >
> > > It seems I have reproduced the bug without the sinisa patch :
> > >
> > > How-to-repeat :
> > >
> > > CREATE TABLE `forumconthardwarefr7` (
> > > `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
> > > `maxnumrep` int(10) unsigned NOT NULL default '0',
> > > PRIMARY KEY (`numeropost`),
> > > UNIQUE KEY `maxnumrep` (`maxnumrep`)
> > > ) TYPE=MyISAM ROW_FORMAT=FIXED
> > >
> > > INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES
> (1,0),(2,1);
> > >
> > > mysql> select numeropost as a FROM forumconthardwarefr7 ORDER BY
(SELECT
> 1
> > > FROM forumconthardwarefr7 HAVING a=1);
> > > ERROR 1041: Out of memory; Check if mysqld or some other process uses
> all
> > > available memory. If not you may have to use 'ulimit' to allow mysqld
to
> use
> > > more memory or you can add more swap space
> >
> > Thank you for bug report, it help me to fix 2 bugs, here is putch:
> >
> > diff -Nrc a/sql/item_subselect.cc b/sql/item_subselect.cc
> > *** a/sql/item_subselect.cc Wed Nov 13 01:18:10 2002
> > --- b/sql/item_subselect.cc Wed Nov 13 01:18:10 2002
> > ***************
> > *** 33,39 ****
> > #include "sql_select.h"
> >
> > Item_subselect::Item_subselect():
> > ! Item(), engine_owner(1), value_assigned(0)
> > {
> > assign_null();
> > /*
> > --- 33,39 ----
> > #include "sql_select.h"
> >
> > Item_subselect::Item_subselect():
> > ! Item_result_field(), engine_owner(1), value_assigned(0)
> > {
> > assign_null();
> > /*
> > diff -Nrc a/sql/item_subselect.h b/sql/item_subselect.h
> > *** a/sql/item_subselect.h Wed Nov 13 01:18:10 2002
> > --- b/sql/item_subselect.h Wed Nov 13 01:18:10 2002
> > ***************
> > *** 28,34 ****
> >
> > /* base class for subselects */
> >
> > ! class Item_subselect :public Item
> > {
> > my_bool engine_owner; /* Is this item owner of engine */
> > my_bool value_assigned; /* value already assigned to subselect */
> > --- 28,34 ----
> >
> > /* base class for subselects */
> >
> > ! class Item_subselect :public Item_result_field
> > {
> > my_bool engine_owner; /* Is this item owner of engine */
> > my_bool value_assigned; /* value already assigned to subselect */
> > ***************
> > *** 116,121 ****
> > --- 116,122 ----
> > Item *new_item() { return new Item_singleval_subselect(this); }
> > enum Item_result result_type() const { return res_type; }
> > void fix_length_and_dec();
> > +
> > friend class select_singleval_subselect;
> > };
> >
> > diff -Nrc a/sql/sql_select.cc b/sql/sql_select.cc
> > *** a/sql/sql_select.cc Wed Nov 13 01:18:10 2002
> > --- b/sql/sql_select.cc Wed Nov 13 01:18:10 2002
> > ***************
> > *** 4528,4534 ****
> > if (error == -1)
> > table->file->print_error(my_errno,MYF(0));
> > }
> > ! DBUG_RETURN(error);
> > }
> >
> >
> > --- 4528,4534 ----
> > if (error == -1)
> > table->file->print_error(my_errno,MYF(0));
> > }
> > ! DBUG_RETURN(error || join->thd->net.report_error);
> > }
> >
> >
> >
> > --
> > 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-thread12976@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 13.11.2002 14:15:24 von Sanja Byelkin

Hi!

On Wed, Nov 13, 2002 at 08:45:58AM -0000, Jocelyn Fournier wrote:
> Hi Sanja,
>
> select numeropost as a FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM
> forumconthardwarefr7 HAVING a=1);
> is fixed, but
> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1 FROM
> forumconthardwarefr7 HAVING a=1);
> still failed :
>
> mysql> select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1
> FROM forumconthardwarefr7 HAVING a=1);
> ERROR 1041: Out of memory; Check if mysqld or some other process uses all
> available memory. If not you may have to use 'ulimit' to allow mysqld to use
> more memory or you can add more swap space
>
> (but perhaps it's linked to the "1146: Table 'test.' doesn't exist" problem
> ?)

No. 'test.' it was problem with derived tables processing, but here was
incorectly set thd->fatal_error.

I fixed above bugs, and fix is already pushed.

--
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-thread12977@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in MySQL-4.1 : wrong error message with dependant UNION

am 13.11.2002 14:26:49 von Sanja Byelkin

Hi!

On Wed, Nov 13, 2002 at 01:09:58PM -0000, Jocelyn Fournier wrote:
> Hi,
>
> With your latest push, it works fine now :)
> Just in case you missed it, it still remains this bug :
>
> SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;

Thank you for remind me this.

--
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-thread12978@lists.mysql.com
To unsubscribe, e-mail

Bug in check_loop code in MySQL-4.1

am 14.11.2002 01:40:15 von Jocelyn Fournier

Hi,

I hit a new bug in the new check_loop code ;)

How-to-repeat :

SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1)
HAVING a=1) as b;

Stack trace :

0x80a2661 handle_segfault(int) + 481
0x8287e28 pthread_sighandler + 176
0x80cbb3e JOIN::check_loop(unsigned) + 94
0x808483b subselect_single_select_engine::check_loop(unsigned) + 27
0x8083d30 Item_subselect::check_loop(unsigned) + 64
0x804d53b Item_ref::check_loop(unsigned) + 59
0x804d48c Item_ref::fix_fields(THD*, st_table_list*, Item**) + 316
0x805752c Item_func::fix_fields(THD*, st_table_list*, Item**) + 140
0x80c9cc2 JOIN::prepare(st_table_list*, Item*, st_order*, st_order*, Item*,
st_order*, st_select_lex*, st_select_lex_unit*, bool) + 514
0x808456d subselect_single_select_engine::prepare() + 157
0x8083c89 Item_subselect::fix_fields(THD*, st_table_list*, Item**) + 25
0x80c4ee5 setup_fields(THD*, st_table_list*, List&, bool, List*,
bool) + 117
0x80c9b89 JOIN::prepare(st_table_list*, Item*, st_order*, st_order*, Item*,
st_order*, st_select_lex*, st_select_lex_unit*, bool) + 201
0x80cbd5b mysql_select(THD*, st_table_list*, List&, Item*, st_order*,
st_order*, Item*, st_order*, unsigned long, select_result*,
st_select_lex_unit*, st_select_lex*) + 443
0x80c9a77 handle_select(THD*, st_lex*, select_result*) + 247
0x80ac9e5 mysql_execute_command(THD*) + 709
0x80b18d2 mysql_parse(THD*, char*, unsigned) + 146
0x80ab8a7 dispatch_command(enum_server_command, THD*, char*, unsigned) + 855
0x80ab536 do_command(THD*) + 118
0x80aae0f handle_one_connection(void*) + 895
0x82856ba pthread_start_thread + 218
0x82b9b6a thread_start + 4

Regards,
Jocelyn


----- Original Message -----
From: "Sanja Byelkin"
To: "Jocelyn Fournier"
Sent: Wednesday, November 13, 2002 10:47 PM
Subject: Re: Bug in MySQL-4.1 : wrong error message with dependant UNION


> Hi!
>
> On Wed, Nov 13, 2002 at 01:09:58PM -0000, Jocelyn Fournier wrote:
> > Hi,
> >
> > With your latest push, it works fine now :)
> > Just in case you missed it, it still remains this bug :
> >
> > SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;
>
> Thank you for bug report. This bug is fixed, patch committed & pushed, but
it
> so big to be copied here.
>
> [skip]
>
> --
> Regards,
> Alexander
>
>
>


------------------------------------------------------------ ---------
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-thread12983@lists.mysql.com
To unsubscribe, e-mail

Re: Bug in check_loop code in MySQL-4.1

am 14.11.2002 08:55:02 von Sanja Byelkin

Hi!

On Thu, Nov 14, 2002 at 12:40:15AM -0000, Jocelyn Fournier wrote:
> Hi,
>
> I hit a new bug in the new check_loop code ;)
>
> How-to-repeat :
>
> SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1)
> HAVING a=1) as b;

Thank You for bug report. Here is fix of this bug:

diff -Nrc a/sql/item.cc b/sql/item.cc
*** a/sql/item.cc Thu Nov 14 09:52:29 2002
--- b/sql/item.cc Thu Nov 14 09:52:29 2002
***************
*** 876,886 ****
{
depended_from= last;
thd->lex.current_select->mark_as_dependent(last);
! if (check_loop(thd->check_loops_counter++))
! {
! my_message(ER_CYCLIC_REFERENCE, ER(ER_CYCLIC_REFERENCE), MYF(0));
! return 1;
! }
}
}
else if (!ref)
--- 876,882 ----
{
depended_from= last;
thd->lex.current_select->mark_as_dependent(last);
! thd->add_possible_loop(this);
}
}
else if (!ref)
diff -Nrc a/sql/sql_class.cc b/sql/sql_class.cc
*** a/sql/sql_class.cc Thu Nov 14 09:52:29 2002
--- b/sql/sql_class.cc Thu Nov 14 09:52:29 2002
***************
*** 434,439 ****
--- 434,448 ----
}
#endif

+ void THD::add_possible_loop (Item *item)
+ {
+ if (!possible_loops)
+ {
+ possible_loops= new List;
+ }
+ possible_loops->push_back(item);
+ }
+
/*********************************************************** ******************
** Functions to provide a interface to select results
************************************************************ *****************/
diff -Nrc a/sql/sql_class.h b/sql/sql_class.h
*** a/sql/sql_class.h Thu Nov 14 09:52:29 2002
--- b/sql/sql_class.h Thu Nov 14 09:52:29 2002
***************
*** 482,487 ****
--- 482,488 ----
USER_CONN *user_connect;
CHARSET_INFO *db_charset;
CHARSET_INFO *thd_charset;
+ List *possible_loops; // Items that may cause loops in subselects
List warn_list;
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
uint total_warn_count, old_total_warn_count;
***************
*** 632,637 ****
--- 633,639 ----
net.last_errno= 0;
net.report_error= 0;
}
+ void add_possible_loop(Item *);
};

/*
diff -Nrc a/sql/sql_parse.cc b/sql/sql_parse.cc
*** a/sql/sql_parse.cc Thu Nov 14 09:52:29 2002
--- b/sql/sql_parse.cc Thu Nov 14 09:52:29 2002
***************
*** 2862,2868 ****
lex->select_lex.init_query();
lex->value_list.empty();
lex->param_list.empty();
! lex->unit.global_parameters= lex->unit.slave= lex->current_select= &lex->select_lex;
lex->select_lex.master= &lex->unit;
lex->select_lex.prev= &lex->unit.slave;
lex->olap=lex->describe=0;
--- 2862,2869 ----
lex->select_lex.init_query();
lex->value_list.empty();
lex->param_list.empty();
! lex->unit.global_parameters= lex->unit.slave= lex->current_select=
! &lex->select_lex;
lex->select_lex.master= &lex->unit;
lex->select_lex.prev= &lex->unit.slave;
lex->olap=lex->describe=0;
***************
*** 2875,2880 ****
--- 2876,2882 ----
thd->sent_row_count= thd->examined_row_count= 0;
thd->fatal_error= thd->rand_used=0;
thd->safe_to_cache_query= 1;
+ thd->possible_loops= 0;
DBUG_VOID_RETURN;
}

diff -Nrc a/sql/sql_select.cc b/sql/sql_select.cc
*** a/sql/sql_select.cc Thu Nov 14 09:52:29 2002
--- b/sql/sql_select.cc Thu Nov 14 09:52:29 2002
***************
*** 1087,1092 ****
--- 1087,1109 ----
{
DBUG_RETURN(-1);
}
+ if (thd->possible_loops)
+ {
+ Item *item;
+ while(thd->possible_loops->elements)
+ {
+ item= thd->possible_loops->pop();
+ if (item->check_loop(thd->check_loops_counter++))
+ {
+ delete thd->possible_loops;
+ thd->possible_loops= 0;
+ my_message(ER_CYCLIC_REFERENCE, ER(ER_CYCLIC_REFERENCE), MYF(0));
+ return 1;
+ }
+ }
+ delete thd->possible_loops;
+ thd->possible_loops= 0;
+ }
}

switch (join->optimize())


[skip]

--
Regards,
Alexander

------------------------------------------------------------ ---------
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-thread12986@lists.mysql.com
To unsubscribe, e-mail