Re: calling elog possibly causing problem in DirectFunctionCall1 - Mailing list pgsql-sql

From Rajesh Kumar Mallah
Subject Re: calling elog possibly causing problem in DirectFunctionCall1
Date
Msg-id [email protected]
Whole thread Raw
In response to Re: calling elog possibly causing problem in DirectFunctionCall1  (Tom Lane <[email protected]>)
List pgsql-sql


On 12/1/06, Tom Lane <[email protected]> wrote:
"Rajesh Kumar Mallah" <[email protected]> writes:
>   data->time_stamp =
>     DirectFunctionCall1(timestamptz_in, CStringGetDatum("now"));

This code is incorrect, as timestamptz_in takes three arguments.

replaced it with:

data->time_stamp = DirectFunctionCall3(timestamptz_in,
                CStringGetDatum("now"),
                ObjectIdGetDatum(InvalidOid),
                Int32GetDatum(-1))

now it works fine. (code lifted from contrib/spi/moddatetime.c(line 73)
hopefully its correct.

                        regards, tom lane

pgsql-sql by date:

Previous
From: "Rajesh Kumar Mallah"
Date:
Subject: Re: calling elog possibly causing problem in DirectFunctionCall1
Next
From: Chris Dunworth
Date:
Subject: Problem inserting composite type values