Re: Recreate C functions?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Elliot Chance <elliotchance(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Recreate C functions?
Date: 2010-12-14 08:52:14
Message-ID: AANLkTi=TEFG4Uf1URyJzbXFvz2tUSd6VSHF_e4nOB9dE@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

it's maybe offtopic - you use a deprecated API

better to use V1 interface.

Regards

Pavel Stehule

2010/12/14 Elliot Chance <elliotchance(at)gmail(dot)com>:
> Hi,
>
> I seem to be having trouble recreating C functions, the source:
>
> === test.c ====
> #include <postgres.h>
> #include <fmgr.h>
>
> PG_MODULE_MAGIC;
>
> int32 plpgsql_test(text* s) {
>    return 100;
> }
> === end ===
>
> Then compile:
> $ cc -fpic -c -I/usr/include/pgsql/server test.c
> $ ld -shared -o funcs.so test.o
>
> Then create the function:
> CREATE FUNCTION plpgsql_test(text) RETURNS integer
>     AS '/storage/Scripts/plpgsql/funcs', 'plpgsql_test'
>     LANGUAGE C STRICT IMMUTABLE;
>
> So far it works:
>> select plpgsql_test('abc');
> 100
>
> The problem is if I change test.c like:
> return 200;
>
> Then recompile, drop and create the function it still returns 100? However if I compile it as funcs2.so it will then create the function with the correct 200 result ... what am I doing wrong?
>
> Thanks,
> Elliot
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Elliot Chance 2010-12-14 09:01:26 Fwd: Recreate C functions?
Previous Message Pavel Stehule 2010-12-14 08:49:55 Re: Recreate C functions?