Re: dumping data to version control using pg_dump?

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: dumping data to version control using pg_dump?
Date: 2005-11-28 22:35:50
Message-ID: 20051128223550.GF78939@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Closest you'll come is using copy...

psql -c "create temp table ...; copy from temp_table to file"

There has been some discussion about allowing COPY to work from either a
view or an arbitrary SELECT statement; check the -hackers archives.

On Thu, Nov 24, 2005 at 06:21:30PM +1100, Klint Gore wrote:
> Is there any way to get pg_dump to run a statement before dumping?
>
> I'd like to do something like
>
> pg_dump -a -c "create temp table params as select * from params where key=blah;" -d dev_db -t params -f /svn/db/params.blah
> svn commit /svn/db/params.blah
>
> I'd rather avoid doing
> psql -c "create table params_svn as select * from params where key = blah;"
> pg_dump .....
> psql -c "drop table params_svn"
> replace tmptablename realtablename
> svn commit ...
>
> klint.
>
> +---------------------------------------+-----------------+
> : Klint Gore : "Non rhyming :
> : EMail : kg(at)kgb(dot)une(dot)edu(dot)au : slang - the :
> : Snail : A.B.R.I. : possibilities :
> : Mail University of New England : are useless" :
> : Armidale NSW 2351 Australia : L.J.J. :
> : Fax : +61 2 6772 5376 : :
> +---------------------------------------+-----------------+
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-11-28 22:43:33 Re: Set a blank password for a db user
Previous Message Jim C. Nasby 2005-11-28 22:27:40 Re: "invalid page header in block 597621 of relation..."error