Re: Potential issue in ecpg-informix decimal converting functions

From: a(dot)imamov(at)postgrespro(dot)ru
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Potential issue in ecpg-informix decimal converting functions
Date: 2024-02-23 15:03:41
Message-ID: 5c8b1b02d437c0e2ecdcea998ab1b79c@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson писал(а) 2024-02-23 13:44:
>> On 22 Feb 2024, at 17:54, a(dot)imamov(at)postgrespro(dot)ru wrote:
>
>> PGTYPESnumeric_to_int() and PGTYPESnumeric_to_long()
>> functions return only 0 or -1. So ECPG_INFORMIX_NUM_OVERFLOW can never
>> be returned.
>
> Indeed, this looks like an oversight.
>
>> I think dectoint(), dectolong() and PGTYPESnumeric_to_int() functions
>> should be a little bit different like in proposing patch.
>> What do you think?
>
> - Convert a variable to type decimal to an integer.
> + Convert a variable of type decimal to an integer.
> While related, this should be committed and backpatched regardless.
>
> + int errnum = 0;
> Stylistic nit, we typically don't initialize a variable which cannot be
> accessed before being set.
>
> Overall the patch looks sane, please register it for the next
> commitfest to
> make it's not missed.
>
> --
> Daniel Gustafsson

Thank you for feedback,

- Convert a variable to type decimal to an integer.
+ Convert a variable of type decimal to an integer.
I removed this from the patch and proposed to
pgsql-docs(at)lists(dot)postgresql(dot)org

+ int errnum = 0;
fixed

Thank's for advice, the patch will be registered for the next
commitfest.

--
Aidar Imamov

Attachment Content-Type Size
informix_convert_from_decimal.patch text/x-diff 5.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-02-23 15:12:30 Re: Relation bulk write facility
Previous Message Dean Rasheed 2024-02-23 14:52:20 Re: RangeTblEntry.inh vs. RTE_SUBQUERY