summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authoringo@mysql.com <>2005-01-24 10:47:52 +0100
committeringo@mysql.com <>2005-01-24 10:47:52 +0100
commit47c400914900a4771732362fb0b6dd05aac626f0 (patch)
tree3bfa0bc61665651aef2c0a0b16b2129556f99eb2 /sql/sql_select.cc
parent8555668067b152509ee8365767f10984b3ab03dc (diff)
parenta551510cfd20c6be84d29575917fc39a27250e47 (diff)
downloadmariadb-git-47c400914900a4771732362fb0b6dd05aac626f0.tar.gz
Merge mysql.com:/home/mydev/mysql-4.1
into mysql.com:/home/mydev/mysql-4.1-4100
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 7e48374a8e6..5cb6a0a65df 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2844,9 +2844,15 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
x = used key parts (1 <= x <= c)
*/
double rec_per_key;
+#if 0
if (!(rec_per_key=(double)
keyinfo->rec_per_key[keyinfo->key_parts-1]))
rec_per_key=(double) s->records/rec+1;
+#else
+ rec_per_key= keyinfo->rec_per_key[keyinfo->key_parts-1] ?
+ (double) keyinfo->rec_per_key[keyinfo->key_parts-1] :
+ (double) s->records/rec+1;
+#endif
if (!s->records)
tmp=0;
@@ -7496,13 +7502,14 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
field_count++;
}
- if (!field_count)
- { // only const items
+ if (!field_count && !(join->select_options & OPTION_FOUND_ROWS))
+ { // only const items with no OPTION_FOUND_ROWS
join->unit->select_limit_cnt= 1; // Only send first row
DBUG_RETURN(0);
}
Field **first_field=entry->field+entry->fields - field_count;
- offset=entry->field[entry->fields - field_count]->offset();
+ offset= field_count ?
+ entry->field[entry->fields - field_count]->offset() : 0;
reclength=entry->reclength-offset;
free_io_cache(entry); // Safety