Hi,

I'm trying to make use of the new(ish) merge table
type, and am running into two problems. The first is
unexpected behaviour, the second is a straight MySQL
server crash. I have tested 3.23.47, 3.23.49 and
3.23.51 with similar results. Details below refer to
3.23.51. I have also tested on Darwin (MacOS X 10.1.3)
and Linux (RedHat 7.3, kernel 2.4.18), with the same
results. Both deal with the same query type and
datasets.

Example tables and data:
CREATE TABLE t1 (
  a int(11) NOT NULL default '0',
  b int(11) NOT NULL default '0',
  PRIMARY KEY  (a,b)
) TYPE=MyISAM;

INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,1);

CREATE TABLE t2 (
  a int(11) NOT NULL default '0',
  b int(11) NOT NULL default '0',
  PRIMARY KEY  (a,b)
) TYPE=MyISAM;

INSERT INTO t2 VALUES (1,2);
INSERT INTO t2 VALUES (2,2);

CREATE TABLE t (
  a int(11) NOT NULL default '0',
  b int(11) NOT NULL default '0',
  KEY a (a,b)
) TYPE=MRG_MyISAM UNION=(t1,t2);

Unexpected behaviour:
mysql> select max(b) from t1 where a = 1;
+--------+
| max(b) |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)

mysql> select max(b) from t2 where a = 1;
+--------+
| max(b) |
+--------+
|      2 |
+--------+
1 row in set (0.00 sec)

mysql> select max(b) from t where a = 1;
+--------+
| max(b) |
+--------+
|      1 |              <-------- huh?
+--------+
1 row in set (0.00 sec)

Crasher:
mysql> select max(b) from t1 where a = 2;
+--------+
| max(b) |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)

mysql> select max(b) from t2 where a = 2;
+--------+
| max(b) |
+--------+
|      2 |
+--------+
1 row in set (0.01 sec)

mysql> select max(b) from t where a = 2;
ERROR 2013: Lost connection to MySQL server during
query
mysql> 

Traceback looks like the following:
pbg3$ gdb ./mysqld
GNU gdb 5.0-20001113 (Apple version gdb-200) (Mon Sep 
3 02:43:52 GMT 2001) (UI_OUT)
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General
Public License, and you are
welcome to change it and/or distribute copies of it
under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show
warranty" for details.
This GDB was configured as "powerpc-apple-macos10".
Reading symbols for shared libraries ... done
(gdb) run
Starting program:
/Users/stix/tmp/mysql-3.23.51/sql/./mysqld
[Switching to thread 1 (process 15018 thread 0x1903)]
/Users/stix/tmp/mysql-3.23.51/sql/./mysqld: ready for
connections
[Switching to thread 3 (process 15018 thread 0x2403)]

Program received signal EXC_BAD_ACCESS, Could not
access memory.
[Switching to process 15018 thread 0x2403]
0x000f6384 in myrg_rprev (info=0x777050, buf=0x778de0
"?, inx=0) at myrg_rprev.c:29
29        if
((err=mi_rprev(info->current_table->table,NULL,inx)))
(gdb) bt
#0  0x000f6384 in myrg_rprev (info=0x777050,
buf=0x778de0 "?, inx=0) at myrg_rprev.c:29
#1  0x0009fa00 in ha_myisammrg::index_prev
(this=0x778d58, buf=0x778de0 "?) at
ha_myisammrg.cc:115
#2  0x00096b04 in opt_sum_query (tables=0x774178,
all_fields=@0x778de0, conds=0x774240) at
opt_sum.cc:159
#3  0x00068e00 in mysql_select (thd=0x7738b0,
tables=0x774178, fields=@0x773ac8, conds=0x774240,
order=0x0, group=0x0, having=0x0, proc_param=0xfe9a00,
select_options=17339392, result=0x7742b0) at
sql_select.cc:330
#4  0x0004ff28 in mysql_execute_command () at
sql_parse.cc:1169
#5  0x00052804 in mysql_parse (thd=0x7738b0,
inBuf=0x7739cc "", length=32) at sql_parse.cc:2350
#6  0x0004ef18 in do_command (thd=0x7738b0) at
sql_parse.cc:834
#7  0x0004e2f8 in handle_one_connection (arg=0x777050)
at sql_parse.cc:554
#8  0x7002054c in _pthread_body ()
Current language:  auto; currently c
(gdb) 

If I feel game, I might start digging in the source,
but I figure someone should be able to see this pretty
easily.

Thanks,
--
Paul Ripke
stixpjr @ yahoo . com . au

http://www.sold.com.au - SOLD.com.au
- Find yourself a bargain!

---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to