Commit c0e3d59b authored by unknown's avatar unknown

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


innobase/pars/pars0grm.y:
  Move inclusion of math.h after univ.i also in the .y file; this fix is already done in 4.0
sql/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
parent aa0ccb64
......@@ -14,9 +14,8 @@ the InnoDB parser.
/* The value of the semantic attribute is a pointer to a query tree node
que_node_t */
#include <math.h>
#include "univ.i"
#include <math.h>
#include "pars0pars.h"
#include "mem0mem.h"
#include "que0types.h"
......
......@@ -993,7 +993,10 @@ how you can resolve the problem.\n",
((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
a string of bytes of length ref_length which uniquely specifies
......@@ -1002,21 +1005,30 @@ how you can resolve the problem.\n",
of length ref_length! */
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)
->clust_index_was_generated = FALSE;
primary_key = 0;
key_used_on_scan = 0;
/* MySQL allocates the buffer for ref. key_info->key_length
includes space for all key columns + one byte for each column
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->key_length;
/*
MySQL allocates the buffer for ref. key_info->key_length
includes space for all key columns + one byte for each column
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;
} 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)
->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