-
Notifications
You must be signed in to change notification settings - Fork 29
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
Semi/automatic escaping for reserved words as tables or columns #53
Comments
So my thoughts on this issue:
In the end, I plan to use existing @lihaoyi please let me know if I forgot anything or maybe if you see it differently, otherwise I would like to start with implementation |
Hello folks, here I tried to add support for `schemaName` into `INSERT`, `UPDATE`, `DELETE` and some sub variants of those. I feel 90% confused about most of the stuff I see in the repo so far, but I wanted to start somewhere, so I can gradually get a better understanding of what's going on. Here I implemented a `Table.resolve` function that should make a fully qualified table name + schema if present + apply mapping from config, maybe it can also be used further for #53 I also thought it's a good idea whenever `Table.Base` becomes `String` to be used as a fully qualified name to not do any further processing and mapping of this string Fixes #54 --------- Co-authored-by: nikitaglushchenko <[email protected]>
@lihaoyi nope, in that one custom schema were applied to different query parts, this one is about escaping |
@lihaoyi if the way i describe it should be fixed doesn't contradict any of your ideas for this lib - let me know and i will give it a go |
@NPCRUS I think what you say sounds reasonable. Feel free to open a PR and we can see what others think |
Maybe we could use a blacklist of reserved words, to avoid escaping in the common case? That would minimize the amount of changed SQL |
One thing to note with this workaround because I just hit on it, this works fine for UPDATE public.user SET something = ? WHERE (user.someid = ?) where the first use of |
I have a table called
order
, which is a reserved word in sql. So the query compiles into something like:the desired query(Postgres) would be:
Current workaround is to set explicit schema name on table like this:
override def schemaName: String = "schemaName"
Obviously the same would apply for columns, so we need mechanism to escape column and table names
The text was updated successfully, but these errors were encountered: