Poor error-handling of invalid default values makes it hard for users to add new records #4036
Labels
needs: requirements
The problem is clear and worth solving, but we're not yet sure of the best solution
restricted: maintainers
Only maintainers can resolve this issue
type: enhancement
New feature or request
work: backend
Related to Python, Django, and simple SQL
work: frontend
Related to frontend code in the mathesar_ui directory
Milestone
Interestingly, it's possible for a column's default value to be set to a value which is not actually valid for the column. Consider the following examples:
If these states arise, it will be impossible for users to add new records to the table. The error looks like this:
Reading that error, it's pretty hard to tell why I couldn't add a new Authors record — and how to fix it!
These default value states are possible in PostgreSQL but are pretty weird. While I wouldn't expect to see states like this in a typical production DB, they are all possible states to produce through Mathesar. And the reason I'm reporting this issue at all is that Amanda and I bumped into a state like this during her product onboarding. We were using the internal site and someone else had apparently set the Authors.Website default value to "Website to be determined" — an invalid URI. I didn't realize this until I spent some time troubleshooting it after our call.
One way to approach this problem would be to validate default values when they are set. But I don't think that would actually get us very far towards addressing the problem here. Various forms of validation can be added after the default value is set, subsequently rendering it invalid.
Ideally we'd have some more graceful error handling, alerting the user to the root cause of the error and instructing them on how to fix it.
The text was updated successfully, but these errors were encountered: