>Description:
An EXPLAIN SELECT .. WHERE field = ( SELECT ... ) query crashes, where
the query itself runs fine.
>How-To-Repeat:
Run the following commands. The EXPLAIN will fail. Removing the INDEX
on table1 makes the crash disappear also. I can generate a stack trace
if necessary.
DROP TABLE IF EXISTS table1;
CREATE TABLE table1 (
name1 char(20),
INDEX(name1)
) TYPE=MyISAM;
DROP TABLE IF EXISTS table2;
CREATE TABLE table2 (
name2 char(20),
id int
) TYPE=MyISAM;
INSERT INTO table1 VALUES ('record 1'), ('record 2');
INSERT INTO table2 VALUES ('record 1', 1);
EXPLAIN SELECT COUNT(*) FROM table1 WHERE name1 = ( SELECT name2 FROM table2 WHERE id=1 );
>Fix:
>Submitter-Id: <submitter ID>
>Originator: Dan Nelson
>Organization:
Dan Nelson
dnelson@stripped
>
>MySQL support: none[none | licence | email support | extended email support ]
>Synopsis: Crash in mysql 4.1.0 EXPLAIN w/ subquery
>Severity: serious
>Priority: medium
>Category: mysql
>Class: sw-bug
>Release: mysql-4.1.0-alpha (FreeBSD port: mysql-server-4.1.0)
>Server: /usr/local/bin/mysqladmin Ver 8.40 Distrib 4.1.0-alpha, for
> portbld-freebsd5.0 on i386
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 4.1.0-alpha-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 1 hour 44 min 19 sec
Threads: 2 Questions: 952 Slow queries: 0 Opens: 12 Flush tables: 1 Open tables: 0
Queries per second avg: 0.152
>C compiler: cc (GCC) 3.2.2 [FreeBSD] 20030205 (release)
>C++ compiler: c++ (GCC) 3.2.2 [FreeBSD] 20030205 (release)
>Environment:
System: FreeBSD dan.emsphone.com 5.0-CURRENT FreeBSD 5.0-CURRENT #266: Tue Apr 15 18:05:08
CDT 2003 dan@stripped:/usr/src/sys/i386/compile/DANSMP i386
Some paths: /usr/local/bin/perl /usr/bin/make /usr/local/bin/gmake /usr/bin/gcc
/usr/bin/cc
GCC: Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.2.2 [FreeBSD] 20030205 (release)
Compilation info: CC='cc' CFLAGS='-O2 -pipe -march=pentium3' CXX='c++' CXXFLAGS='-O2
-pipe -march=pentium3 -felide-constructors -fno-rtti -fno-exceptions' LDFLAGS=''
ASFLAGS=''
LIBC:
-r--r--r-- 1 root wheel 10280064 Apr 1 09:31 /usr/lib/libc.a
lrwxr-xr-x 1 root wheel 9 Apr 1 09:31 /usr/lib/libc.so -> libc.so.5
-r--r--r-- 1 root wheel 4953364 Apr 1 09:31 /usr/lib/libc.so.5
-r--r--r-- 1 root wheel 855328 Mar 7 11:39 /usr/lib/libc.so.5.bak
-r--r--r-- 1 root wheel 855328 Mar 7 11:39 /usr/lib/libc.so.5.bk
Configure command: ./configure '--localstatedir=/var/db/mysql' '--without-debug'
'--without-readline' '--without-libedit' '--without-bench' '--without-extra-tools'
'--with-mysqlfs' '--with-vio' '--with-comment=FreeBSD port: mysql-server-4.1.0'
'--enable-thread-safe-client' '--with-low-memory' '--with-libwrap' '--enable-assembler'
'--with-berkeley-db' '--prefix=/usr/local' '--build=i386-portbld-freebsd5.0' 'CFLAGS=-O2
-pipe -march=pentium3' 'CXX=c++' 'build_alias=i386-portbld-freebsd5.0' 'CC=cc'
'CXXFLAGS=-O2 -pipe -march=pentium3 -felide-constructors -fno-rtti -fno-exceptions'