psql generate insert command based on select - Mailing list pgsql-general

From Leonardo M. Ramé
Subject psql generate insert command based on select
Date
Msg-id 54381718.3030001@griensu.com
Whole thread Raw
Responses Re: psql generate insert command based on select  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: psql generate insert command based on select  ("vibhor.kumar@enterprisedb.com" <vibhor.kumar@enterprisedb.com>)
List pgsql-general
Hi, today I needed to re-create certain records deleted from a mysql
database, so I restored an old backup, opened a terminal and logged in
to the old database using the "mysql" command line utility, then opened
a new terminal with mysql connected to the production database. Then did
a "select * from table where id=xxx \G;" to display a record, then, on
the other terminal I had to write "insert into table(field1,
field2,...,fieldN) values(...);" for each record.

While doing that I tought of a neat feature that psql could provide,
that is something like "\insert for select * from table where id=xxx;"
this should create the insert command for the requested query.

Is such a thing already present in psql?.

Regards,

--
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: org.postgresql.copy.CopyManager which JDBC version ?
Next
From: Adrian Klaver
Date:
Subject: Re: psql generate insert command based on select