How to clone a table to an empty one - Mailing list pgsql-sql

From Ramiro Alba
Subject How to clone a table to an empty one
Date
Msg-id 3A8E90E7.4BFF6C1@labtie.mmt.upc.es
Whole thread Raw
Responses Re: How to clone a table to an empty one  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hello everyone:

I would need to create an exact reproduction of a certain table
(excluding data) converving primary key attributes and so on.  I tried
with:
CREATE TABLE AS ...
I also tried :

SELECT *
INTO TABLE ....

In both cases, it does not maintain the primary key atribute that I need
in order to edit the cloned table with StarBase using the unixODBC
driver. The table reads ok, but it is read only due to the fact that
I mention.
Anyone knows the solution?

Regards

--
Ramiro Alba
Laboratori de Termotecnia i Energetica

Departament de Maquines i Motors Termics
ETS d'Enginyers Industrials de Terrassa

C/Colom 11

Tf: 34 - 93 739 86 46
Fax: 34 - 93 739 81 01

e-mail: ramiro@labtie.mmt.upc.es





pgsql-sql by date:

Previous
From: Jie Liang
Date:
Subject: Re: PL/PgSQL FOR syntax
Next
From: Tom Lane
Date:
Subject: Re: How to clone a table to an empty one