Re: [GENERAL] Dynamic loading of C functions

2006-06-22 Thread Martijn van Oosterhout
On Wed, Jun 21, 2006 at 12:03:26PM -0400, Jasbinder Bali wrote: > I've tried everything so that my .so file is recognized but in vein. > Don't know whats going wrong. The easiest may be to attach strace to the backend (strace -p) and then do a "LOAD blah" on the frontend and see what happens. Hav

Re: [GENERAL] Dynamic loading of C functions: Badly stuck

2006-06-21 Thread Tom Lane
"Jasbinder Bali" <[EMAIL PROTECTED]> writes: > I've disabled my SELinux and now postgres is being able to access the shared > library i.e test.so file. > Don't know if thats the right way to do it or not. It's not. Almost certainly, SELinux is keying the rejection off the fact that you have the .

Re: [GENERAL] Dynamic loading of C functions: Badly stuck

2006-06-21 Thread Jasbinder Bali
I've disabled my SELinux and now postgres is being able to access the shared library i.e test.so file.Don't know if thats the right way to do it or not.PS: I'm using Fedora core 2 OSThanks,~Jas On 6/21/06, Joe Conway <[EMAIL PROTECTED]> wrote: Jasbinder Bali wrote:> Now the error is different. It c

Re: [GENERAL] Dynamic loading of C functions: Badly stuck

2006-06-21 Thread Jasbinder Bali
well as of now my postgres is running on a trusted connection that well as of now my postgres is running on a trusted connection that i've specified in pg_hba.conf file. ls -l /usr/include/pgsql/server/test.so shows the following -rw-rw-rw- 1 root root 4620 Jun 21 12:00 /usr/include/pgsql/server/

Re: [GENERAL] Dynamic loading of C functions: Badly stuck

2006-06-21 Thread Joe Conway
Jasbinder Bali wrote: Now the error is different. It cries something on the permissions. ERROR: could not load library "/usr/include/pgsql/server/test.so": /usr/include/pgsql/server/test.so: failed to map segment from shared object: Permission denied Can you comment on this? What does l

Re: [GENERAL] Dynamic loading of C functions: Badly stuck

2006-06-21 Thread Steve Atkins
On Jun 21, 2006, at 9:42 AM, Jasbinder Bali wrote: Hi, I raised this problem yesterday aswell. I'm badly stuck at this point. The problem is as follows: I have a C function that i want to use in my postgres function. I adopt the following steps to do that. --- compile the C file as follows

Re: [GENERAL] Dynamic loading of C functions: Badly stuck

2006-06-21 Thread Jasbinder Bali
Yes, that helped. I was missing that leading '/'Now the error is different. It cries something on the permissions.ERROR:  could not load library "/usr/include/pgsql/server/test.so": /usr/include/pgsql/server/test.so: failed to map segment from shared object: Permission denied Can you comment on thi

Re: [GENERAL] Dynamic loading of C functions: Badly stuck

2006-06-21 Thread Joe Conway
Jasbinder Bali wrote: CREATE FUNCTION command(integer) RETURNS integer AS 'usr/include/pgsql/server/test_func', 'command' LANGUAGE C STRICT; when i try to run this function, always gives me the follwoing error: ERROR: could not access file "usr/include/pgsql/server/test_func": No

[GENERAL] Dynamic loading of C functions: Badly stuck

2006-06-21 Thread Jasbinder Bali
Hi,I raised this problem yesterday aswell. I'm badly stuck at this point.The problem is as follows:I have a C function that i want to use in my postgres function.I adopt the following steps to do that. --- compile the C file as follows gcc -shared -o test_func.so test_func.c test_func.c is

Re: [GENERAL] Dynamic loading of C functions

2006-06-21 Thread Jasbinder Bali
I've tried everything so that my .so file is recognized but in vein.Don't know whats going wrong.~JasOn 6/20/06, Tom Lane < [EMAIL PROTECTED]> wrote:Bill Moran < [EMAIL PROTECTED]> writes:> In response to "Jasbinder Bali" <[EMAIL PROTECTED]>:>> I get the follwing error>> ERROR:  could not access fi

Re: [GENERAL] Dynamic loading of C functions

