Bug #43254 SQL_SELECT_LIMIT=0 crashes command line client
Submitted: 27 Feb 2009 9:50 Modified: 13 Apr 2009 19:26
Reporter: Petr Bilek Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.51a, 5.0.74, 5.0.79, 5.1.33, 6.0.11 OS:Linux (-3ubuntu5.4, Windows)
Assigned to: Tatiana Azundris Nuernberg CPU Architecture:Any
Tags: sql_select_limit

[27 Feb 2009 9:50] Petr Bilek
Description:
The "Segmentaion fault" occur if sql_select_limit is set to 0;
See "How to repeat"

How to repeat:
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> use test;
Database changed
mysql> set sql_select_limit=0;
Query OK, 0 rows affected (0.00 sec)

mysql> use test
Segmentation fault
[27 Feb 2009 9:58] Valeriy Kravchuk
Verified with client from 5.0.74 on Windows. Stack trace is:

mysql.exe!get_current_db()  Line 2641	C++
mysql.exe!com_use(String * buffer=0x004c8a08, char * line=0x003b3f58)  Line 3961	C++
mysql.exe!read_and_execute(bool interactive=true)  Line 1884 + 0x9 bytes	C++
mysql.exe!main(int argc=7, char * * argv=0x003b3e48)  Line 1205 + 0x11 bytes	C++
mysql.exe!mainCRTStartup()  Line 259 + 0x12 bytes	C
[27 Feb 2009 10:01] Valeriy Kravchuk
Other recent bzr versions (on Linux) are also affected.
[23 Mar 2009 4:17] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/70003

2741 Tatiana A. Nurnberg	2009-03-23
      Bug#43254: SQL_SELECT_LIMIT=0 crashes command line client
      
      When asking what database is selected, client expected
      to *always* get an answer from the server.
      
      We now handle failure more gracefully.
      
      See comments in ticket for a discussion of what happens,
      and how things interlock.
     @ client/mysql.cc
        Handle empty result-sets gracefully, as opposed
        to just result sets with n>0 items that may themselves
        be empty.
[23 Mar 2009 5:11] Tatiana Azundris Nuernberg
queued for 5.0.80, 5.1.34, 6.0.11 in -bugteam
[27 Mar 2009 14:31] Bugs System
Pushed into 5.0.80 (revid:joro@sun.com-20090327142516-55gumdxj39z6eijj) (version source revid:leonard@mysql.com-20090324072904-7w2lxdxzw8hx1rnm) (merge vers: 5.0.80) (pib:6)
[27 Mar 2009 14:56] Bugs System
Pushed into 5.1.34 (revid:joro@sun.com-20090327143448-wuuuycetc562ty6o) (version source revid:azundris@mysql.com-20090323040951-mdwcb90m1f1ilh2d) (merge vers: 5.1.34) (pib:6)
[30 Mar 2009 2:17] Paul DuBois
Noted in 5.0.80, 5.1.34 changelogs.

mysql crashed if a request for the current database name returned an
empty result, such as after the client has executed a preceding SET
sql_select_limit=0 statement.

Setting report to NDI pending push into 6.0.x.
[13 Apr 2009 9:21] Bugs System
Pushed into 6.0.11-alpha (revid:alik@sun.com-20090413084402-snnrocwzktcl88ny) (version source revid:azundris@mysql.com-20090323041456-d57dxq0u9jkak59m) (merge vers: 6.0.11-alpha) (pib:6)
[13 Apr 2009 19:26] Paul DuBois
Noted in 6.0.11 changelog.
[9 May 2009 16:46] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (merge vers: 5.1.34-ndb-6.2.18) (pib:6)
[9 May 2009 17:43] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (merge vers: 5.1.34-ndb-6.3.25) (pib:6)
[9 May 2009 18:40] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (merge vers: 5.1.34-ndb-7.0.6) (pib:6)