-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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 backquoting in dictionary ddl #9734
Conversation
string = string.substr(1, string.size() - 2); | ||
|
||
/// Backqouting will be performed on dictionary providers side | ||
boost::replace_all(string, "\\'", "'"); |
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.
It doesn't look like unescape function, because it does not unescape backslashes.
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.
I struggle to prove that this code is correct.
What kind of escaping do you want to implement? Maybe you can use the function
readStringEscaped
for this purpose?
I'm trying to read part of dictionary Source expression from Field. There may be simple strings like ip-address '127.0.0.1'
or parts of SQL expressions, like 'WHERE x = \'123\''
. Seems like I need readQuotedString
.
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.
Sorry, but
String string = applyVisitor(FieldVisitorToString(), field);
if (string.front() == '\'')
{
String result;
ReadBufferFromString buf(string);
readQuotedString(result, buf);
return result;
}
return string;
it looks bogus. You converting field to string then converting it back.
The value of field already contains unquoted string if it's a string literal.
Just check the type and you're done.
Fix backquoting in dictionary ddl (cherry picked from commit 72ba032)
Fix backquoting in dictionary ddl (cherry picked from commit 72ba032)
Fix backquoting in dictionary ddl (cherry picked from commit 72ba032)
Fix backquoting in dictionary ddl (cherry picked from commit 72ba032)
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix bug in backquoting in external dictionaries DDL. Fixes #9619.