Commit 20e1d3c6 authored by Marko Mäkelä's avatar Marko Mäkelä

Bug#14729221 IN-PLACE ALTER TABLE REPORTS '' INSTEAD OF

REAL DUPLICATE VALUE FOR PREFIX KEYS

innobase_rec_to_mysql(): Invoke dict_index_get_nth_col_or_prefix_pos()
instead of dict_index_get_nth_col_pos() to find the column.
parent 5156605e
2012-10-16 The InnoDB Team
* dict/dict0dict.c, handler/handler0alter.cc, include/dict0dict.h:
Fix Bug#14729221 IN-PLACE ALTER TABLE REPORTS '' INSTEAD OF REAL
DUPLICATE VALUE FOR PREFIX KEYS
2012-10-09 The InnoDB Team
* row/row0mysql.c:
......
/*****************************************************************************
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -473,10 +473,12 @@ Looks for column n in an index.
ULINT_UNDEFINED if not contained */
UNIV_INTERN
ulint
dict_index_get_nth_col_pos(
/*=======================*/
const dict_index_t* index, /*!< in: index */
ulint n) /*!< in: column number */
dict_index_get_nth_col_or_prefix_pos(
/*=================================*/
const dict_index_t* index, /*!< in: index */
ulint n, /*!< in: column number */
ibool inc_prefix) /*!< in: TRUE=consider
column prefixes too */
{
const dict_field_t* field;
const dict_col_t* col;
......@@ -498,7 +500,8 @@ dict_index_get_nth_col_pos(
for (pos = 0; pos < n_fields; pos++) {
field = dict_index_get_nth_field(index, pos);
if (col == field->col && field->prefix_len == 0) {
if (col == field->col
&& (inc_prefix || field->prefix_len == 0)) {
return(pos);
}
......@@ -507,6 +510,20 @@ dict_index_get_nth_col_pos(
return(ULINT_UNDEFINED);
}
/********************************************************************//**
Looks for column n in an index.
@return position in internal representation of the index;
ULINT_UNDEFINED if not contained */
UNIV_INTERN
ulint
dict_index_get_nth_col_pos(
/*=======================*/
const dict_index_t* index, /*!< in: index */
ulint n) /*!< in: column number */
{
return(dict_index_get_nth_col_or_prefix_pos(index, n, FALSE));
}
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
Returns TRUE if the index contains a column or a prefix of that column.
......
......@@ -147,7 +147,7 @@ innobase_rec_to_mysql(
field->reset();
ipos = dict_index_get_nth_col_pos(index, i);
ipos = dict_index_get_nth_col_or_prefix_pos(index, i, TRUE);
if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) {
null_field:
......
......@@ -839,6 +839,18 @@ dict_index_get_nth_col_pos(
const dict_index_t* index, /*!< in: index */
ulint n); /*!< in: column number */
/********************************************************************//**
Looks for column n in an index.
@return position in internal representation of the index;
ULINT_UNDEFINED if not contained */
UNIV_INTERN
ulint
dict_index_get_nth_col_or_prefix_pos(
/*=================================*/
const dict_index_t* index, /*!< in: index */
ulint n, /*!< in: column number */
ibool inc_prefix); /*!< in: TRUE=consider
column prefixes too */
/********************************************************************//**
Returns TRUE if the index contains a column or a prefix of that column.
@return TRUE if contains the column or its prefix */
UNIV_INTERN
......
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