Zardosht Kasheff <zardosht@gmail.com> writes:
What I do not understand is this. Why does the following code at line 4734 of ha_partition.cc (at the bottom of this message) simply assume that if file->stats.records is 0, that it can blindly return HA_ERR_END_OF_FILE? I understand if file->ha_table_flags exposes HA_STATS_RECORDS_IS_EXACT, that it can do this, but that is not checked here.
From sql/handler.h:
class ha_statistics { ... /* The number of records in the table. 0 - means the table has exactly 0 rows other - if (table_flags() & HA_STATS_RECORDS_IS_EXACT) the value is the exact number of records in the table else it is an estimate */ ha_rows records; So 0 is special, and must not be given as an estimate, according to this comment (which is also in MySQL 5.1). - Kristian.