-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abstract base classes high max_length value #1477
Comments
which default was 255? |
Could you please specify which part of the documentation you refer to in this sentence:
especially in regards to which parts lead you to the conclusion that this "could become a problem for MySQL users"? |
Sorry, imprecise wording. Substitute "typically used". 255 is the number I had memorised as (max) safe value for Re: could become a problem: Frst sentence from the "Character fields" section I linked earlier:
We are not setting the fields |
Interesting... how do you change a field you inherited? |
I have done this by redefining (overriding?) the inherited fields in my models. |
Yeah, but isn't this then a new field? It doesn't inherit the attributes of the field you redefined/overwrote (i.e. the |
You're right, it's usually the |
Hmm, I thought a model's |
Oh wait, maybe not. Because of the |
@koeaw I don't get it, in the MySQL documentation you linked (https://dev.mysql.com/doc/refman/8.4/en/char.html) I can't find any information about truncation after 255 characters. I see a confusing limit of "maximum row size" in MySQL but that's not our problem, MySQL users should know that). What am I missing?
|
My statements were primarily based on the linked sections in the Django docs. It's possible they are wrong/ambiguous/not reflective of the MySQL docs (or that I misinterpreted them). |
Maybe you could give us an example code that leads to the problems you see. I tried using the |
I'm not using MySQL (I don't think any of us are?), would def. have included more info if I was experiencing problems because of this myself! I opened the issue based on what I read in the docs; this earlier comment has the chain of events:
Ah, interesting. So this more of a "hack", a way to manipulate the UI side of things only, hmm. Thank you. |
Oke, thanks! Given that we don't even know if there is a problem, I'm closing this |
I noticed the
CharFields
in our abstract base classes provide unusually highmax_length
values of 4096 when I seemed to remember 255 to be the default. Example:apis-core-rdf/apis_core/apis_entities/abc.py
Lines 13 to 16 in 10c524e
According to the Django docs on CharField and Character fields, the value is fine for Postgres, which we use, but could become a problem for MySQL users. (The MySQL docs suggest
VARCHAR
values exceeding the limit are truncated.)AFAIK we don't caution against or rule out using MySQL, so if we want our base classes to be more DB agnostic/inclusive of MySQL, we should probably reduce the
max_lengths
to 255. Alternatively, a general recommendation for Postgres over other databases + stating that we specifically develop with Postgres in mind (for which we could cite the base classes as example) would be helpful.The text was updated successfully, but these errors were encountered: