Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 882879FA23F for ; Fri, 1 Dec 2006 14:58:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 91894-10 for ; Fri, 1 Dec 2006 14:58:03 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.176]) by postgresql.org (Postfix) with ESMTP id AB96B9FA231 for ; Fri, 1 Dec 2006 14:58:02 -0400 (AST) Received: by py-out-1112.google.com with SMTP id d32so1865575pye for ; Fri, 01 Dec 2006 10:58:02 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=WczPe/jdGjWX8elA9M5e2Pn2Hcd4XL+r9y+jN5CEUJVXY76lamEE3u9pL0/kXkTAmmSZGUFchwEKJwPeRRVxYgncGXpIk45a7rjJUpdQFerxl9Yw48o9677swe+hAhCaIgK43f8p2MSyEd1qYdMnTFbdCKnS94pGJCY/N/8AXxw= Received: by 10.35.96.11 with SMTP id y11mr9283835pyl.1164999482077; Fri, 01 Dec 2006 10:58:02 -0800 (PST) Received: by 10.35.80.10 with HTTP; Fri, 1 Dec 2006 10:58:02 -0800 (PST) Message-ID: Date: Sat, 2 Dec 2006 00:28:02 +0530 From: "Rajesh Kumar Mallah" To: "Tom Lane" Subject: Re: calling elog possibly causing problem in DirectFunctionCall1 Cc: pgsql-sql@postgresql.org In-Reply-To: <628.1164995263@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6674_3348573.1164999482010" References: <628.1164995263@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/13 X-Sequence-Number: 26969 ------=_Part_6674_3348573.1164999482010 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 12/1/06, Tom Lane wrote: > > "Rajesh Kumar Mallah" 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 > ------=_Part_6674_3348573.1164999482010 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

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

------=_Part_6674_3348573.1164999482010--