date_in function - Mailing list pgsql-hackers

From Dragos Manzateanu
Subject date_in function
Date
Msg-id 200204161442.g3GEgh212741@mail.dntis.ro
Whole thread Raw
Responses Re: date_in function  (Dragos Manzateanu <dragon@mail.dntis.ro>)
List pgsql-hackers
I want to change the date from a field in a tuple in a trigger_function

create table example (   my_date datetime   ...
);

int na;
char select[20];

na = SPI_fnumber(trigdata->tg_relation->rd_att, "my_date");
memset(select, 0, sizeof(select));
sprintf(select, "1/1/2002");
newval = DirectFunctionCall1(date_in, CStringGetDatum(select));
rettuple = SPI_modifytuple(trigdata->tg_relation, rettuple, 1, &na, &newval, 
NULL);
if(rettuple == NULL) elog(ERROR, "my_function: %d returned by 
SPI_modifytuple", SPI_result);

when i test that my server goes down. What I missed ?



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Index Scans become Seq Scans after VACUUM ANALYSE
Next
From: Lincoln Yeoh
Date:
Subject: Re: Is this a better MVCC.