Postgresql - CREATE TABLE SYNTAX ERROR USING LIKE -
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 received 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 DE开发者_高级运维FAULTS
^
Reading postgresql 8.4 documentation, create tables using this, its very easy, but I don't understand where is the syntax problem.
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
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);
精彩评论