-
-
Notifications
You must be signed in to change notification settings - Fork 323
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
Support for editing records within a view #456
Comments
@dmos62 @ghislaineguerin @pavish @mathemancer @seancolsen @silentninja This issue has been updated and is ready for review. Please look through it and unassign yourself after you've added any feedback that you might have. |
I thought we were going to start with only supporting views which can be automatically inserted to / updated in the DB. In that case, we need to restrict the scope to only views which are very simple selects from a single table. If we want to do more than that, the implementation will get quite intense, and I suggest we break this into multiple different stories based on different scenarios. See "updatable views" in this page from the docs: https://www.postgresql.org/docs/13/sql-createview.html I really like the idea (you alluded to above) of having a record-editing form that makes it clear to the user that they need to edit an underlying record. As I think of that, it makes sense that even implementation-wise, we could simply avoid directly updating rows in or inserting rows into a view, and just have a flow that lets the user edit all source tables which feed a row. This would simplify the implementation (at least at the lower levels) and also give us more functionality earlier on (i.e., we'd be able to handle much more complicated views with this method right out of the gate). The flow could be something like:
This would be one way to handle the "watched movies" view scenario above. If they always edit data in a view this way, it'll be slightly less convenient for very simple views, but it'll have the advantage that it'll work for many types of views in the same way. Very simple views are likely to quickly run out of usefulness even for pretty easy use cases. |
@kgodey Do we need to consider editing a record from a view that references another view rather than a table and how that would look like? |
@mathemancer Yes, this was my idea. I think we should not worry about supporting inserting or updating into Views directly and instead use this approach.
@ghislaineguerin I think we need to treat columns whose data source is other views as read only. The user can update the data in the original view directly if they would like. |
Views will be read only. |
Mathesar should allow users to edit data in the underlying tables from within a view.
Scenarios
Identifying editable columns
Editing directly represented data
Error scenarios:
Other scenarios:
Editing list formula data
There is special editable behavior for cells generated using some list formulas. Please see the wiki for details.
release_year > 2010
cannot have a new item added to it because we don't have enough information to set therelease_year
when a new item is added.release_year = 2010
can have a new item added to it because we can automatically set therelease_year
to2010
based on the information in the filter.Error scenarios:
Additional Context
Implementation
The text was updated successfully, but these errors were encountered: