aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2020-07-27 10:29:08 +0900
committerMichael Paquier <michael@paquier.xyz>2020-07-27 10:29:08 +0900
commited4a9dc9cf69eee06f4e655ef5d175c5efa87dd7 (patch)
tree760855589a12cd4a1251b83aa7484d57f1624b94 /src/interfaces/ecpg/ecpglib/execute.c
parent7f5f2249b27a46a4d91d6be5aff188ca67719fa7 (diff)
downloadpostgresql-ed4a9dc9cf69eee06f4e655ef5d175c5efa87dd7.tar.gz
postgresql-ed4a9dc9cf69eee06f4e655ef5d175c5efa87dd7.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 6961d7c75b4..9d61ae72506 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -822,8 +822,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;
@@ -1401,7 +1401,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;
}
}