[SQL] How to clone a table to an empty one
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: [EMAIL PROTECTED]
Re: [SQL] How to clone a table to an empty one
Ramiro Alba <[EMAIL PROTECTED]> writes: > I would need to create an exact reproduction of a certain table > (excluding data) converving primary key attributes and so on. Try pg_dump -s -t tablename dbname | psql dbname There is no easy way to do this directly in SQL ... regards, tom lane
[SQL] PL/SQL-to-PL/PgSQL-HOWTO beta Available
Hi all, I finished the beta version of my PL/SQL-to-PL/PgSQL-HOWTO last night and put it in http://www.brasileiro.net/roberto/howto . It explains basic differences between Oracle's PL/SQL and PG's PL/PgSQL and how to port apps from one to the other. It also includes my instr functions that mimick Oracle's counterpart (they are handy). Please take a look and send me ([EMAIL PROTECTED]) any suggestions, criticism, etc. I am almost done writing my PL/PgSQL documentation that hopefully will make into the PG doc tree. -Roberto -- Computer ScienceUtah State University Space Dynamics Laboratory Web Developer USU Free Software & GNU/Linux Club http://fslc.usu.edu My home page - http://www.brasileiro.net/roberto
