Re: cant write to file within call handler interface - Mailing list pgsql-hackers

From Tom Lane
Subject Re: cant write to file within call handler interface
Date
Msg-id 17442.1103057411@sss.pgh.pa.us
Whole thread Raw
In response to cant write to file within call handler interface  (Sibtay Abbas <sibtay_abbas@yahoo.com>)
List pgsql-hackers
Sibtay Abbas <sibtay_abbas@yahoo.com> writes:
> i am not able to write to file until the pl call
> handler interface. this is the template which i am
> following

> PG_FUNCTION_INFO_V1(my_call_handler);

> Datum
> my_call_handler(PG_FUNCTION_ARGS)
> {
>     ...my code...

>     int fd = open("filename",O_WRONLY);
>     write(fd,buffer,strlen(buffer) + 1);

Perhaps a little bit of checking for error returns would reveal the
problem.  Other theories are (a) you forgot to close the file so no
write occurred; (b) the file was written but not where you think because
the filename is relative to the backend's working directory.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Mark Wong
Date:
Subject: Re: [Testperf-general] BufferSync and bgwriter
Next
From: Tom Lane
Date:
Subject: Re: possible wierd boolean bug?