to_list does not have a special case for `bytes`
I'm using bytea (16 byte md5 digest) in PostgreSQL as a primary key. Unfortunately to_list
which is used for example by _get_impl
does not have a special case for bytes
and thus get()
complains about "Incorrect number of values in identifier to formulate primary key for query.get(); primary key columns are 'file.id'"
Comments (4)
-
repo owner -
repo owner - changed status to resolved
- Fixed bug in "to_list" conversion where a single bytes object
would be turned into a list of individual characters. This would
impact among other things using the :meth:
.Query.get
method on a primary key that's a bytes object. fixes#3660
→ <<cset 01809bddff5b>>
-
repo owner - Fixed bug in "to_list" conversion where a single bytes object
would be turned into a list of individual characters. This would
impact among other things using the :meth:
.Query.get
method on a primary key that's a bytes object. fixes#3660
(cherry picked from commit 01809bddff5b6e93010eb139aed54526c6e6c058)
→ <<cset c87d0bff3ada>>
- Fixed bug in "to_list" conversion where a single bytes object
would be turned into a list of individual characters. This would
impact among other things using the :meth:
-
reporter Haha, sorry about not including the test case nor linking to source code; I was in a hurry and decided perhaps wrongly that I'd better write this down without a test case and amend later than to forget to report this altogether.
As for someone who comes across this again, for me the workaround was as easy as wrapping the bytes pk in a list:
.get([b'123'])
. - Log in to comment
Hello -
Please include test cases!!! I have no idea what _get_impl() is from reading this and it's not good form to make me grep through my own code to know what you're talking about.
For guidelines on test cases please see http://stackoverflow.com/help/mcve