![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I want to dump some rows of a table. I couldn't find a way to give pg_dump a where condition. How can you dump (for restore) with a where-condition? |
#3
| |||
| |||
|
|
Laurenz Albe wrote: You can use COPY (or \copy in psql) to dump the results of an arbitrary SQL query to a file. Personally, I'd... $ psql mydb > CREATE TABLE temp1 (LIKE mytable); > INSERT INTO temp1 SELECT * FROM mytable WHERE myconditions; > \q $ pg_dump --data-only --column-inserts -t temp1 mtdb >out.sql $ psql mydb > DROP TABLE temp1; > \q |
![]() |
| Thread Tools | |
| Display Modes | |
| |