Re: calling elog possibly causing problem in DirectFunctionCall1

From: "Rajesh Kumar Mallah" <mallah(dot)rajesh(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: calling elog possibly causing problem in DirectFunctionCall1
Date: 2006-12-01 18:58:02
Message-ID: a97c77030612011058q513d02baofb496fd2ea7fa1c6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 12/1/06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "Rajesh Kumar Mallah" <mallah(dot)rajesh(at)gmail(dot)com> 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
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Dunworth 2006-12-01 19:15:34 Problem inserting composite type values
Previous Message Rajesh Kumar Mallah 2006-12-01 17:59:45 Re: calling elog possibly causing problem in DirectFunctionCall1