Search Postgresql Archives

Re: Recreate C functions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/12/14 Elliot Chance <elliotchance@xxxxxxxxx>:
> 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?
>

you need reload library. I don't know, if it is really necessary, but
I restart server when I reinstall (after recompilation) some code.

Regards

Pavel Stehule

> Thanks,
> Elliot
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux