Skip to content

Commit a3c9363

Browse files
committed
Replace ODBC LOCATE function with CH position
The order of parameters in `locate` can be configured, which might cause problems in environments with non-default settings. `position` always work the same in that sense.
1 parent 80f2262 commit a3c9363

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

driver/escaping/escape_sequences.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ string processFunction(const StringView seq, Lexer & lex) {
332332
// ClickHouse requires `start_pos` to be an unsigned integer,
333333
// whereas ODBC clients map it as a signed integer. This results in
334334
// a named parameter such as `{odbc_positional_:Int32}`, which does not
335-
// match the type required by `locate`. To avoid the illegal type argument
335+
// match the type required by `position`. To avoid the illegal type argument
336336
// error, we cast the offset parameter to UInt64. The `accurateCast` function
337337
// ensures that the parameter value is never negative.
338-
std::string result = "locate(" + needle + "," + haystack + ",accurateCast(" + offset + ",'UInt64'))";
338+
std::string result = "position(" + haystack + "," + needle + ",accurateCast(" + offset + ",'UInt64'))";
339339

340340
return result;
341341

0 commit comments

Comments
 (0)