简体   繁体   中英

Infinidb-“ `CREATE_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP” giving error

I am trying to port a database from mysql to infinidb.But I am getting above error(described in heading) while porting .

`CREATE_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

is valid in mysql but not in infinidb . Error is : Error code : 138 . The syntax or the data types is not supported by infinidb. Any help will be appreciated.

Is this the full SQL statement that you were trying? I was able to use:

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

Here is console output

[root@centos6 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> 

Let me know if that does not work or you were trying the syntax in a different way. Also what version of InfiniDB are you trying?

Thanks!

It looks like you can't use timepstamp data types with InfiniDB. I have the same version as @mhoglan but it seems there is a little mistake in that query:

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

is missing "engine=infinidb;" at the end, which would create the table in infinidb. Instead, the table is created using MySQL's default engine (MyISAM or whichever).

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.

As you can see, adding engine=infinidb fails.

If you can use datetime instead that may be the way to go; timestamp doesn't appear to be supported right now :(

我猜这是InfiniDB中不允许的NOT NULL约束。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM