Re: [GENERAL] Problem Compiling C-functions - Mailing list pgsql-general

From Mike Mascari
Subject Re: [GENERAL] Problem Compiling C-functions
Date
Msg-id 19990727164151.17232.rocketmail@web105.yahoomail.com
Whole thread Raw
List pgsql-general
--- Dieter Roessing <diro@container.de> wrote:
> hallo,
>
> I'm trying to compile the c-function refint.c in the
> directory
> /usr/src/postgresql-6.5/contrib/spi/refint.c
>
> when I call the compiler with the
> followingarguments:
>
> gcc -I /usr/src/packages/postgresql-6.5/src/include
> -I
> /usr/local/pgsql/include -I
> /usr/src/packages/postgresql-6.5/src/backend/ -o
> refint.o refint.c
>
> I get the following Error Messsages:
>
> /usr/lib/crt1.o: In function `_start':
> /usr/lib/crt1.o(.text+0x5a): undefined reference to
> `main'...
> .... and so on
>
>
> Who can help me. I need the function for the foreign
> key urgent.
>
> thanks. dieter
>
>

Well, there's good news and bad news.  The GOOD news
is that all you should have to do is:

'make'

which should build the shared object module as below
(this is on a linux box, note the -fpic for position
independent code):

gcc -I../../src/include -I../../src/backend   -O2
-Wall -Wmissing-prototypes -O6 -fpic
-I../../src/include   -c refint.c -o refint.o
gcc -shared -o refint.so refint.o
rm -f refint.sql; \
C=`pwd`; \
sed -e "s:_OBJWD_:/usr/local/pgsql/lib/modules:g" \
    -e "s:_DLSUFFIX_:.so:g" < refint.source >
refint.sql

At which point you would then do a 'make install' to
install the shared object. I can't recall if you have
to run the refint.sql script manually as user
postgres:

psql template1 < refint.sql

The BAD news is that refint.so is BROKEN for
cascading updates.  The reason is that once the
TRIGGER actions are parsed and planned, that plan is
saved so that reparsing is unnecessary.  This works
great for DELETE's, but UPDATES will cause the
wrong key to be updated (whatever key was used when
the first UPDATE trigger was fired).

Hope that helps,

Mike Mascari




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


pgsql-general by date:

Previous
From: Leon
Date:
Subject: Cannot cancel LOCK TABLE
Next
From: ghoffman@ucsd.edu (Gary Hoffman)
Date:
Subject: Re: [GENERAL] PHP and Postgresql 6.5.1