CREATE TABLE AS SELECT.... - Mailing list pgsql-sql

From Arash Zaryoun
Subject CREATE TABLE AS SELECT....
Date
Msg-id s149c5fe.029@cbc.ca
Whole thread Raw
Responses Re: CREATE TABLE AS SELECT....
List pgsql-sql
Hi All,

I have a table which has 'SERIAL' datatype. When I use 'create table X
as select * from my-table' , it creates the table but without serial
datatype. I mean without implicit sequence.

test=> \d qptuser                                   Table "public.qptuser" Column   |         Type          |
            Modifiers
 
-----------+-----------------------+----------------------------------------------------------srl       | integer
       | not null default
 
nextval('public.qptuser_srl_seq'::text)login_nme | character varying(35) | not nullpassword  | character varying(30) |
notnull
 
Indexes:   "pk_qptuser" primary key, btree (srl)   "i1_qptuser_login_nme" unique, btree (login_nme)

test=> create table x as select * from qptuser;
test=> \d x 
             Table "public.a" Column   |         Type          | Modifiers
-----------+-----------------------+-----------srl       | integer               |login_nme | character varying(35)
|password | character varying(30) |
 

Can you help me on this?

Thanks,
- Arash



pgsql-sql by date:

Previous
From: "Iain"
Date:
Subject: Re: implementing an out-of-transaction trigger
Next
From: Sergio Fantinel
Date:
Subject: PL/pgSQL multidimension (matrix) array in function