M
M
mrpsycho2016-07-17 16:23:15
PostgreSQL
mrpsycho, 2016-07-17 16:23:15

Is there a good way to add data from dump to psql database?

given:
dump made by the command: pg_dump -t table db > db.dmp
task:
add data from the dump to an existing table.
question:
what is the best way to do this?
what comes to my mind:
1. edit the header of the dump, and delete all requests to create the database and tables
2. expand the dump into an adjacent table, and run a script that will do a bunch of selects and inserts.
are there any other options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2016-07-17
@mrpsycho

the second one is correct
, I doubt that in Postgre there is no muscle "insert into select * from"
it can still be deployed on the local, COPY to a file, and then COPY from the file,
but usually the problem of adding is in the id and auto-increment field, therefore - only the second option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question