-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support for renaming a view #805
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. |
This might be tangential, but what's our strategy for dealing with database object names (e.g. view names)? Postgres puts constraints on names that might not necessarily make sense for a Mathesar user (right?). We can hide that inconvenience by using a mapping from user-specified-alias to database-object-name. The database-object-name can be automatically generated or chosen by the user. A user-specified-alias can be provided for an inconveniently named database-object whose database-name can't be changed due to something else (maybe outside Mathesar) relying on it. |
Currently, we're using the names that Postgres uses. We considered having the concept of "human readable names" but discarded it for simplicity. I think we can add aliases in the future (post-alpha) if needed. |
Not quite. The traditional SQL constraints on identifiers are still in play, but PostgreSQL has a way to get around them. Any character included in the DB's character set (except the CREATE TABLE "😃😃😃" ("🙃🙃" VARCHAR, "VARCHAR" NUMERIC); is perfectly valid in PostgreSQL (assuming your locale supports UTF-8), and creates a table named 😃😃😃 with two columns:
Note that the quotes are not stored as part of the name; they're just a signal to the input parser that the enclosed string is an identifier. The locale is a bit different, and may be tricky. If the client (e.g., the Mathesar web client) and the DB are on the same Locale, there's no problem. Also, there's no problem if their locales share the same character set (except some potential confusion around sorting). If, however, the web client and the DB don't share a character set, and some non-shared characters are either present in the DB, or input from the client, I expect weird things to happen. In reality, the most common locale for a PostgreSQL installation is using the Relevant pages from the docs:
(In fact, the whole 4th chapter of the PostgreSQL docs is great, and does a good job of explaining many SQL details, and the places where PosgreSQL is different. |
@kgodey relevant to my other comment: By "invalid name", do you just mean a view with the same name as another named object? Or were you thinking of other ways the name could be invalid? I'm assuming based on previous conversations you don't want to restrict users to traditional valid names as per the SQL standard. |
@mathemancer I was thinking about view names either having a name collision or being too long (over 63 bytes). |
Ah, okay. We might consider separating those cases for user feedback in the UI. We can let them know without a call to the DB about the length (or just not let them keep typing), and then the collision could be after they click "save" or "submit" or whatever. Those being the invalid names makes sense, though. |
I updated the issue description with more details about invalid name errors. I'm marking this issue as ready for design and moving to the backlog. |
Closing this issue in favor of #466 |
The Mathesar UI should allow users to rename existing views.
Scenario
The user wants to rename a view. We allow them to enter a new name and rename the view.
Error scenarios:
Additional context
The text was updated successfully, but these errors were encountered: