Hi all,
I am trying to create a User-defined function(UDF) which takes filename
as input.. the function reads the file containig sql queries and
executes them in background using libq functions (PGconnectDb, PQexec
etc..).
I was able to sucessfully compile the code and create a shared library.
This is my makefile:top_builddir = ../../..include $(top_builddir)/src/Makefile.global
SERVER_INCLUDES += -I $(shell pg_config --includedir)SERVER_INCLUDES += -I $(shell pg_config --includedir-server)
CFLAGS += -g $(SERVER_INCLUDES)
.SUFFIXES: .so
.c.so: $(CC) $(CFLAGS) -fpic -c $< $(CC) $(CFLAGS) -shared -o $@ $(basename $<).o
But when i tried creating a UDF using 'CREATE OR REPLACE FUNCTION' , i
get the following error:
--> ERROR: Could not load library: .../pgsql/lib/mylib.so : undefined
symbol PGConnectdb
My LD_LIBRARY_PATH is set to point to <...>/pgsql/lib dirctory (which
contains all the libarary files needed...)..
$> ldd mylib.so gives the following output:
libc.so.6 => /lib/tls/libc.so.6/
/lib/ld-linux.so.2
Am i missing something?
Would really appreciate any help in this regard.
Thanks in advance,
Gayathri TK