summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-06-29 21:15:51 +0300
committerunknown <monty@mashka.mysql.fi>2003-06-29 21:15:51 +0300
commitcaddb5ea53cbde18bf0a915bc4867fecd93c55d5 (patch)
tree1ac37cd13fd73f63d6a55e771e89931da732fe30 /sql/sql_select.cc
parent7143815557275a3f954b279ace4305ea278020de (diff)
downloadmariadb-git-caddb5ea53cbde18bf0a915bc4867fecd93c55d5.tar.gz
Fixed 'Unknown error' when doing ORDER BY on reference table which
was used with NULL value on NOT NULL column. (Bug #479) mysql-test/r/order_by.result: Update of results mysql-test/t/order_by.test: Test of new code sql/sql_select.cc: Fixed problem with lookup on NULL
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index cafafee243e..b9e9c0a14fa 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5326,11 +5326,23 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit)
can use.
*/
if (!(select->quick=get_ft_or_quick_select_for_ref(table, tab)))
- goto err;
+ {
+ if (current_thd->fatal_error)
+ goto err; // End of memory
+ /*
+ Impossible range (for example lookup on NULL on not null field)
+ Create empty result set
+ */
+ if (!(table->record_pointers= my_malloc(1, MYF(MY_WME))))
+ goto err;
+ table->found_records= 0;
+ goto end;
+ }
}
}
table->found_records=filesort(&table,sortorder,length,
select, 0L, select_limit, &examined_rows);
+end:
delete select; // filesort did select
tab->select=0;
tab->select_cond=0;