copy table (create table like) - not keeping auto incrementing primary key
<p>I'm new to postgres (on 9.5) and I can't find this in the docs anywhere.</p>

<p>Basically create a table like this:</p>

<pre><code>CREATE TABLE test (
        id serial primary key, 
        field1 CHARACTER VARYING(50)
        );
</code></pre>

<p>Then copy it:</p>

<pre><code>create table test_copy (like test);
</code></pre>

<p>The table test has these columns:</p>

<pre><code>COLUMN_NAME id  field1
DATA_TYPE   4   12
TYPE_NAME   serial  varchar
COLUMN_SIZE 10  50
IS_NULLABLE NO  YES
IS_AUTOINCREMENT     YES    NO
</code></pre>

<p>But test_copy has these:</p>

<pre><code>COLUMN_NAME id  field1
DATA_TYPE   4   12
TYPE_NAME   int4    varchar
COLUMN_SIZE 10  50
IS_NULLABLE NO  YES
IS_AUTOINCREMENT     NO NO
</code></pre>

<p>Why am I losing serial and autoincrement?  How can I make a copy of a table that preserves these?</p>