Currently I am working to convert my py-2 project in py-3 & during this conversion I have faced below kind of error.
Partner.objects.filter(name__iexact = name_kv).count()
When I am running above query in py2 it working perfectly & getting output '0', means getting empty list.
When I am running above query in py3 it showing below kind of error.
django.db.utils.ProgrammingError: function upper(bytea) does not exist
LINE 1: ...alse AND UPPER("partners_partner"."name"::text) = UPPER('\x4...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
I have searched lot online & SO other questions but but not able to find any solution.
I figured out that it must have been python version problem & I am getting above error when my ORM query does not have any records.
Try to convert your variable name_kv to string type using str(name_kv).
Update your query like Partner.objects.filter(name__iexact = str(name_kv)).count().
You are getting error because variable containing byte type data so converting byte data to string type may solve your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With