Обсуждение: Run programs within the bin folder

Поиск
Список
Период
Сортировка

Run programs within the bin folder

От
"pd"
Дата:
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).

thanks.


Re: Run programs within the bin folder

От
Jeff Davis
Дата:
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