pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Regarding pg_dump utility
11+ messages / 8 participants
[nested] [flat]

* Regarding pg_dump utility
@ 2006-06-08 06:09  soni de <soni.de@gmail.com>
  0 siblings, 2 replies; 11+ messages in thread

From: soni de @ 2006-06-08 06:09 UTC (permalink / raw)
  To: pgsql-performance

Hello,



We have to take a backup of database and we know the pg_dump utility of
postgresql.

But may I know, is there any API for this pg_dump utility so that we can
call it from the C program? Or only script support is possible for this.



I think script support is bit risky because if anything goes wrong while
taking backup using pg_dump then user will not understand the problem of
falling

If only script support is possible then what should we prefer perl or shell?



Please provide me some help regarding this



Thanks,

Soni

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-08 15:06  Tom Lane <tgl@sss.pgh.pa.us>
  parent: soni de <soni.de@gmail.com>
  1 sibling, 1 reply; 11+ messages in thread

From: Tom Lane @ 2006-06-08 15:06 UTC (permalink / raw)
  To: soni de <soni.de@gmail.com>; +Cc: pgsql-performance

"soni de" <soni.de@gmail.com> writes:
> We have to take a backup of database and we know the pg_dump utility of
> postgresql.

> But may I know, is there any API for this pg_dump utility so that we can
> call it from the C program? Or only script support is possible for this.

There's always system(3) ....

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-08 15:16  Jim C. Nasby <jnasby@pervasive.com>
  parent: soni de <soni.de@gmail.com>
  1 sibling, 2 replies; 11+ messages in thread

From: Jim C. Nasby @ 2006-06-08 15:16 UTC (permalink / raw)
  To: soni de <soni.de@gmail.com>; +Cc: pgsql-performance

On Thu, Jun 08, 2006 at 11:39:48AM +0530, soni de wrote:
> We have to take a backup of database and we know the pg_dump utility of
> postgresql.
> 
> But may I know, is there any API for this pg_dump utility so that we can
> call it from the C program? Or only script support is possible for this.
 
It probably wouldn't be terribly difficult to put the guts of pg_dump
into a library that you could interface with via C. I'm not sure if the
community would accept such a patch; though, I seem to recall other
people asking for this on occasion.
 
> I think script support is bit risky because if anything goes wrong while
> taking backup using pg_dump then user will not understand the problem of
> falling
> 
> If only script support is possible then what should we prefer perl or shell?

Depends on what you're trying to accomplish. Perl is a much more capable
language than shell, obviously.
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-08 15:42  Geoffrey <esoteric@3times25.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 11+ messages in thread

From: Geoffrey @ 2006-06-08 15:42 UTC (permalink / raw)
  To: pgsql-performance

Tom Lane wrote:
> "soni de" <soni.de@gmail.com> writes:
>> We have to take a backup of database and we know the pg_dump utility of
>> postgresql.
> 
>> But may I know, is there any API for this pg_dump utility so that we can
>> call it from the C program? Or only script support is possible for this.
> 
> There's always system(3) ....

fork(), exec()...

-- 
Until later, Geoffrey

Any society that would give up a little liberty to gain a little
security will deserve neither and lose both.  - Benjamin Franklin



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-08 16:23  Alvaro Herrera <alvherre@commandprompt.com>
  parent: Jim C. Nasby <jnasby@pervasive.com>
  1 sibling, 2 replies; 11+ messages in thread

From: Alvaro Herrera @ 2006-06-08 16:23 UTC (permalink / raw)
  To: Jim C. Nasby <jnasby@pervasive.com>; +Cc: soni de <soni.de@gmail.com>; pgsql-performance

Jim C. Nasby wrote:
> On Thu, Jun 08, 2006 at 11:39:48AM +0530, soni de wrote:
> > We have to take a backup of database and we know the pg_dump utility of
> > postgresql.
> > 
> > But may I know, is there any API for this pg_dump utility so that we can
> > call it from the C program? Or only script support is possible for this.
>  
> It probably wouldn't be terribly difficult to put the guts of pg_dump
> into a library that you could interface with via C. I'm not sure if the
> community would accept such a patch; though, I seem to recall other
> people asking for this on occasion.

