2015-05-01 22 views
1

這是一個特定表的續集臨結構:爲什麼Sequel Pro在命令行上顯示的表的鍵值不同於MySQL的結果?

Sequel Pro Table

這是在命令行上觀看相同的表結構:

MySQL Command Line

這裏是輸出SHOW CREATE TABLE field_data_field_checklist_status

| field_data_field_checklist_status | 
CREATE TABLE `field_data_field_checklist_status` (
    `entity_type` varchar(128) NOT NULL DEFAULT '' COMMENT 'The entity type this data is attached to', 
    `bundle` varchar(128) NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance', 
    `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'A boolean indicating whether this data item has been deleted', 
    `entity_id` int(10) unsigned NOT NULL COMMENT 'The entity id this data is attached to', 
    `revision_id` int(10) unsigned DEFAULT NULL COMMENT 'The entity revision id this data is attached to, or NULL if the entity type is not versioned', 
    `language` varchar(32) NOT NULL DEFAULT '' COMMENT 'The language for this data item.', 
    `delta` int(10) unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields', 
    `field_checklist_status_value` varchar(255) DEFAULT NULL, 
    PRIMARY KEY (`entity_type`,`entity_id`,`deleted`,`delta`,`language`), 
    KEY `entity_type` (`entity_type`), 
    KEY `bundle` (`bundle`), 
    KEY `deleted` (`deleted`), 
    KEY `entity_id` (`entity_id`), 
    KEY `revision_id` (`revision_id`), 
    KEY `language` (`language`), 
    KEY `field_checklist_status_value` (`field_checklist_status_value`) 
) 
ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Data storage for field 7 (field_checklist_status)' | 

I我相當確信MySQL命令行表結構是準確的。這是一個Drupal字段表。

有誰知道爲什麼會有差異?

+0

它可能沒有設置處理您的複合PRIMARY鍵。你可以向我們展示表格模式作爲'SHOW CREATE TABLE'輸出嗎? – ceejayoz

+0

謝謝。我已經將該輸出包含在我編輯的問題中。 –

+0

我在運行模式時看到了同樣的情況。我將它作爲Sequel Pro的一個錯誤報告,包括表格模式。 – ceejayoz

回答

1

是不是有一個主鍵有entity_type作爲列,還有一個多鍵作爲列?那麼Key的值將是不明確的,這將解釋不一致性。

在MySQL檢查鑰匙,最好的辦法是運行

SHOW CREATE TABLE field_data_field_checklist_status; 

它會告訴你實際的鍵值,在其中列的順序。

+0

好喊,entity_type有其自己的索引以及作爲複合鍵的一部分。 Delta也是關鍵的一部分,但沒有單獨索引,並且顯示爲「PRI」,所以這幾乎肯定是Sequel Pro處理多個索引中的列的方式 – Clive

相關問題