Re: Where clause in pg_dump: need help

From: Prashanth Adiyodi <Prashantha(at)celltick(dot)com>
To: bricklen <bricklen(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Where clause in pg_dump: need help
Date: 2016-07-08 02:40:56
Message-ID: B54BB2A19D2CA541BABFBFAC6B9C33DCA5E866@Cobra.celltick.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

Thank You Bricklen, Let me check this out,

Basically my requirement is, I have a live Db with certain tables and a backup Db at another location (both on postgressql). I need to take a backup of this live DB every night for the previous day (i.e the backup script running on 07/07/2016 will take the backup of the DB for 06/07/2016). This backup will be then transferred to the backup DB server and will be inserted into that DB. From what I have read pg_dump is the solution (similar to export in oracle), do you think of any other approach to get to this objective, have you come across a script or something that already does this,

Thanks once again for the support,

Prashanth Adiyodi
Technical Account Manager
Skype: prashanth.adiyodi
Mob: +91-9819488395
[celltick]

From: bricklen [mailto:bricklen(at)gmail(dot)com]
Sent: Thursday, July 07, 2016 9:40 PM
To: Prashanth Adiyodi
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] Where clause in pg_dump: need help

On Thu, Jul 7, 2016 at 7:06 AM, Prashanth Adiyodi <Prashantha(at)celltick(dot)com<mailto:Prashantha(at)celltick(dot)com>> wrote:
I am working on a script where I need to take backup of certain tables (or a database) using the “date_trunc('day', NOW() - interval '1 month');” as a where clause.

As others have pointed out, pg_dump doesn't have a facility to apply filters to the dump. However, there is a tool called pg_sample that allows you to export subsets. https://github.com/mla/pg_sample

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message andrew 2016-07-08 02:47:46 BUG #14235: inconsistencies with IS NULL / IS NOT NULL
Previous Message Tom Lane 2016-07-08 02:01:18 Re: BUG #14234: PostgreSQL consuming large amount of memory for persistent connection

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2016-07-08 09:37:09 Re: [BUGS] Where clause in pg_dump: need help
Previous Message Tom Lane 2016-07-08 00:04:32 Re: pasting a lot of commands to psql