Personally I think it would be neat.  For example the admin-tool guys
would be able to get a dump without invoking an external program.
Second it would really be independent of core releases (other than being
tied to the output format.)  pg_dump would be just a simple caller of
such a library, and anyone else would be able to get dumps easily, in
whatever format.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-08 16:33  Andreas Pflug <pgadmin@pse-consulting.de>
  parent: Alvaro Herrera <alvherre@commandprompt.com>
  1 sibling, 1 reply; 11+ messages in thread

From: Andreas Pflug @ 2006-06-08 16:33 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@commandprompt.com>; +Cc: Jim C. Nasby <jnasby@pervasive.com>; soni de <soni.de@gmail.com>; pgsql-performance

Alvaro Herrera wrote:

> 
> 
> Personally I think it would be neat.  For example the admin-tool guys
> would be able to get a dump without invoking an external program.
> Second it would really be independent of core releases (other than being
> tied to the output format.)  pg_dump would be just a simple caller of
> such a library, and anyone else would be able to get dumps easily, in
> whatever format.

pgAdmin currently invokes pg_dump/restore externally with pipes attached 
to stdin/out/err, but a library implementation would solve some 
headaches (esp. concerning portability) managing background 
execution/GUI updates/process control. I'd like a libpgdumprestore 
library, with pg_dump/pg_restore being lean wrapper programs.

Regards,
Andreas



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-08 16:35  Jim C. Nasby <jnasby@pervasive.com>
  parent: Andreas Pflug <pgadmin@pse-consulting.de>
  0 siblings, 1 reply; 11+ messages in thread

From: Jim C. Nasby @ 2006-06-08 16:35 UTC (permalink / raw)
  To: Andreas Pflug <pgadmin@pse-consulting.de>; +Cc: Alvaro Herrera <alvherre@commandprompt.com>; soni de <soni.de@gmail.com>; pgsql-performance

On Thu, Jun 08, 2006 at 06:33:28PM +0200, Andreas Pflug wrote:
> Alvaro Herrera wrote:
> 
> >
> >
> >Personally I think it would be neat.  For example the admin-tool guys
> >would be able to get a dump without invoking an external program.
> >Second it would really be independent of core releases (other than being
> >tied to the output format.)  pg_dump would be just a simple caller of
> >such a library, and anyone else would be able to get dumps easily, in
> >whatever format.
> 
> pgAdmin currently invokes pg_dump/restore externally with pipes attached 
> to stdin/out/err, but a library implementation would solve some 
> headaches (esp. concerning portability) managing background 
> execution/GUI updates/process control. I'd like a libpgdumprestore 
> library, with pg_dump/pg_restore being lean wrapper programs.

Would a pg_dumpall library also make sense?
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-08 16:38  Alvaro Herrera <alvherre@commandprompt.com>
  parent: Jim C. Nasby <jnasby@pervasive.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Alvaro Herrera @ 2006-06-08 16:38 UTC (permalink / raw)
  To: Jim C. Nasby <jnasby@pervasive.com>; +Cc: Andreas Pflug <pgadmin@pse-consulting.de>; soni de <soni.de@gmail.com>; pgsql-performance

Jim C. Nasby wrote:
> On Thu, Jun 08, 2006 at 06:33:28PM +0200, Andreas Pflug wrote:
> > Alvaro Herrera wrote:
> > 
> > >
> > >
> > >Personally I think it would be neat.  For example the admin-tool guys
> > >would be able to get a dump without invoking an external program.
> > >Second it would really be independent of core releases (other than being
> > >tied to the output format.)  pg_dump would be just a simple caller of
> > >such a library, and anyone else would be able to get dumps easily, in
> > >whatever format.
> > 
> > pgAdmin currently invokes pg_dump/restore externally with pipes attached 
> > to stdin/out/err, but a library implementation would solve some 
> > headaches (esp. concerning portability) managing background 
> > execution/GUI updates/process control. I'd like a libpgdumprestore 
> > library, with pg_dump/pg_restore being lean wrapper programs.
> 
> Would a pg_dumpall library also make sense?

