diff options
author | Michael Paquier <michael@paquier.xyz> | 2020-07-27 10:28:06 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2020-07-27 10:28:06 +0900 |
commit | e971357961f2bf5bddebb3f68ba8b55954709486 (patch) | |
tree | b0d4d5bd2e4fbbafdecab5d40d3de7d4ff3283ca /src/interfaces/ecpg/ecpglib/execute.c | |
parent | 200f6100a9f9fc71273aeb6aceac4430f3437195 (diff) | |
download | postgresql-e971357961f2bf5bddebb3f68ba8b55954709486.tar.gz postgresql-e971357961f2bf5bddebb3f68ba8b55954709486.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.c | 6 |
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; } } |