On Thursday 20 October 2005 23:48, Tom Lane wrote:
> Give us a test case to demonstrate this assertion. It works as expected
> AFAICT.
>
Ok, it has to do with C functions:
#include <postgres.h>
#include <fmgr.h>
#include <sys/time.h>
PG_FUNCTION_INFO_V1(plg_cfie);
Datum
plg_cfie(PG_FUNCTION_ARGS)
{
struct timeval before;
gettimeofday(&before, 0);
elog(NOTICE, "Called cfie %ld.%ld\n",before.tv_sec, before.tv_usec);
PG_RETURN_NULL();
}
/* end-of-plg_cfie */
gcc -fpic -O2 -Wall -c -I /usr/include/pgsql/server/ plg_cfie.c
gcc -shared -o /tmp/plg_cfie.so plg_cfie.o
File test:
CREATE or replace FUNCTION func_display(udps, udps) RETURNS void AS '
a = Time.now
warn sprintf("Called func_display %d.%d", a.tv_sec, a.tv_usec)
' LANGUAGE 'plruby';
create or replace function plg_cfie() returns void as '/tmp/plg_cfie.so'
language c immutable;
CREATE or replace rule update_rule as on update
to udps
do instead (
select func_display(new, old);
select plg_cfie();
);
update udps set ziekenhuis = 'olvg' where rapport = 'T105-00002';
-- end of file test
su postgres -c 'psql palga' <test
CREATE FUNCTION
CREATE FUNCTION
CREATE RULE
NOTICE: Called cfie 1129893542.714536
NOTICE: Called func_display 1129893542.732444
plg_cfie
----------
(1 row)
It's not a plruby issue, I tested with plpgsql (your noti) as well.
Cheers,
Han Holl