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 DEFAULTS ^
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With