Skip to content
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

Handle VARCHAR data type in the backend. #404

Closed
Tracked by #244
kgodey opened this issue Jul 16, 2021 · 2 comments · Fixed by #686
Closed
Tracked by #244

Handle VARCHAR data type in the backend. #404

kgodey opened this issue Jul 16, 2021 · 2 comments · Fixed by #686
Assignees
Labels
ready Ready for implementation type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL

Comments

@kgodey
Copy link
Contributor

kgodey commented Jul 16, 2021

This issue is to ensure that Mathesar can handle the Postgres VARCHAR data type.

As part of this issue, we need to ensure that:

  • Users can use the API to change a column to VARCHAR if it's possible to do so.
  • Users can set and change the n (length) of a given VARCHAR column via a type_options field in the API.
  • Automatic type inference during file import suggests VARCHAR when it makes sense to do so.

Additional Context

@kgodey kgodey added ready Ready for implementation work: backend Related to Python, Django, and simple SQL work: database type: enhancement New feature or request help wanted Community contributors can implement this labels Jul 16, 2021
@kgodey kgodey added this to the 07. Initial Data Types milestone Jul 16, 2021
@mathemancer
Copy link
Contributor

A few details:

  • VARCHAR is essentially the default type for Mathesar at the moment.
    • You can always alter a column type to VARCHAR.
    • If we can't detect any other type (e.g., BOOLEAN), we always fall back to VARCHAR when suggesting types.
  • What remains to do is to let the user set a VARCHAR length. We need to decide how we want to handle arguments to types in general in the API, since this also has implications for setting, e.g., precision of DECIMAL type columns.
  • We should probably either avoid suggesting a length for VARCHAR columns, or suggest a very generous length. Because VARCHAR columns are varying-length (meaning we don't store n bytes for an m-length entry in a VARCHAR(n)-type column, where m < n), I'm skeptical we need to suggest it at all. There isn't really an advantage, unless the user specifically wants to avoid long strings for some reason (e.g., maybe they're worried that a downstream DB won't be able to handle a 5000-character string).

@kgodey
Copy link
Contributor Author

kgodey commented Jul 19, 2021

I don't think we should suggest a length, just support the option if the user wants to set one.

@kgodey kgodey removed the help wanted Community contributors can implement this label Aug 3, 2021
@kgodey kgodey assigned mathemancer and unassigned rootxnet Sep 6, 2021
@mathemancer mathemancer mentioned this issue Sep 29, 2021
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Ready for implementation type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants