MySQL 5.1.40リリース

出ました。今回はバグ修正が48件あり、そのうちパーティショニング機能に関するものが5件、レプリケーション機能に関するものが6件あります。サーバクラッシュ系のバグ修正がいくつかありますが、いずれも発生条件が極めて複雑であり、通常の運用で当たることはまずないのではないかと思います。
今回ちょっと気になったバグとして、Bug#44369があります。

mysql> create table test (DB_ROW_ID int) engine = innodb;
ERROR 1005 (HY000): Can't create table 'scott.test' (errno: -1)

mysql> create table test (db_row_id int) engine = innodb;
Query OK, 0 rows affected (0.01 sec)

InnoDBでは特定のカラム名を持ったテーブルが作れないという仕様があるのですが、そのカラム名のチェックが不十分なため、小文字で指定するとテーブルが作れてしまうというバグです。
私はそもそもこのようなカラム名の制限があることを、今まで知りませんでした。確認したところMySQL 5.1.40では以下の3つが予約語として定義されており、InnoDBテーブルのカラム名として指定できないようになっています。

  • DB_ROW_ID
  • DB_TRX_ID
  • DB_ROLL_PTR

これらはソースの storage/innobase/dict/dict0dict.c 内で定義されています。

/********************************************************************
If the given column name is reserved for InnoDB system columns, return
TRUE. */

ibool
dict_col_name_is_reserved(
/*======================*/
				/* out: TRUE if name is reserved */
	const char*	name)	/* in: column name */
{
	/* This check reminds that if a new system column is added to
	the program, it should be dealt with here. */
#if DATA_N_SYS_COLS != 3
#error "DATA_N_SYS_COLS != 3"
#endif

	static const char*	reserved_names[] = {
		"DB_ROW_ID", "DB_TRX_ID", "DB_ROLL_PTR"
	};

	ulint			i;

	for (i = 0; i < UT_ARR_SIZE(reserved_names); i++) {
		if (innobase_strcasecmp(name, reserved_names[i]) == 0) {

			return(TRUE);
		}
	}

	return(FALSE);
}

ご注意ください。