ha_innobase.cc:

  Backport from 4.0: Fix bug in MySQL-3.23 ORDER BY from a table with no PRIMARY KEY and where the user had added UNIQUE indexes with CREATE INDEX
pars0grm.y:
  Move inclusion of math.h after univ.i also in the .y file; this fix is already done in 4.0
parent be932e73
...@@ -14,9 +14,8 @@ the InnoDB parser. ...@@ -14,9 +14,8 @@ the InnoDB parser.
/* The value of the semantic attribute is a pointer to a query tree node /* The value of the semantic attribute is a pointer to a query tree node
que_node_t */ que_node_t */
#include <math.h>
#include "univ.i" #include "univ.i"
#include <math.h>
#include "pars0pars.h" #include "pars0pars.h"
#include "mem0mem.h" #include "mem0mem.h"
#include "que0types.h" #include "que0types.h"
......
...@@ -993,7 +993,10 @@ how you can resolve the problem.\n", ...@@ -993,7 +993,10 @@ how you can resolve the problem.\n",
((row_prebuilt_t*)innobase_prebuilt)->mysql_row_len = table->reclength; ((row_prebuilt_t*)innobase_prebuilt)->mysql_row_len = table->reclength;
primary_key = MAX_KEY; /* Looks like MySQL-3.23 sometimes has primary key number != 0 */
primary_key = table->primary_key;
key_used_on_scan = primary_key;
/* Allocate a buffer for a 'row reference'. A row reference is /* Allocate a buffer for a 'row reference'. A row reference is
a string of bytes of length ref_length which uniquely specifies a string of bytes of length ref_length which uniquely specifies
...@@ -1002,21 +1005,30 @@ how you can resolve the problem.\n", ...@@ -1002,21 +1005,30 @@ how you can resolve the problem.\n",
of length ref_length! */ of length ref_length! */
if (!row_table_got_default_clust_index(ib_table)) { if (!row_table_got_default_clust_index(ib_table)) {
if (primary_key >= MAX_KEY) {
fprintf(stderr,
"InnoDB: Error: table %s has a primary key in InnoDB\n"
"InnoDB: data dictionary, but not in MySQL!\n", name);
}
((row_prebuilt_t*)innobase_prebuilt) ((row_prebuilt_t*)innobase_prebuilt)
->clust_index_was_generated = FALSE; ->clust_index_was_generated = FALSE;
/*
primary_key = 0; MySQL allocates the buffer for ref. key_info->key_length
key_used_on_scan = 0; includes space for all key columns + one byte for each column
that may be NULL. ref_length must be as exact as possible to
/* MySQL allocates the buffer for ref. key_info->key_length save space, because all row reference buffers are allocated
includes space for all key columns + one byte for each column based on ref_length.
that may be NULL. ref_length must be as exact as possible to */
save space, because all row reference buffers are allocated
based on ref_length. */ ref_length = table->key_info[primary_key].key_length;
ref_length = table->key_info->key_length;
} else { } else {
if (primary_key != MAX_KEY) {
fprintf(stderr,
"InnoDB: Error: table %s has no primary key in InnoDB\n"
"InnoDB: data dictionary, but has one in MySQL!\n", name);
}
((row_prebuilt_t*)innobase_prebuilt) ((row_prebuilt_t*)innobase_prebuilt)
->clust_index_was_generated = TRUE; ->clust_index_was_generated = TRUE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment