From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | 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 15:48:26 |
Message-ID: | 082aef7f-aee4-e144-f79e-3610ff7b796b@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2023-06-26 Mo 09:45, jian he wrote:
>
>
> On Mon, Jun 26, 2023 at 9:32 PM jian he <jian(dot)universality(at)gmail(dot)com>
> wrote:
> >
> > On Mon, Jun 26, 2023 at 7:50 PM Andrew Dunstan <andrew(at)dunslane(dot)net>
> wrote:
> > >
> > >
> > > 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
> >
> >
> > sorry. It was my mistake.
> >
> > > Node *escontext;
> > > if (!DirectInputFunctionCallSafe(numeric_in, token,
> > > InvalidOid, -1,
> > > escontext,
> > > &numd))
> > > elog(INFO,"something is wrong");
> >
> > I wonder about the implication of just declaring Node *escontext in
> here.
> > In this DirectInputFunctionCallSafe, what does escontext point to.
>
> gcc -Wempty-body will detect my error.
>
> However, gcc -Wextra includes -Wempty-body and -Wuninitializedand
> others.
> i guess in here, the real question in here is how to initializeescontext.
See code for pg_input_error_info and friends for examples.
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2023-06-26 15:51:17 | Re: Clean up JumbleQuery() from query text |
Previous Message | Tomas Vondra | 2023-06-26 15:05:14 | Re: logical decoding and replication of sequences, take 2 |