Re: [GENERAL] Problem Compiling C-functions

From: Mike Mascari <mascarim(at)yahoo(dot)com>
To: Dieter Roessing <diro(at)container(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Problem Compiling C-functions
Date: 1999-07-27 16:41:51
Message-ID: 19990727164151.17232.rocketmail@web105.yahoomail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

--- Dieter Roessing <diro(at)container(dot)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

Browse pgsql-general by date

  From Date Subject
Next Message Gary Hoffman 1999-07-27 18:08:35 Re: [GENERAL] PHP and Postgresql 6.5.1
Previous Message Leon 1999-07-27 14:29:12 Cannot cancel LOCK TABLE