エラー番号解説ツール Perror の件
MySQLがエラーパケットを返してきた際の
java.sql.SQLException: Got error 139 from table handler
この番号に基づいてもう少し詳しいエラー内容を調べるのにperrorというツールが用意されている.
こんな感じで
D:\mysql\mysql-4.0.26-win32\bin>perror 139 MySQL error: 139 = Too big row
同じ内容でもエラー番号はサーバのバージョンによって変わる(たぶんメジャーバージョンが上がると変わる)みたいなので,それぞれのバージョンについているperrorで確認する必要があるわけだけど,"perror.c"を覗いてみたら,こんな感じで番号と解説のマッピングが定義されていた.
static HA_ERRORS ha_errlist[]= { { 120,"Didn't find key on read or update" }, { 121,"Duplicate key on write or update" }, { 123,"Someone has changed the row since it was read; Update with is recoverable" }, { 124,"Wrong index given to function" }, { 126,"Index file is crashed" }, { 127,"Record-file is crashed" }, { 128,"Out of memory" }, { 130,"Incorrect file format" }, { 131,"Command not supported by database" }, { 132,"Old database file" }, { 133,"No record read before update" }, { 134,"Record was already deleted (or record file crashed)" }, { 135,"No more room in record file" }, { 136,"No more room in index file" }, { 137,"No more records (read after end of file)" }, { 138,"Unsupported extension used for table" }, { 139,"Too big row"}, { 140,"Wrong create options"}, { 141,"Duplicate unique key or constraint on write or update"}, { 142,"Unknown character set used"}, { 143,"Conflicting table definitions in sub-tables of MERGE table"}, { 144,"Table is crashed and last repair failed"}, { 145,"Table was marked as crashed and should be repaired"}, { 146,"Lock timed out; Retry transaction"}, { 147,"Lock table is full; Restart program with a larger locktable"}, { 148,"Updates are not allowed under a read only transactions"}, { 149,"Lock deadlock; Retry transaction"}, { 150,"Foreign key constraint is incorrectly formed"}, { 151,"Cannot add a child row"}, { 152,"Cannot delete a parent row"}, { -30999, "DB_INCOMPLETE: Sync didn't finish"}, { -30998, "DB_KEYEMPTY: Key/data deleted or never created"}, { -30997, "DB_KEYEXIST: The key/data pair already exists"}, { -30996, "DB_LOCK_DEADLOCK: Deadlock"}, { -30995, "DB_LOCK_NOTGRANTED: Lock unavailable"}, { -30994, "DB_NOSERVER: Server panic return"}, { -30993, "DB_NOSERVER_HOME: Bad home sent to server"}, { -30992, "DB_NOSERVER_ID: Bad ID sent to server"}, { -30991, "DB_NOTFOUND: Key/data pair not found (EOF)"}, { -30990, "DB_OLD_VERSION: Out-of-date version"}, { -30989, "DB_RUNRECOVERY: Panic return"}, { -30988, "DB_VERIFY_BAD: Verify failed; bad format"}, { 0,NullS }, };
これはMySQL 4.0.26のソースファイルから.perrorのソースにハードコーディングされてるんだねw 知らなかったw てっきりサーバ側のソースファイルと共通で使用する外部定義ファイルとかから読み込んでいるもんだと想像していた.