Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group