Re: Potential issue in ecpg-informix decimal converting functions - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Potential issue in ecpg-informix decimal converting functions
Date
Msg-id 28064113-68CD-4C6E-BB6B-5E70C640F7D7@yesql.se
Whole thread Raw
In response to Potential issue in ecpg-informix decimal converting functions  (a.imamov@postgrespro.ru)
Responses Re: Potential issue in ecpg-informix decimal converting functions
List pgsql-hackers
> On 22 Feb 2024, at 17:54, a.imamov@postgrespro.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




pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Refactor SASL exchange in preparation for OAuth Bearer
Next
From: "Andrey M. Borodin"
Date:
Subject: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock