开发者

Taking dump of the database without getting specific table records :Postgres

开发者 https://www.devze.com 2023-04-08 10:36 出处:网络
Can any one tell 开发者_JS百科me , How can i take database dump using pg_dump without getting specific table records.If you want a table-wide filter, you can use either --exclude-table=table or --tabl

Can any one tell 开发者_JS百科me , How can i take database dump using pg_dump without getting specific table records.


If you want a table-wide filter, you can use either --exclude-table=table or --table=table to resp. exclude tables or include only the tables you want.

If you want to "filter out" some records, then you have no direct option to do it. My best advice is to:

  1. dump your full database
  2. restore it as another name (so you now have a copy of your original DB)
  3. DELETE the records you wish to get rid of
  4. dump the database

This is of course quite rudimentary, and there might be other solutions suitable to your needs. E.g. dump using plain text format then manually edit the dump to remove the rows.

0

精彩评论

暂无评论...
验证码 换一张
取 消