Why doesn't BinaryField use BINARY type?

136 views
Skip to first unread message

Chris Foresman

unread,
Sep 8, 2016, 10:56:15 AM9/8/16
to Django developers (Contributions to Django itself)
I had a need to store an encrypted bytestring, and CharField doesn't work. But BinaryField uses LONGBLOB by default (at least on MySQL). Doesn't it make more sense to have a BinaryField equivalent of CharField, and use LONGBLOB for something analogous to TextField? As far as I can tell, the MySQL documentation definitely considers LONGBLOB/BLOB analogous to TEXT. Not sure the best way to approach an improvement, though; add a BytestringField? Would this be best served as a third-party package, or should it be part of Django proper?

Tim Graham

unread,
Sep 8, 2016, 12:36:03 PM9/8/16
to Django developers (Contributions to Django itself)

Chris Foresman

unread,
Sep 9, 2016, 10:30:25 AM9/9/16
to Django developers (Contributions to Django itself)
That's actually pretty helpful, and sort of gets me closer the what I was proposing. I'm just perplexed why there's no support for the VARBINARY type similar to the VARCHAR used for CharField. Admittedly I've never had call to use this type before, but I just found it surprising that there wasn't a clear analog to CharField for bytestrings.


Reply all
Reply to author
Forward
0 new messages