date_in function

From: Dragos Manzateanu <dragon(at)mail(dot)dntis(dot)ro>
To: pgsql-hackers(at)postgresql(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: date_in function
Date: 2002-04-17 08:42:19
Message-ID: 200204170836.g3H8ao219753@mail.dntis.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 ?

Not my function is about, but date_in.
Have anybody worked with this function ?
Can somebody give me a sample to use date_in. Thanks.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Darko Prenosil 2002-04-17 09:14:02 plpq
Previous Message Luis Alberto Amigo Navarro 2002-04-17 07:30:08 Re: Index Scans become Seq Scans after VACUUM ANALYSE