2014-02-17 79 views
1

我試圖將數據庫從mysql移植到infinidb.But,而移植時遇到以上錯誤(在標題中描述)。Infinidb-」`CREATE_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP「給出錯誤

`CREATE_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 

在mysql中有效,但不在infinidb中。錯誤是:錯誤代碼:138。 infinidb不支持語法或數據類型。任何幫助將不勝感激。

回答

2

這是您正在嘗試的完整SQL語句嗎?我能夠使用:

create table test (`CREATE_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); 

這裏是控制檯輸出

[[email protected] bin]# idbmysql 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 12 
Server version: 5.1.73 Calpont InfiniDB 4.5 Alpha 

Copyright (c) 2014, InfiniDB, Inc. and/or its affiliates. All rights reserved. 
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 

InfiniDB is a registered trademark of InfiniDB, Inc. and/or its affiliates. 
Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

mysql> use test; 
Database changed 
mysql> create table test (`CREATE_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); 
Query OK, 0 rows affected (0.00 sec) 

mysql> describe test; 
+------------------+-----------+------+-----+-------------------+-----------------------------+ 
| Field   | Type  | Null | Key | Default   | Extra      | 
+------------------+-----------+------+-----+-------------------+-----------------------------+ 
| CREATE_TIMESTAMP | timestamp | NO |  | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP | 
+------------------+-----------+------+-----+-------------------+-----------------------------+ 
1 row in set (0.00 sec) 

mysql> 

讓我知道,如果不工作,或者你以不同的方式試圖語法。你還想要什麼版本的InfiniDB?

謝謝!

2

看起來您不能在InfiniDB中使用timepstamp數據類型。我有同樣的版本@mhoglan但它似乎有在該查詢出一點差錯:

mysql> create table test (`CREATE_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); 
Query OK, 0 rows affected (0.00 sec) 

是缺少「發動機= infinidb;」在最後,這將在infinidb中創建表。 相反,該表是使用MySQL的默認引擎(MyISAM或其中任意一個)創建的。

mysql> create table test (`CREATE_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP) engine=infinidb; 
ERROR 138 (HY000): The syntax or the data type(s) is not supported by InfiniDB. Please check the InfiniDB syntax guide for supported syntax or data types. 

正如您所看到的,添加engine = infinidb失敗。

如果您可以使用日期時間,可能是要走的路;時間戳目前似乎不支持:(

0

我想這是NOT NULL約束,這是InfiniDB中不允許的。

相關問題