Re: cant write to file within call handler interface

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sibtay Abbas <sibtay_abbas(at)yahoo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: cant write to file within call handler interface
Date: 2004-12-14 20:50:11
Message-ID: 17442.1103057411@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sibtay Abbas <sibtay_abbas(at)yahoo(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Jowett 2004-12-14 21:07:43 Re: 800RC1 valgrind-detected bug ?
Previous Message Simon Riggs 2004-12-14 20:41:13 Re: bgwriter changes