Skip to content
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 issues with the locate function call #469

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

slabko
Copy link
Contributor

@slabko slabko commented Feb 12, 2025

Fixes #466:

  • Fixes an issue where the call to the locate function always ignores the start_pos parameter.
  • Fixes an issue where the call to the locate function results in an error when start_pos is not specified.

Additionally:

- Fixes an issue where the call to the locate function always ignores
  the `start_pos` parameter.
- Fixes an issue where the call to the locate function results in an
  error when `start_pos` is not specified.
- Ensures that the order of arguments remains unchanged during escape
  sequence replacement. To achieve this, ClickHouse's `position`
  function has been replaced with ClickHouse's `locate` function,
  which has the same argument order as the ODBC `locate` function.
@mshustov mshustov requested a review from slvrtrn February 12, 2025 12:16
// match the type required by `locate`. To avoid the illegal type argument
// error, we cast the offset parameter to UInt64. The `accurateCast` function
// ensures that the parameter value is never negative.
result = "locate(" + needle + "," + haystack + ",accurateCast(" + offset + ",'UInt64'))";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL accurateCast

@slabko slabko merged commit 53694e6 into ClickHouse:master Feb 12, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants