|
|
|
(errno: 150) при создании таблицы
|
|||
|---|---|---|---|
|
#18+
Всем привет, есть таблица со строковым уникальным полем: Код: sql 1. 2. 3. 4. 5. [/SRC] Есть другая таблица Код: sql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. И я создаю таблицу многие к многим этих таблиц : Код: sql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. при выполнении последнего запроса я получаю ошибку : авторERROR: Can't create table 'roc_new_version.inventory_item_paperwork' (errno: 150) Error Code: 1005 Через команду SHOW INNODB STATUS я прочитал : автор===================================== 130811 14:02:40 INNODB MONITOR OUTPUT ===================================== Per second averages calculated from the last 0 seconds ---------- SEMAPHORES ---------- OS WAIT ARRAY INFO: reservation count 606, signal count 603 Mutex spin waits 0, rounds 8541, OS waits 97 RW-shared spins 342, OS waits 157; RW-excl spins 414, OS waits 342 ------------------------ LATEST FOREIGN KEY ERROR ------------------------ 130811 14:01:26 Error in foreign key constraint of table roc_new_version/inventory_item_paperwork: FOREIGN KEY (`sku`) REFERENCES `inventory_item` (`sku`) ON DELETE RESTRICT, CONSTRAINT `inventory_item_paperwork_FK_2` FOREIGN KEY (`paperwork_id`) REFERENCES `paperwork` (`id`) ON DELETE RESTRICT )Type=InnoDB: Cannot find an index in the referenced table where the referenced columns appear as the first columns, or column types in the table and the referenced table do not match for constraint. Note that the internal storage type of ENUM and SET changed in tables created with >= InnoDB-4.1.12, and such columns in old tables cannot be referenced by such columns in new tables. See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html for correct foreign key definition. ------------ TRANSACTIONS ------------ Trx id counter 0 2131673 Purge done for trx's n:o < 0 2131553 undo n:o < 0 0 History list length 13 LIST OF TRANSACTIONS FOR EACH SESSION: ---TRANSACTION 0 2131583, not started, process no 5056, OS thread id 3009514352 MySQL thread id 2, query id 2969 localhost 127.0.0.1 root SHOW INNODB STATUS -------- FILE I/O -------- I/O thread 0 state: waiting for i/o request (insert buffer thread) I/O thread 1 state: waiting for i/o request (log thread) I/O thread 2 state: waiting for i/o request (read thread) I/O thread 3 state: waiting for i/o request (write thread) Pending normal aio reads: 0, aio writes: 0, ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 Pending flushes (fsync) log: 0; buffer pool: 0 10535 OS file reads, 7917 OS file writes, 1294 OS fsyncs 0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s ------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX ------------------------------------- Ibuf: size 1, free list len 5, seg size 7, 35538 inserts, 35538 merged recs, 1000 merges Hash table size 34679, node heap has 1 buffer(s) 0.00 hash searches/s, 0.00 non-hash searches/s --- LOG --- Log sequence number 0 965814754 Log flushed up to 0 965814754 Last checkpoint at 0 965814754 0 pending log writes, 0 pending chkp writes 1179 log i/o's done, 0.00 log i/o's/second ---------------------- BUFFER POOL AND MEMORY ---------------------- Total memory allocated 19783690; in additional pool allocated 1048576 Dictionary memory allocated 1891784 Buffer pool size 512 Free buffers 0 Database pages 511 Modified db pages 0 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages read 13938, created 8600, written 14849 0.00 reads/s, 0.00 creates/s, 0.00 writes/s No buffer pool page gets since the last printout -------------- ROW OPERATIONS -------------- 0 queries inside InnoDB, 0 queries in queue 1 read views open inside InnoDB Main thread process no. 5056, id 2971933552, state: waiting for server activity Number of rows inserted 163019, updated 4, deleted 0, read 811932 0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s ---------------------------- END OF INNODB MONITOR OUTPUT ============================ не пойму какого идекса не хватает ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.08.2013, 15:13:25 |
|
||
|
(errno: 150) при создании таблицы
|
|||
|---|---|---|---|
|
#18+
mstdmstd, FK можно только на PK или UNIQUE ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.08.2013, 15:20:55 |
|
||
|
(errno: 150) при создании таблицы
|
|||
|---|---|---|---|
|
#18+
А, не, не в этом - не хватает DEFAULT CHARSET=latin1. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.08.2013, 15:24:18 |
|
||
|
|

start [/forum/topic.php?fid=47&msg=38362301&tid=1836269]: |
0ms |
get settings: |
5ms |
get forum list: |
9ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
32ms |
get topic data: |
6ms |
get forum data: |
1ms |
get page messages: |
26ms |
get tp. blocked users: |
1ms |
| others: | 212ms |
| total: | 296ms |

| 0 / 0 |
