Lists: | pgsql-patches |
---|
From: | Seth Robertson <in-postgres(at)baka(dot)org> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | pg_dump feature patch to allow selection of rows to dump via where |
Date: | 2005-09-10 02:31:40 |
Message-ID: | 200509100231.j8A2VeEL020435@not.baka.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
In order to support some automation, I needed the ability to pull out
subsets of postgres tables in a format which could be loaded into
other postgres databases. Instead of writing a utility to replicate
the functionality in pg_dump, I created a new flag, --where, which
allows you to postpend where (or order or limit or whatever) sql
fragments at the end of the select done by pg_dump.
You must use the --insert option with this so that it will generate
inserts (which is done via select) instead of copy (which is done via
copy).
You almost certain will need to also use the --table option since most
likely the sql fragment will only be valid for one table instead of
all tables.
I find it very useful and hope you do to. This patch was created with
7.x postgresql, but if it doesn't apply cleanly against 8.x, I can
probably update it for you.
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 3.8 KB |
From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | Seth Robertson <in-postgres(at)baka(dot)org> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: pg_dump feature patch to allow selection of rows to |
Date: | 2005-09-12 18:29:19 |
Message-ID: | 4325C8FF.3000301@samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Seth Robertson wrote:
> In order to support some automation, I needed the ability to pull out
> subsets of postgres tables in a format which could be loaded into
> other postgres databases.
One alternative would be using CREATE TABLE AS to create a separate
table containing the desired subset, and then using pg_dump to dump that
table.
> Instead of writing a utility to replicate the functionality in
> pg_dump, I created a new flag, --where, which allows you to postpend
> where (or order or limit or whatever) sql fragments at the end of the
> select done by pg_dump.
Neat, but IMHO too much of a kludge for mainline.
-Neil
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Neil Conway <neilc(at)samurai(dot)com> |
Cc: | Seth Robertson <in-postgres(at)baka(dot)org>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: pg_dump feature patch to allow selection of rows to |
Date: | 2005-09-12 20:02:21 |
Message-ID: | 24206.1126555341@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Neil Conway <neilc(at)samurai(dot)com> writes:
> Seth Robertson wrote:
>> Instead of writing a utility to replicate the functionality in
>> pg_dump, I created a new flag, --where, which allows you to postpend
>> where (or order or limit or whatever) sql fragments at the end of the
>> select done by pg_dump.
> Neat, but IMHO too much of a kludge for mainline.
Yeah, I felt the same --- the fact that it doesn't work for the normal
COPY case renders it a bit too ugly.
regards, tom lane