From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Prashanth Adiyodi <Prashantha(at)celltick(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-07 15:08:43 |
Message-ID: | CAKFQuwZ6uaGFMD7rROihYAzgicdVW452PAO==bsvavwa7d80ow@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-general |
On Thu, Jul 7, 2016 at 10:06 AM, Prashanth Adiyodi <Prashantha(at)celltick(dot)com>
wrote:
> Dear Team,
>
>
>
> 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. I have read online that this is achievable with the “t”
> option and I have tried the below command
>
>
>
> pg_dump --table=re_userstatus --data-only --column-inserts -t
> "date_trunc('day', NOW() - interval '1 month')" comp_db > data1.sql
>
>
>
> but this does not work, could you please help with the correct syntax or
> redirect me to any documentation which implements this, I am a newbee to
> Postgres SQL and I need this help from you, my pg_dump version is
>
>
>
> *pg_dump (PostgreSQL) 9.3.4*
>
>
>
There is no provision in pg_dump to add custom where clauses in the manner
you describe. If you need a partial dump of a table you will need to write
a psql script and tell it to do exactly what you want.
The options available to you are documented.
https://www.postgresql.org/docs/9.5/static/app-pgdump.html
You will note that your "--table" and your "-t" are the same...all they do
is select (entire) tables.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Francisco Olarte | 2016-07-07 15:12:41 | Re: Where clause in pg_dump: need help |
Previous Message | ssatyasrinivas | 2016-07-07 15:01:37 | BUG #14233: getting the size if the database failing with permission denied error |
From | Date | Subject | |
---|---|---|---|
Next Message | Francisco Olarte | 2016-07-07 15:12:41 | Re: Where clause in pg_dump: need help |
Previous Message | Prashanth Adiyodi | 2016-07-07 14:06:29 | Where clause in pg_dump: need help |