| Bug #479 | ERROR 1105: Unknown error with ORDER BY on query that should return empty set | ||
|---|---|---|---|
| Submitted: | 22 May 2003 15:06 | Modified: | 30 Jun 2003 7:34 |
| Reporter: | Spencer Sun | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 3.23.52 | OS: | Linux (RedHat 6.2) |
| Assigned to: | Victor Vagin | CPU Architecture: | Any |
[22 May 2003 15:06]
Spencer Sun
[23 May 2003 2:35]
Alexander Keremidarski
It is repeatable with 3.23.56, but not with 4.0.13 and higher. Working on simpler test case
[30 Jun 2003 1:12]
Victor Vagin
patch:
===== sql/sql_select.cc 1.132 vs edited =====
*** /tmp/sql_select.cc-1.132-5152 Wed Mar 12 16:50:21 2003
--- edited/sql/sql_select.cc Mon Jun 30 11:34:37 2003
***************
*** 1020,1026 ****
s->read_time=(ha_rows) s->table->file->scan_time();
/* Set a max range of how many seeks we can expect when using keys */
! s->worst_seeks= (double) (s->read_time*2);
if (s->worst_seeks < 2.0) // Fix for small tables
s->worst_seeks=2.0;
--- 1020,1026 ----
s->read_time=(ha_rows) s->table->file->scan_time();
/* Set a max range of how many seeks we can expect when using keys */
! s->worst_seeks= (double) s->found_records / 5;
if (s->worst_seeks < 2.0) // Fix for small tables
s->worst_seeks=2.0;
minimal test:
use test;
DROP TABLE IF EXISTS foo;
CREATE TABLE foo (
foo_id int(10) unsigned NOT NULL default '0',
ref_id int(10) unsigned default NULL,
PRIMARY KEY (foo_id)
) TYPE=MyISAM;
INSERT INTO foo VALUES (2425,NULL);
DROP TABLE IF EXISTS bar;
CREATE TABLE bar (
bar_id int(10) unsigned NOT NULL default '0',
ref_id int(10) unsigned NOT NULL default '0',
str varchar(20) default NULL,
PRIMARY KEY (bar_id)
,KEY ref_id (ref_id)
) TYPE=MyISAM;
INSERT INTO bar VALUES (112633,14590,'bar 112633');
INSERT INTO bar VALUES (112634,14590,'bar 112634');
INSERT INTO bar VALUES (112733,14601,'bar 112733');
INSERT INTO bar VALUES (112734,14601,'bar 112734');
INSERT INTO bar VALUES (112735,14601,'bar 112735');
INSERT INTO bar VALUES (112876,14615,'bar 112876');
INSERT INTO bar VALUES (112877,14615,'bar 112877');
INSERT INTO bar VALUES (112903,14618,'bar 112903');
INSERT INTO bar VALUES (112904,14618,'bar 112904');
INSERT INTO bar VALUES (112905,14618,'bar 112905');
INSERT INTO bar VALUES (113172,14641,'bar 113172');
INSERT INTO bar VALUES (113436,14674,'bar 113436');
INSERT INTO bar VALUES (113437,14674,'bar 113437');
INSERT INTO bar VALUES (113486,14689,'bar 113486');
INSERT INTO bar VALUES (113487,14689,'bar 113487');
INSERT INTO bar VALUES (113488,14689,'bar 113488');
INSERT INTO bar VALUES (113489,14689,'bar 113489');
INSERT INTO bar VALUES (113504,14795,'bar 113504');
INSERT INTO bar VALUES (115396,15024,'bar 115396');
INSERT INTO bar VALUES (115397,15024,'bar 115397');
SELECT bar_id, str FROM foo, bar WHERE foo_id = 2425
AND foo.ref_id = bar.ref_id ORDER BY str, bar_id;
[30 Jun 2003 7:34]
Victor Vagin
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at
http://www.mysql.com/doc/en/Installing_source_tree.html
patch was made from mysql-4.0