One would think that libpgdump should take care of this as well ...

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-09 01:16  Christopher Kings-Lynne <chris.kings-lynne@calorieking.com>
  parent: Jim C. Nasby <jnasby@pervasive.com>
  1 sibling, 0 replies; 11+ messages in thread

From: Christopher Kings-Lynne @ 2006-06-09 01:16 UTC (permalink / raw)
  To: Jim C. Nasby <jnasby@pervasive.com>; +Cc: soni de <soni.de@gmail.com>; pgsql-performance

> It probably wouldn't be terribly difficult to put the guts of pg_dump
> into a library that you could interface with via C. I'm not sure if the
> community would accept such a patch; though, I seem to recall other
> people asking for this on occasion.
>  
>> I think script support is bit risky because if anything goes wrong while
>> taking backup using pg_dump then user will not understand the problem of
>> falling
>>
>> If only script support is possible then what should we prefer perl or shell?
> 
> Depends on what you're trying to accomplish. Perl is a much more capable
> language than shell, obviously.


In phpPgAdmin we just execute pg_dump as a child process and capture its 
output....




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-09 01:19  Christopher Kings-Lynne <chris.kings-lynne@calorieking.com>
  parent: Alvaro Herrera <alvherre@commandprompt.com>
  1 sibling, 1 reply; 11+ messages in thread

From: Christopher Kings-Lynne @ 2006-06-09 01:19 UTC (permalink / raw)
  To: Jim C. Nasby <jnasby@pervasive.com>; soni de <soni.de@gmail.com>; pgsql-performance

> Personally I think it would be neat.  For example the admin-tool guys
> would be able to get a dump without invoking an external program.
> Second it would really be independent of core releases (other than being
> tied to the output format.)  pg_dump would be just a simple caller of
> such a library, and anyone else would be able to get dumps easily, in
> whatever format.

What about fully completing our SQL API for dumping?

ie. We finish adding pg_get_blahdef() for all objects, add a function 
that returns the proper ordering of all objects in the database, and 
then somehow drop out a dump with a single JOIN :D

Chris




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Regarding pg_dump utility
@ 2006-06-09 14:22  Paul S <plabrh1@gmail.com>
  parent: Christopher Kings-Lynne <chris.kings-lynne@calorieking.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Paul S @ 2006-06-09 14:22 UTC (permalink / raw)
  To: pgsql-performance

I think that having an API for backup functionality would definitely be
useful.

Just my 2 cents...

Paul




On 6/8/06, Christopher Kings-Lynne <chris.kings-lynne@calorieking.com>
wrote:
>
> > Personally I think it would be neat.  For example the admin-tool guys
> > would be able to get a dump without invoking an external program.
> > Second it would really be independent of core releases (other than being
> > tied to the output format.)  pg_dump would be just a simple caller of
> > such a library, and anyone else would be able to get dumps easily, in
> > whatever format.
>
> What about fully completing our SQL API for dumping?
>
> ie. We finish adding pg_get_blahdef() for all objects, add a function
> that returns the proper ordering of all objects in the database, and
> then somehow drop out a dump with a single JOIN :D
>
> Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2006-06-09 14:22 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-06-08 06:09 Regarding pg_dump utility soni de <soni.de@gmail.com>
2006-06-08 15:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-06-08 15:42   ` Geoffrey <esoteric@3times25.net>
2006-06-08 15:16 ` Jim C. Nasby <jnasby@pervasive.com>
2006-06-08 16:23   ` Alvaro Herrera <alvherre@commandprompt.com>
2006-06-08 16:33     ` Andreas Pflug <pgadmin@pse-consulting.de>
2006-06-08 16:35       ` Jim C. Nasby <jnasby@pervasive.com>
2006-06-08 16:38         ` Alvaro Herrera <alvherre@commandprompt.com>
2006-06-09 01:19     ` Christopher Kings-Lynne <chris.kings-lynne@calorieking.com>
2006-06-09 14:22       ` Paul S <plabrh1@gmail.com>
2006-06-09 01:16   ` Christopher Kings-Lynne <chris.kings-lynne@calorieking.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox