Konstantinos Vassiliadis wrote:
>
> Hi
> I am new to Postgres. I am trying to load a C function in Postgres under
> Red Hat Linux.
> I compile using
> gcc -I$PGROOT -I$PGROOT/include -I$PGROOT/src/include -c phone.c
> to produce the object file 'phone.o'
> Then I link using
> ld -Bdynamic -o phone.so phone.o -lc
> to produce the shared object 'phone.so'.
> (Assuming I am doing things right so far) Then from psql:
>
> => CREATE FUNCTION phone_in(opaque)
> RETURNS phone
> AS '/home/M97/acs/vassilik/protein/phone.so'
> LANGUAGE 'c';
> NOTICE: ProcedureCreate: type 'phone' is not yet defined
> CREATE
>
> Same for the output function, the type itself and a table that uses the
> type.
> Then
> test=> INSERT INTO test_phone VALUES ('01483-827294','0161-2242394');
> PQexec() -- Request was sent to backend, but backend closed the channel
> before responding.
There more than one thing that can go wrong. You are welcome to send me
your c source and sql to create the type. I will check.
> Can somebody help me? Anybody used Postgres under Linux Red Hat before?
That's how is used most often, I think. You could also try to build one
of my own extensions, found at
http://wit.mcs.anl.gov/~selkovjr/
ec-type.tgz is the easiest of these.
Gene