-
-
Notifications
You must be signed in to change notification settings - Fork 502
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
Postgres over-escaping ? #715
Comments
Similar issue here:
I get the following SQL generated for postgres
but the expected output is
UPDATE: was able to resolve this by using convention to escape [,],{,} charactes required by SqlKata like this
(note the escaping of the backslash and escaping the special characters) |
We were able to resolve it with custom compiler, like this: public class PostgresCompiler : global::SqlKata.Compilers.PostgresCompiler
{
public PostgresCompiler(bool wrapIdentifiersInQuery)
{
WrapIdentifiersInQuery = wrapIdentifiersInQuery;
}
public bool WrapIdentifiersInQuery { get; }
public override string WrapIdentifiers(string input)
{
return WrapIdentifiersInQuery
? input
.ReplaceIdentifierUnlessEscaped(EscapeCharacter, "{", OpeningIdentifier)
.ReplaceIdentifierUnlessEscaped(EscapeCharacter, "}", ClosingIdentifier)
.ReplaceIdentifierUnlessEscaped(EscapeCharacter, "[", OpeningIdentifier)
.ReplaceIdentifierUnlessEscaped(EscapeCharacter, "]", ClosingIdentifier)
: input;
}
} |
In order to get this sentence using WhereRaw:
I've used this string as raw sentence:
I'm getting this expression (note the replace chars near E '"\n\r"+', '', 'g') )
If you compare results using MSSql and postgresql factory are different on chars "[" and "]".
How can I escape or acomplish the statement: E'[\n\r]+'
Thanks
UPDATE: note the space after "E" on expression => E '"\n\r"+', '', 'g') this is addded qhen symbol "[" is replaced
When I've try to escape the symbols with "" that space continues appearing in consequence SQL does not work
The text was updated successfully, but these errors were encountered: