From fd31a7d41b84d26f102dabb8b64ebe88e49983ab Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 18 Jan 2019 15:09:20 +0000 Subject: [PATCH] Fixed typecast definition order Didn't notice that the order matter: the last typecaster registered is the effective one so let STRING win over UNICODE and BYTES. --- psycopg/typecast_builtins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psycopg/typecast_builtins.c b/psycopg/typecast_builtins.c index 11e2605c..9d2633d2 100644 --- a/psycopg/typecast_builtins.c +++ b/psycopg/typecast_builtins.c @@ -39,8 +39,8 @@ static typecastObject_initlist typecast_builtins[] = { {"FLOAT", typecast_FLOAT_types, typecast_FLOAT_cast, NULL}, {"DECIMAL", typecast_DECIMAL_types, typecast_DECIMAL_cast, NULL}, {"UNICODE", typecast_STRING_types, typecast_UNICODE_cast, NULL}, - {"STRING", typecast_STRING_types, typecast_STRING_cast, NULL}, {"BYTES", typecast_STRING_types, typecast_BYTES_cast, NULL}, + {"STRING", typecast_STRING_types, typecast_STRING_cast, NULL}, {"BOOLEAN", typecast_BOOLEAN_types, typecast_BOOLEAN_cast, NULL}, {"DATETIME", typecast_DATETIME_types, typecast_DATETIME_cast, NULL}, {"DATETIMETZ", typecast_DATETIMETZ_types, typecast_DATETIMETZ_cast, NULL},