-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Inconsistent database type name casing in backend code #1036
Comments
The goals of the current setup are as follows:
The first behavior listed is part of the SQL spec, and I strongly recommend we avoid changing it. This is the reason for the "robust" type name mapping. It generates a type map that's case-insensitive. The second behavior is more of a convention. |
I guess a way to satisfy both those goals is to always uppercase type names. That would include:
|
Casing presumptions turned out more ingrained in our code than first thought. Retreated to just uppercasing the endpoint's output, so as to conform with current policy to avoid doing technical debt work where possible. See PR #1176. @kgodey can you help pick an appropriate milestone to move this to? |
@dmos62 I made a new milestone, [v1] Technical Debt. Let's use that one. |
Sorry, I didn't see this earlier. I want to make sure the |
Seems to be resolved, though I'm not certain that all your concerns have been addressed. @mathemancer let's reopen this if we find cause. |
Description
At the moment database type names have inconsistent casing applied in different parts of our code. Namely:
db.types
have lowercase values,db.columns.base.MathesarColumn.plain_type
returns uppercase values,Also, interestingly
db.types.operations.cast::get_robust_supported_alter_column_type_map
uses both lower and upper cases. That's for robustness it seems, but I'm not sure what is causing the variation in inputs' case.To be clear, the problem is that this breaks type identifier equality checks, among other things.
Expected behavior
Ideally, we would have a single source of truth for type IDs and use those everywhere. At a minimum, database type name (which is effectively the type identifier) casing should be consistent, both in terms of what is returned and what is expected.
Additional context
@mathemancer you seem to have authored some of the mentioned code. Could you comment on relevant decisions or provide general insight? I noticed that SA usually uses lowercase type names, but in the case of the methods called in
MathesarColumn.plain_type
it returns uppercase. Is that the sole source of this conflict?The text was updated successfully, but these errors were encountered: