Re: ​function arguments are not PG_FUNCTION_ARGS, how to pass Node *escontext

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ​function arguments are not PG_FUNCTION_ARGS, how to pass Node *escontext
Date: 2023-06-26 11:50:55
Message-ID: 8da2bcd5-323e-ad93-1250-030c383abed7@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2023-06-26 Mo 07:20, jian he wrote:
> static
> Datum return_numeric_datum(char *token)
> {
> Datum numd;
> Node *escontext;
>
> if (!DirectInputFunctionCallSafe(numeric_in, token,
> InvalidOid, -1,
> escontext,
> &numd));
> elog(INFO,"something is wrong");
> return numd;
> }

To start with, the semicolon at the end of that if appears bogus. The
elog is indented to look like it's conditioned by the if but the
semicolon makes it not be.

There are compiler switches in modern gcc at least that help you detect
things like this.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2023-06-26 13:18:59 Re: logical decoding and replication of sequences, take 2
Previous Message jian he 2023-06-26 11:20:00 ​function arguments are not PG_FUNCTION_ARGS, how to pass Node *escontext