diff options
author | unknown <monty@hundin.mysql.fi> | 2001-12-06 01:16:28 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-12-06 01:16:28 +0200 |
commit | b5cfb7ac01dd00715060470805859a51d6f2caf5 (patch) | |
tree | 72b6ce45de206772ff694d62b41d9fc5a16edbe8 /sql | |
parent | ff8c7348648b2a2e1ce14d8332c065a38a43ca0c (diff) | |
parent | 6f8f45e9592aa7f2ca48168d51e1624cce158797 (diff) | |
download | mariadb-git-b5cfb7ac01dd00715060470805859a51d6f2caf5.tar.gz |
merge with 3.23.47
Docs/manual.texi:
Auto merged
Build-tools/Do-compile:
Auto merged
innobase/include/buf0buf.ic:
Auto merged
myisam/mi_locking.c:
Auto merged
mysql-test/t/join_outer.test:
Auto merged
mysys/my_init.c:
Auto merged
scripts/mysql_config.sh:
Auto merged
mysql-test/t/myisam.test:
Auto merged
sql/ha_innobase.h:
Auto merged
sql/handler.h:
Auto merged
configure.in:
merge
mysql-test/r/innodb.result:
merge
mysql-test/r/join_outer.result:
merge
mysql-test/r/myisam.result:
merge
mysql-test/t/innodb.test:
merge
mysys/mf_iocache2.c:
Skip changes in 3.23
sql/sql_select.cc:
merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_berkeley.h | 1 | ||||
-rw-r--r-- | sql/sql_select.cc | 27 |
2 files changed, 22 insertions, 6 deletions
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 561e06229fa..ab1ead5a3e9 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -107,6 +107,7 @@ class ha_berkeley: public handler uint extra_rec_buf_length() { return BDB_HIDDEN_PRIMARY_KEY_LENGTH; } ha_rows estimate_number_of_rows(); bool fast_key_read() { return 1;} + key_map keys_to_use_for_scanning() { return ~(key_map) 0; } bool has_transactions() { return 1;} int open(const char *name, int mode, uint test_if_locked); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5789e537a6a..cfc40bdfdc3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2191,10 +2191,17 @@ get_best_combination(JOIN *join) j->type=JT_REF; /* Must read with repeat */ else if (ref_key == j->ref.key_copy) { /* Should never be reached */ - j->type=JT_CONST; /* purecov: deadcode */ + /* + This happen if we are using a constant expression in the ON part + of an LEFT JOIN. + SELECT * FROM a LEFT JOIN b ON b.key=30 + Here we should not mark the table as a 'const' as a field may + have a 'normal' value or a NULL value. + */ + j->type=JT_CONST; if (join->const_tables == tablenr) { - join->const_tables++; /* purecov: deadcode */ + join->const_tables++; join->const_table_map|=form->map; } } @@ -2777,8 +2784,8 @@ static void update_depend_map(JOIN *join, ORDER *order) /* -** simple_order is set to 1 if sort_order only uses fields from head table -** and the head table is not a LEFT JOIN table + simple_order is set to 1 if sort_order only uses fields from head table + and the head table is not a LEFT JOIN table */ static ORDER * @@ -4424,8 +4431,11 @@ join_read_const(JOIN_TAB *tab) } store_record(table,1); } - else if (!table->status) // Only happens with left join + else if (!(table->status & ~STATUS_NULL_ROW)) // Only happens with left join + { + table->status=0; restore_record(table,1); // restore old record + } table->null_row=0; return table->status ? -1 : 0; } @@ -5263,7 +5273,7 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys) /***************************************************************************** -** If not selecting by given key, create a index how records should be read +** If not selecting by given key, create an index how records should be read ** return: 0 ok ** -1 some fatal error ** 1 no records @@ -5367,6 +5377,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, join_init_read_last_with_key); table->file->index_init(nr); tab->type=JT_NEXT; // Read with index_first(), index_next() + if (table->used_keys & ((key_map) 1 << nr)) + { + table->key_read=1; + table->file->extra(HA_EXTRA_KEYREAD); + } } DBUG_RETURN(1); } |