Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Postgresql - CREATE TABLE SYNTAX ERROR USING LIKE -

0

69 views

Hi all, i'm trying to create a temp table from a parent table:

This is the code that i execute with pgAdmin III ( or by JDBC in Java ):

CREATE TEMP TABLE table1_tmp LIKE table1 INCLUDING DEFAULTS;

And the error i recieved is:

[WARNING  ] CREATE TEMP TABLE table1_tmp LIKE table1 INCLUDING DEFAULTS
        ERROR:  syntax error at or near «LIKE»
        LÍNEA 1: CREATE TEMP TABLE table1_tmp LIKE table1 INCLUDING DEFAULTS
                                              ^

Reading postgresql 8.4 documentation, create tables using this, its very easy, but i don't understand where is the syntax problem.

Thanks in advance!

Bye.

asked February 2, 2011 6:43 am CST
posted via StackOverflow

2 Answers

1
 

I'm not a Postgresql user but the manual say that there is ( ) around the like setence.

CREATE TEMP TABLE table1_tmp (LIKE table1 INCLUDING DEFAULTS);

answered February 2, 2011 7:23 am CST
0
 

You need to put the like in to parens like

CREATE TEMP TABLE table1_tmp ( LIKE table1 INCLUDING DEFAULTS ) ;

This is not obvious from the docs if you don't count parens 1:1

answered February 2, 2011 7:23 am CST

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions