MySQL Forums
Forum List  »  Quality Assurance

CREATE TABLE LIKE on temporary tables error
Posted by: Mattia Merzi
Date: January 24, 2008 07:48AM

Hi everyone,

I'm using mysql 5.0.51 on a SuSE 10.3.

I've found a strange behavior using the "CREATE TABLE LIKE" statement
to create a temporary table.
I've read that you can create a temporary table with the same name of
an existing one, but using CREATE TEMPORARY TABLE LIKE performs an unwanted
name uniqueness check.

e.g.

DROP TEMPORARY TABLE IF EXISTS TEST_TABLE;

DROP TEMPORARY TABLE IF EXISTS ANOTHER_TABLE;

DROP TABLE IF EXISTS TEST_TABLE;

CREATE TABLE TEST_TABLE ( A INTEGER );

CREATE TEMPORARY TABLE TEST_TABLE LIKE TEST_TABLE;
/* This statements returns:
Error Code : 1066 Not unique table/alias: 'TEST_TABLE'
All the other statements execute with no error. */

CREATE TEMPORARY TABLE ANOTHER_TABLE LIKE TEST_TABLE;

CREATE TEMPORARY TABLE TEST_TABLE SELECT * FROM TEST_TABLE;

I hope it's not my fault!

Greetings,

Mattia Merzi.



Edited 2 time(s). Last edit at 01/24/2008 07:53AM by Mattia Merzi.

Options: ReplyQuote


Subject
Views
Written By
Posted
CREATE TABLE LIKE on temporary tables error
5624
January 24, 2008 07:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.