1

I'm trying to automate a process in which an InfiniDB table is replaced. My idea is to create one table with the same structure as the original, load it with new data, and replace the original with this new one.

The problem is that when you do:

CREATE TABLE temp_table LIKE original_table;

the service replies the good old:

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.

I was thinking to do a SHOW CREATE TABLE, replace the name, and run the result, but... that's a bit ugly.

Do you know of a better way?

Thanks in advance!!

nandilugio
  • 315
  • 2
  • 11
  • I don't know InfiniDB, but the standard SQL way would be `create table temp_table as select * from original_table` –  Jun 14 '12 at 10:48
  • Well yes, but that will copy the whole table. I only need the structure. For that you use: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name { LIKE old_tbl_name | (LIKE old_tbl_name) } (from http://dev.mysql.com/doc/refman/5.5/en/create-table.html) – nandilugio Jun 14 '12 at 16:56
  • Then use `create table temp_table as select * from original_table where 1=0` –  Jun 14 '12 at 17:14
  • I've tryed that and at first it works because it creates a MyISAM table. Then, if you try to convert it to InfiniDB using `ALTER TABLE temp_table ENGINE=InfiniDB`, you get the same error above: `The syntax or the data type(s) is not supported by InfiniDB.`. Thanks anyway :) – nandilugio Jun 15 '12 at 08:30
  • Oh. InfiniDB is a MySQL engine. I thought it was a DBMS of it's own. –  Jun 15 '12 at 08:41
  • Yup, they use all the structure in mysql. It's an interesting solution not to reinvent the wheel in many aspects. Looks cool!! (for now hehe). – nandilugio Jun 15 '12 at 09:49
  • 1
    Also tried `CREATE TABLE temp_table ENGINE=InfiniDB AS SELECT * FROM gold_members WHERE 1=0;` and it throws the same error. :s Will do the replace over the create table solution, and hope for InfiniDB3 to support it. – nandilugio Jun 15 '12 at 10:33

0 Answers0