Bug #27621 Select from information_schema.referential_constraints crashes 5.1.16-beta
Submitted: 3 Apr 2007 16:49 Modified: 12 Apr 2007 13:34
Reporter: Peter Brawley (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.16-beta\5.1BK OS:Windows (w2k pro)
Assigned to: Sergei Glukhov CPU Architecture:Any

[3 Apr 2007 16:49] Peter Brawley
Description:
Any SELECT from information_schema.referential_constraints crashes 5.1.16-beta mysqld-nt.exe. No message in the server log.

How to repeat:
As above

Suggested fix:
None
[3 Apr 2007 19:10] MySQL Verification Team
Thank you for the bug report. Only repeatable on Windows on Linux doesn't
crashes:

[miguel@light dbs]$ cd mysql-5.1
[miguel@light mysql-5.1]$ bk changes | head
ChangeSet@1.2550, 2007-04-02 03:53:21+02:00, ibabaev@bk-internal.mysql.com +1 -0
  Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
  into  bk-internal.mysql.com:/data0/bk/mysql-5.1-opt
  MERGE: 1.2542.1.1

ChangeSet@1.2542.1.1, 2007-04-01 14:00:56-07:00, igor@olga.mysql.com +2 -0
  Merge olga.mysql.com:/home/igor/mysql-5.0-opt
  into  olga.mysql.com:/home/igor/mysql-5.1-opt
  MERGE: 1.1810.2754.2

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.18-beta-nt Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select * from information_schema.referential_constraints\G
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>

sql_string.cc
--931--

 memmove(to, from, res);
      *from_end_pos= from + res;
      *well_formed_error_pos= well_formed_error ? from + res : NULL;
      *cannot_convert_error_pos= NULL;
      if (from_offset)
        res+= to_cs->mbminlen;
    }

mysqld-nt.exe!_my_wildcmp_unicode()  + 0x3a2 bytes	C
mysqld-nt.exe!_my_well_formed_len_mb()  + 0x36 bytes	C
>mysqld-nt.exe!well_formed_copy_nchars(charset_info_st * to_cs=0x00000000,
              char * to=0x02b2eaa9, unsigned int to_length=192, charset_info_st *
              from_cs=0x008f4c28, const char * from=0x8f59303d, unsigned int
              from_length=192, unsigned int nchars=64, const char * * 
              well_formed_error_pos=0x0a8ce518, const char * * cannot_convert_error_pos=0x0a8ce51c,
              const char * * from_end_pos=0x0a8ce520)  Line 931	C++
mysqld-nt.exe!Field_varstring::store(const char * from=0x8f59303d, unsigned int 
              length=16839725, charset_info_st * cs=0x008f4c28)  Line 6517 + 0x3a bytes	C++
mysqld-nt.exe!get_referential_constraints_record(THD * thd=0x02ad7130, st_table_list * 
              tables=0x02b43720, st_table * table=0x02b2cfd0, int res=0, const char * 
              base_name=0x02b436f0, const char * file_name=0x02b43718)  Line 4578	C++
mysqld-nt.exe!get_all_tables(THD * thd=0x02ad7130, st_table_list * tables=0x02b2a108, 
              Item * cond=0x00000000)  Line 2746	C++
mysqld-nt.exe!get_schema_tables_result(JOIN * join=0x02b2ab38, enum_schema_table_state 
              executed_place=PROCESSED_BY_JOIN_EXEC)  Line 5129 + 0x12 bytes	C++
mysqld-nt.exe!JOIN::exec()  Line 1605 + 0x46 bytes	C++
mysqld-nt.exe!mysql_select(THD * thd=0x02ad7130, Item * * * rref_pointer_array=0x02ad82a8,
             st_table_list * tables=0x02b2a108, unsigned int wild_num=1, 
             List<Item> & fields={...}, Item * conds=0x00000000, unsigned int og_num=0,
             st_order * order=0x00000000, st_order * group=0x00000000, Item * having=0x00000000,
             st_order * proc_param=0x00000000, unsigned __int64 select_options=2684635648,
             select_result * result=0x02b2ab28, st_select_lex_unit * unit=0x02ad7f18,
             st_select_lex * select_lex=0x02b2ab38)  Line 2193	C++
