Re: Adding WHERE clause to pg_dump

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: daveg <daveg(at)sonic(dot)net>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, pubaddr5(at)davyandbeth(dot)com
Subject: Re: Adding WHERE clause to pg_dump
Date: 2008-07-25 21:46:04
Message-ID: 1217022364.3894.1040.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Fri, 2008-07-25 at 14:11 -0700, daveg wrote:
> On Fri, Jul 25, 2008 at 08:26:35PM +0100, Simon Riggs wrote:
> >
> > On Fri, 2008-07-25 at 11:46 -0700, Joshua D. Drake wrote:
> > > On Fri, 2008-07-25 at 19:33 +0100, Simon Riggs wrote:
> > > > On Fri, 2008-07-25 at 13:31 -0400, Tom Lane wrote:
> > > > > Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> > > > > > Attached patch implements WHERE clauses for pg_dump.
> > > > >
> > > > > I still have serious reservations about adding such an ugly,
> > > > > non-orthogonal wart to pg_dump. Why is it not appropriate to just
> > > > > do a COPY (SELECT ...) TO STDOUT when you need this?
> > > >
> > > > So you can dump a coherent sample database in one command, not 207.
> > > >
> > > > Every user of PostgreSQL wants a dev/test database. If the database is
> > > > large it isn't practical to take a complete copy. Nor is it practical to
> > > > hand-write a data sampling extraction program and if you do, its usually
> > > > imperfect in many ways.
> > > >
> > > > Adding this feature gives a very fast capability to create sample
> > > > databases, or incremental backups for many cases.
> > >
> > > Not sure I buy this argument. I am all for usability and I would be the
> > > first to shout about the general ridiculousness of pg_dump/all/restore
> > > but in this case I think Tom is right. This feature could easily be done
> > > in a script without harassing pg_dump.
> >
> > You can do it, yes. But it takes a lot longer. If the time to implement
> > was similar, then I would immediately agree "feature available already".
> >
> > pg_dump is not "harassed" by this. What is lost by adding this feature?
>
> This was discussed at the beginning of June on patches, Dave Durham submitted
> a patch to add where clauses via a -w option and then in response to feedback
> to add it to each each table of -t. See discussion here:
>
> http://archives.postgresql.org/pgsql-patches/2008-06/msg00001.php
>
> and final patch here:
>
> http://archives.postgresql.org/pgsql-patches/2008-06/msg00026.php.
>
> We now have two patches on this topic from different submitters with
> different use cases supplied as justification.

Well, that is truly bizarre.

I had no idea about the existence of the other patch. I guess I must
have been busy that week.

This was designed a while back in conjunction with other related
thoughts. I still want an easy way to create a data sample for creating
dev databases from large production systems.

I defer and apologise to the previous submitter, since he got there
first, and apologise again for the noise.

(Cheeky code review: Davy's patch fails if used with -o option, plus I
think it outputs the wrong text into the dump file, AFAICS).

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Davy Durham 2008-07-25 21:46:59 Re: Adding WHERE clause to pg_dump
Previous Message Joshua D. Drake 2008-07-25 21:29:32 Re: Adding WHERE clause to pg_dump