2006-06-20 Thread Erin Sheldon
Was the object compiled on the same architecture as postgres? Sometimes when one is compiled on a 64-bit, the other on 32-bit, or two wildly different versions of gcc, I have seen this cryptic "No such file or directory". Erin On 6/20/06, Jasbinder Bali <[EMAIL PROTECTED]> wrote: chmod 666 fil

Re: [GENERAL] Dynamic loading of C functions

2006-06-20 Thread Jasbinder Bali
yes, i've named it as .so file. On 6/20/06, Tom Lane <[EMAIL PROTECTED]> wrote: "Jasbinder Bali" <[EMAIL PROTECTED]> writes:>>> /usr/include/pgsql/server/ is exactly the path where test_func object >>> file resides.Hmmm when you say "object file", do you mean it's really named"test_func.o"?If

Re: [GENERAL] Dynamic loading of C functions

2006-06-20 Thread Tom Lane
"Jasbinder Bali" <[EMAIL PROTECTED]> writes: >>> /usr/include/pgsql/server/ is exactly the path where test_func object >>> file resides. Hmmm when you say "object file", do you mean it's really named "test_func.o"? If so, that's both the wrong name and the wrong type of file. Postgres is lo

Re: [GENERAL] Dynamic loading of C functions

2006-06-20 Thread elein
Do you need to specify test_func.so not ...test_func or has that changed? --elein On Tue, Jun 20, 2006 at 05:13:32PM -0400, Jasbinder Bali wrote: > chmod 666 filename is something i've done to give permissions to all.. > still doesn't work. > > > On 6/20/06, Bill Moran <[EMAIL PROTECTED]>

Re: [GENERAL] Dynamic loading of C functions

2006-06-20 Thread Jasbinder Bali
chmod 666 filename is something i've done to give permissions to all.. still doesn't work.  On 6/20/06, Bill Moran <[EMAIL PROTECTED]> wrote: In response to "Jasbinder Bali" <[EMAIL PROTECTED]>: > I've written a function in C, compiled it and trying to use the same> function in one of my postgres f

Re: [GENERAL] Dynamic loading of C functions

2006-06-20 Thread Bill Moran
In response to Tom Lane <[EMAIL PROTECTED]>: > Bill Moran <[EMAIL PROTECTED]> writes: > > In response to "Jasbinder Bali" <[EMAIL PROTECTED]>: > >> I get the follwing error > >> ERROR: could not access file "/usr/include/pgsql/server/test_func": No > >> such > >> file or directory > > > Check t

Re: [GENERAL] Dynamic loading of C functions

2006-06-20 Thread Tom Lane
Bill Moran <[EMAIL PROTECTED]> writes: > In response to "Jasbinder Bali" <[EMAIL PROTECTED]>: >> I get the follwing error >> ERROR: could not access file "/usr/include/pgsql/server/test_func": No such >> file or directory > Check the permissions. Can the Postgres user read the file? The error i

Re: [GENERAL] Dynamic loading of C functions

2006-06-20 Thread Bill Moran
In response to "Jasbinder Bali" <[EMAIL PROTECTED]>: > I've written a function in C, compiled it and trying to use the same > function in one of my postgres functions like this: > > CREATE FUNCTION add_one(integer) RETURNS integer > AS '/usr/include/pgsql/server/test_func, 'add_one' > L

[GENERAL] Dynamic loading of C functions

2006-06-20 Thread Jasbinder Bali
I've written a function in C, compiled it and trying to use the same function in one of my postgres functions like this:CREATE FUNCTION add_one(integer) RETURNS integer AS '/usr/include/pgsql/server/test_func, 'add_one' LANGUAGE C STRICTtest_func is the name of my object file and add_one i

Re: [GENERAL] dynamic loading of c-functions

2005-07-21 Thread Martijn van Oosterhout
On Thu, Jul 21, 2005 at 10:40:21AM -0700, TJ O'Donnell wrote: > It is clear from the manual that c-functions can cause the dynamic loading > of .so's and that subsequent usage in the same database session will use > the already loaded function. But, when the session is done, will the loaded > func

[GENERAL] dynamic loading of c-functions

2005-07-21 Thread TJ O'Donnell
It is clear from the manual that c-functions can cause the dynamic loading of .so's and that subsequent usage in the same database session will use the already loaded function. But, when the session is done, will the loaded function remain in the server for subsequent sessions? When/how does a dyn