mysqld-nt.exe!handle_select(THD * thd=0x02ad7130, st_lex * lex=0x02ad7ea8, select_result
              * result=0x02b2ab28, unsigned long setup_tables_done_option=0) 
              Line 257 + 0x75 bytes	C++
mysqld-nt.exe!execute_sqlcom_select(THD * thd=0x00000000, st_table_list * all_tables=0x00000000)
              Line 4459 + 0xa bytes	C++
mysqld-nt.exe!mysql_execute_command(THD * thd=0x02ad7130)  Line 1796 + 0xb bytes	C++
mysqld-nt.exe!mysql_parse(THD * thd=0x02ad7130, char * inBuf=0x02b29fa0, unsigned int length=56)
              Line 5275	C++
mysqld-nt.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x02ad7130, 
              char * packet=0x02b21f71, unsigned int packet_length=57)  Line 898	C++
mysqld-nt.exe!do_command(THD * thd=0x00000039)  Line 662 + 0x10 bytes	C++
mysqld-nt.exe!handle_one_connection(void * arg=0x02ad7130)  Line 1089 + 0xa bytes	C++
mysqld-nt.exe!_pthread_start()  + 0x3b bytes	C
mysqld-nt.exe!_callthreadstart()  Line 293 + 0x6 bytes	C
mysqld-nt.exe!_threadstart(void * ptd=0x02b1a778)  Line 275 + 0x5 bytes	C
kernel32.dll!75e03833() 	
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
ntdll.dll!7737a9bd()
[11 Apr 2007 13:05] Sergei Glukhov
tested on 5.1.16-beta & 5.1.18-beta, can't repeat
[12 Apr 2007 13:34] MySQL Verification Team
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Server built using the below source tree changeset:

[miguel@light mysql-5.1]$ bk changes | head
ChangeSet@1.2569, 2007-04-09 11:46:58+05:00, holyfoot@hfmain.(none) +3 -0
  Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
  into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
  MERGE: 1.1810.2374.118

ChangeSet@1.2568, 2007-04-09 11:16:05+05:00, holyfoot@hfmain.(none) +2 -0
  Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
  into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
  MERGE: 1.1810.2796.1

Microsoft Windows [versão 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. Todos os direitos reservados.

c:\>cd\build\5.1\bin

c:\build\5.1\bin>mysqld-nt --standalone --console
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
070412 10:25:22  InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
070412 10:25:22  InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
070412 10:25:23  InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
070412 10:25:24  InnoDB: Started; log sequence number 0 0
070412 10:25:24 [Note] Event Scheduler: Loaded 0 events
070412 10:25:24 [Note] mysqld-nt: ready for connections.
Version: '5.1.18-beta-nt'  socket: ''  port: 3306  Source distribution

c:\build\5.1\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.18-beta-nt Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE TABLE parent (id INT NOT NULL,
    ->                      PRIMARY KEY (id)
    -> ) ENGINE=INNODB;
Query OK, 0 rows affected (0.10 sec)

mysql> CREATE TABLE child (id INT, parent_id INT,
    ->                     INDEX par_ind (parent_id),
    ->                     FOREIGN KEY (parent_id) REFERENCES parent(id)
    ->                       ON DELETE CASCADE
    -> ) ENGINE=INNODB;
Query OK, 0 rows affected (0.21 sec)

mysql> select * from information_schema.referential_constraints\G
*************************** 1. row ***************************
       CONSTRAINT_CATALOG: NULL
        CONSTRAINT_SCHEMA: test
          CONSTRAINT_NAME: child_ibfk_1
UNIQUE_CONSTRAINT_CATALOG: NULL
 UNIQUE_CONSTRAINT_SCHEMA: test
   UNIQUE_CONSTRAINT_NAME: PRIMARY
             MATCH_OPTION: NONE
              UPDATE_RULE: RESTRICT
              DELETE_RULE: CASCADE
               TABLE_NAME: child
    REFERENCED_TABLE_NAME: parent
1 row in set (0.30 sec)

mysql>
[11 Jun 2007 22:44] MySQL Verification Team
See bug: http://bugs.mysql.com/bug.php?id=29032.