You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Hello 👋
So we use Goqu all throughout Neosync and I've just run into a little issue with special characters in schemas and tables (I guess columns as well).
Goqu handles special characters pretty well by simply escaping the schema/table in double quotes.
However, where this gets weird is if the schema/table itself contains a double quote.
Something like: user"s_data must be escaped like this: "users""s_data".
CREATETABLE "user""s_data" (id TEXTNOT NULLPRIMARY KEY);
SELECT*from"users""s_data";
You can also do wild things like "myescaped_table", which to be valid SQL, becomes this grotesque statement:
Describe the solution you'd like
I would love if Goqu could handle this for me when using goqu.T.
I'm sure there are a lot of edge cases here, and possibly other characters? But double quotes is the only one I've been actively testing with that breaks when passing it into Goqu. Also unclear if it should even be in Goqu's wheelhouse to do something like this.
This is pretty advanced, but a part of what Neosync is doing is retrieving schema information from the pg_catalog and then using that to do other queries. So in most cases, it comes out of the database like users"s_data, because, well, that is what it is actually named! But it makes for a real bear when trying to actually query the thing.
Describe alternatives you've considered
The main alternative I've considered is imply writing a function that does this for me before passing it into goqu.T
Dialect
postgres
mysql
sqlite3
mssql
I imagine this is an issue with any of the supported dialects that have special characters that allow double quotes.
Additional context
Love this library Doug. Has made handling SQL in Neosync much, much smoother that it would have been otherwise.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Hello 👋
So we use Goqu all throughout Neosync and I've just run into a little issue with special characters in schemas and tables (I guess columns as well).
Goqu handles special characters pretty well by simply escaping the schema/table in double quotes.
However, where this gets weird is if the schema/table itself contains a double quote.
Something like:
user"s_data
must be escaped like this:"users""s_data"
.You can also do wild things like
"myescaped_table"
, which to be valid SQL, becomes this grotesque statement:Describe the solution you'd like
I would love if Goqu could handle this for me when using
goqu.T
.I'm sure there are a lot of edge cases here, and possibly other characters? But double quotes is the only one I've been actively testing with that breaks when passing it into Goqu. Also unclear if it should even be in Goqu's wheelhouse to do something like this.
This is pretty advanced, but a part of what Neosync is doing is retrieving schema information from the pg_catalog and then using that to do other queries. So in most cases, it comes out of the database like
users"s_data
, because, well, that is what it is actually named! But it makes for a real bear when trying to actually query the thing.Describe alternatives you've considered
The main alternative I've considered is imply writing a function that does this for me before passing it into
goqu.T
Dialect
I imagine this is an issue with any of the supported dialects that have special characters that allow double quotes.
Additional context
Love this library Doug. Has made handling SQL in Neosync much, much smoother that it would have been otherwise.
The text was updated successfully, but these errors were encountered: