CREATE TABLE AS SELECT....

From: "Arash Zaryoun" <Arash_Zaryoun(at)CBC(dot)CA>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: CREATE TABLE AS SELECT....
Date: 2004-09-16 20:57:19
Message-ID: s149c5fe.029@cbc.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 null
password | character varying(30) | not null
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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Sandeep Gaikwad 2004-09-17 05:18:13 How to check postgres running or not ?
Previous Message Sergio Fantinel 2004-09-16 17:10:37 PL/pgSQL multidimension (matrix) array in function