-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
fix: $ in front of column name causes issue with definition tab #17087
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
@Bhavyawahie is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
@alaister have a look! |
studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ColumnManagement.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Copple <10214025 [email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Bhavyawahie,
Thanks for the PR!
While not recommended, it is supported in postgres to name columns beginning with $
. For example, we also allow columns with spaces in the name. Additionally, this doesn't seem to fix the definitions tab error for people who already have columns named with $
.
With this in mind, could you remove this new validation and fix the bug in the definitions tab? I'm happy to help out with some pointers if it isn't clear where the error might be (I have a feeling it might be in our SQL formatted library 😕)
Thanks!
Thanks for the feedback @alaister. Happy to work as instructed although I feel this validation check is also necessary at this point until the said changes in the definitions tab are proposed/made. The SQL editor also disallows to name/rename column names with |
Postgres (SQL) is doing the validation, which is causing that error to happen in the SQL editor. If you wrap the column name containing the |
Sure, given if you could point me to where the error might be 😅🙏 |
This is However, column names with spaces in them, as shown above, are still broken. Handling quoted identifiers is tricky. Currently, A better(?) approach might look like this:
This should probably fix most parse issues related to table/column names. Unfortunately this doesn't take into account identifiers that contain non-latin characters. Any thoughts @alaister ? |
Hi, Unfortunately, this has got a little stale, so I'm going to go ahead and close it. I think this issue should be solved on the https://github.com/MichaelDBA/pg_get_tabledef side, so maybe you can consider opening up an issue there? Thanks 🙏🏻 |
What kind of change does this PR introduce?
Fixes #17013. The given PR brings about client-side validation on column's
name
field for a given table's definition made using theTable Editor.
What is the current behavior?
The current behavior allows for naming columns of a given table without any validation for special characters
(case in point being column names beginning with'$')
which cause a syntax error with the supabase-meta container running the postgres-meta service.Replicating the error
Error from Postgres-meta container's logs
What is the new behavior?
The changes in validation allow for users to not create a table until the said column name within that table does not begin with a '$'. Additionally, any previously created column names are also validated on any subsequent updation to them.
Table Creation
Table Updation
Accessing Table Definition
This also solves the problem of
Application error
that was earlier caused by column names beginning with '$' on accessing the Table Definition tab inside the Table Editor.