handle a ECPG_bytea typo

Started by Wang, Shenhaoover 5 years ago4 messageshackers
Jump to latest
#1Wang, Shenhao
wangsh.fnst@cn.fujitsu.com

Hi, hackers

The source looks like:

case ECPGt_bytea:
{
struct ECPGgeneric_varchar *variable =
(struct ECPGgeneric_varchar *) (var->value);

......
}

I think the developer intend to use struct ECPGgeneric_bytea instead of struct ECPGgeneric_varchar

Is this thoughts right?

I have wrote a patch to fix this typo

Attachments:

0001-Fix-ECPGt_bytea-typo.patchapplication/octet-stream; name=0001-Fix-ECPGt_bytea-typo.patchDownload+7-8
#2vignesh C
vignesh21@gmail.com
In reply to: Wang, Shenhao (#1)
Re: handle a ECPG_bytea typo

On Fri, Jul 24, 2020 at 1:35 PM Wang, Shenhao
<wangsh.fnst@cn.fujitsu.com> wrote:

Hi, hackers

The source looks like:

case ECPGt_bytea:
{
struct ECPGgeneric_varchar *variable =
(struct ECPGgeneric_varchar *) (var->value);

......
}

I think the developer intend to use struct ECPGgeneric_bytea instead of struct ECPGgeneric_varchar

Is this thoughts right?

I have wrote a patch to fix this typo

I felt the changes look correct. The reason it might be working
earlier is because the structure members are the same for both the
data structures ECPGgeneric_bytea & ECPGgeneric_varchar.

Regards,
Vignesh
EnterpriseDB: http://www.enterprisedb.com

#3Michael Paquier
michael@paquier.xyz
In reply to: vignesh C (#2)
Re: handle a ECPG_bytea typo

On Sat, Jul 25, 2020 at 07:22:15AM +0530, vignesh C wrote:

I felt the changes look correct. The reason it might be working
earlier is because the structure members are the same for both the
data structures ECPGgeneric_bytea & ECPGgeneric_varchar.

ECPGset_noind_null() and ECPGis_noind_null() in misc.c show that
ECPGgeneric_bytea is attached to ECPGt_bytea. The two structures may
be the same now, but if a bug fix or a code change involves a change
in the structure definition we could run into problems. So let's fix
and back-patch this change. I am not spotting other areas impacted,
and I'll try to take care at the beginning of next week.
--
Michael

#4Michael Paquier
michael@paquier.xyz
In reply to: Michael Paquier (#3)
Re: handle a ECPG_bytea typo

On Sat, Jul 25, 2020 at 06:17:42PM +0900, Michael Paquier wrote:

ECPGset_noind_null() and ECPGis_noind_null() in misc.c show that
ECPGgeneric_bytea is attached to ECPGt_bytea. The two structures may
be the same now, but if a bug fix or a code change involves a change
in the structure definition we could run into problems. So let's fix
and back-patch this change. I am not spotting other areas impacted,
and I'll try to take care at the beginning of next week.

Okay, fixed as e971357. The issue came from 050710b, so this fix was
only needed in 12~.
--
Michael