How can exe files such as 'pg_dump' be called from stored functions?

From: "Satoru Fukushima" <satoruf(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How can exe files such as 'pg_dump' be called from stored functions?
Date: 2008-02-08 01:43:43
Message-ID: 2209be0b0802071743s3cb1e014jf31fd341d59fc2df@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

Thanks for your attention. I would like to ask a question about how
exe files such as 'pg_dump' can be called from stored functions. For
example, a simple C code like below
--------------------------------------------------------------------------------------------------------------------
int main(int argc, char **argv) {

system("pg_dump -f /path/to/output/file database_name");
return 1;

}
--------------------------------------------------------------------------------------------------------------------

can execute 'pg_dump', which produces an output file. However, when I
made it as a stored function in C, it didn't work. Within the stored
function, I used the exact same 'system' command. The other parts
within the function such as getting input values, calculating, and
returning outputs works and no error is produced. It looks that just
the system("pg_dump"); command is passed without outputting anything.

I also tried to use plperlu language for this, but my results so far
are very similar. When I use it as a stored function,
system("pg_dump") command doesn't seem to do anything.

If some can tell me how exe files such as 'pg_dump' can be called from
stored functions, I would appreciate it. Thanks for your help.

Sam

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Fitzpatrick 2008-02-08 01:59:18 Re: Test text value as interval
Previous Message Tom Lane 2008-02-08 01:21:27 Re: password option in pg_dumpall