Received: from dukas.upc.es (dukas.upc.es [147.83.2.62]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1HEqWx05991 for ; Sat, 17 Feb 2001 09:52:32 -0500 (EST) (envelope-from ramiro@labtie.mmt.upc.es) Received: from selene.upc.es (selene.upc.es [147.83.83.65]) by dukas.upc.es (8.10.1/8.10.1) with ESMTP id f1HEmgJ08893 for ; Sat, 17 Feb 2001 15:48:43 +0100 (MET) Received: from batch.upc.es (root@batch.upc.es [147.83.92.19]) by selene.upc.es (8.8.8/8.8.6) with ESMTP id PAA12480 for ; Sat, 17 Feb 2001 15:52:27 +0100 (MET) Received: from labtie.mmt.upc.es (ramiro@mundo.upc.es [147.83.92.87]) by batch.upc.es (8.9.3/8.9.3/Debian/GNU) with ESMTP id PAA06613 for ; Sat, 17 Feb 2001 15:52:27 +0100 Message-ID: <3A8E90E7.4BFF6C1@labtie.mmt.upc.es> Date: Sat, 17 Feb 2001 15:55:36 +0100 From: Ramiro Alba Organization: CTTC X-Mailer: Mozilla 4.76C-CCK-MCD [en] (X11; U; Linux 2.2.18 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: How to clone a table to an empty one Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200102/296 X-Sequence-Number: 1492 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