aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2020-07-27 10:29:11 +0900
committerMichael Paquier <michael@paquier.xyz>2020-07-27 10:29:11 +0900
commit61a4a3a62a98bb7508a86d00900e80e23ebf2b63 (patch)
tree95fbd0d33677ab67a1d14590d2e2e7ff54c43ca8 /src/interfaces/ecpg/ecpglib/execute.c
parentbdaa84e38932de43fca89b20a5078bf92ea356e4 (diff)
downloadpostgresql-61a4a3a62a98bb7508a86d00900e80e23ebf2b63.tar.gz
postgresql-61a4a3a62a98bb7508a86d00900e80e23ebf2b63.zip
Fix handling of structure for bytea data type in ECPG
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
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 606aff63735..6b40ecd910e 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -825,8 +825,8 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
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;
@@ -1404,7 +1404,7 @@ ecpg_build_params(struct statement *stmt)
if (var->type == ECPGt_bytea)
{
- binary_length = ((struct ECPGgeneric_varchar *) (var->value))->len;
+ binary_length = ((struct ECPGgeneric_bytea *) (var->value))->len;
binary_format = true;
}
}