Fwd: Recreate C functions?

Поиск
Список
Период
Сортировка
Искать

Fwd: Recreate C functions?

От:
Elliot Chance <elliotchance@gmail.com>
Дата:
> Hello
> 
> it's maybe offtopic - you use a deprecated API
> 
> better to use V1 interface.

I'll keep that in mind - I'm just playing with the sourse code right now.

Restarting the whole server every time I make one tiny change is not a viable option. Surely theres a way to tell it to refresh or reload while the server it running? I couldn't find anything in the docs about it though.

> 
> Regards
> 
> Pavel Stehule
> 
> 2010/12/14 Elliot Chance :
>> Hi,
>> 
>> I seem to be having trouble recreating C functions, the source:
>> 
>> === test.c ====
>> #include 
>> #include 
>> 
>> 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@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>> 

FAQ