supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.
https://supabase.com
MIT License
965 stars 129 forks source link

Using reserved words as column name #432

Open hamishjohnson opened 1 year ago

hamishjohnson commented 1 year ago

This has already been reported and closed elsewhere

https://github.com/supabase/supabase/issues/12539

The solution was to update documentation but I think, if possible, a better solution would be to add this to the runtime error message, as it's not easy or intuitive to find in the documentation, and if it was directly in the error message I would have easily avoided many hours of troubleshooting.

steve-chavez commented 1 year ago

Q: Is your column named "order"?

Regardless of whether we can err(which I'm not opposed to), that could be trouble when using it inside a SQL query. You would have to quote "order" everywhere.

hamishjohnson commented 1 year ago

Yeah, exactly - I was using order. The point of this PR is just that I couldn't understand why for a long time, and the documentation is not clear on it. I think an error message would make this a lot clearer.