Re: File access problem access(), stat()

From: vishal saberwal <vishalsaberwal(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: File access problem access(), stat()
Date: 2005-12-13 01:26:30
Message-ID: 3e74dc250512121726g1adf3255wa9f47823d55100c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,
It was a stupid error on my part.
I was declaring the function to return varchar when i was actually returning
integer. Also, i looked at varchar.c which was a great help.
It had a function that shows how to convert varchar to cstring.

Thanks tom,
vish

On 12/12/05, vishal saberwal <vishalsaberwal(at)gmail(dot)com> wrote:
>
> i am sorry for misleading subject line ...
>
> thanks for your tip.
>
> Perhaps fmgr has more in it that i need to understand and study so as to
> convert text/varchar to char* .
>
> thanks,
> vish
>
> On 12/12/05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> > vishal saberwal <vishalsaberwal(at)gmail(dot)com> writes:
> > > xy_db=# create or replace function file_check(varchar) returns varchar
> > as
> > > xy_db-# '/root/resource_test.so','file_check' language 'c';
> > > CREATE FUNCTION
> > > k2_db=# select file_check('/ResourceFS/IconFS/Alarm/My.gif');
> > > server closed the connection unexpectedly
> >
> > This is not a file permissions problem ... more likely, your C function
> > is wrong and is dumping core. Getting out your debugger would be a good
> > response.
> >
> > > char *filecmd = (char*) PG_GETARG_VARCHAR_P(0);
> >
> > However, I can point you in the right direction: you can't just cast a
> > varchar * to char *, they are not remotely the same thing.
> >
> > regards, tom lane
> >
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Benjamin Smith 2005-12-13 02:17:09 Re: Performance woes
Previous Message vishal saberwal 2005-12-13 00:18:45 Re: File access problem access(), stat()