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

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Satoru Fukushima <satoruf(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How can exe files such as 'pg_dump' be called from stored functions?
Date: 2008-02-08 02:29:29
Message-ID: 47ABBE89.4040009@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> "Satoru Fukushima" <satoruf(at)gmail(dot)com> writes:
>
>> 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.
>>
>
> Are you making any effort at all to check for errors? It's not apparent
> from this code...
>
> The simplest approach to debugging this might be to dump stderr into
> some file, say
>
> system("pg_dump -f /path/to/output/file database_name 2>/tmp/pgdumperrs");
>
> and see what ends up in that file.
>
Like, perhaps, the owner of the PostgreSQL server process having no
permission to write into /path/to/output/file?

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Satoru Fukushima 2008-02-08 03:37:30 Re: How can exe files such as 'pg_dump' be called from stored functions?
Previous Message Tom Lane 2008-02-08 02:16:48 Re: How can exe files such as 'pg_dump' be called from stored functions?