Re: Run programs within the bin folder - Mailing list pgsql-general

From Jeff Davis
Subject Re: Run programs within the bin folder
Date
Msg-id 1159999643.18734.50.camel@dogma.v10.wvs
Whole thread Raw
In response to Run programs within the bin folder  ("pd" <petedawn@gmail.com>)
List pgsql-general
On Mon, 2006-10-02 at 22:56 -0700, pd wrote:
> guys,
>
> is there a way to run various programs like (pg_config, pg_restore,
> dropdb etc) from within pgadmin or from within my java code. i mean can
> i perform database administration from within postgres that is without
> using literal commands. so from within my java code i can execute a
> query like select all etc. but can i also execute a query which will
> perform database administration.
>
> i mean when my java code says "select all" it doesnt have psql in front
> of it. so why when i have to backup or do anything else i need to use
> pg_dump and not a general query (which really makes things very
> complicate programmatically).
>

First of all, some administration can be easily performed with queries,
such as CREATE DATABASE, DROP DATABASE, CREATE LANGUAGE, etc.

To work with something like pg_dump, just open a pipe. Generally you
want to output to a file anyway. It would be odd to have something like
a pg_dump api call that dumped information out as a Java string. If
nothing else, you might not be able to store the entire string in
memory, so the interface of unix pipes is much better.

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: now() and time zone
Next
From: Scott Ribe
Date:
Subject: Generating synthetic keys on copy