Some code paths dedicated to bytea used the structure for varchar. This
did not lead to any actual bugs, as bytea and varchar have the same
definition, but it could become a trap if one of these definitions
changes for a new feature or a bug fix.
Issue introduced by
050710b.
Author: Shenhao Wang
Reviewed-by: Vignesh C, Michael Paquier
Discussion: https://postgr.es/m/
07ac7dee1efc44f99d7f53a074420177@G08CNEXMBPEKD06.g08.fujitsu.local
Backpatch-through: 12
case ECPGt_bytea:
{
- struct ECPGgeneric_varchar *variable =
- (struct ECPGgeneric_varchar *) (var + offset * act_tuple);
+ struct ECPGgeneric_bytea *variable =
+ (struct ECPGgeneric_bytea *) (var + offset * act_tuple);
long dst_size,
src_size,
dec_size;
else
{
- struct ECPGgeneric_varchar *variable =
- (struct ECPGgeneric_varchar *) (var->value);
+ struct ECPGgeneric_bytea *variable =
+ (struct ECPGgeneric_bytea *) (var->value);
desc_item->is_binary = true;
desc_item->data_len = variable->len;
case ECPGt_bytea:
{
- struct ECPGgeneric_varchar *variable =
- (struct ECPGgeneric_varchar *) (var->value);
+ struct ECPGgeneric_bytea *variable =
+ (struct ECPGgeneric_bytea *) (var->value);
if (!(mallocedval = (char *) ecpg_alloc(variable->len, lineno)))
return false;
if (var->type == ECPGt_bytea)
{
- binary_length = ((struct ECPGgeneric_varchar *) (var->value))->len;
+ binary_length = ((struct ECPGgeneric_bytea *) (var->value))->len;
binary_format = true;
}
}