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

Add strpos scalar string function. #15624

Closed
surister opened this issue Feb 28, 2024 · 8 comments
Closed

Add strpos scalar string function. #15624

surister opened this issue Feb 28, 2024 · 8 comments

Comments

@surister
Copy link
Contributor

surister commented Feb 28, 2024

Problem Statement

Add strpos(string, substring) -> int function, as it exists in PostgreSQL, see https://www.postgresql.org/docs/current/functions-string.html

Example:
strpos('high', 'ig') -> 2

strpos('abracadabra', 'abra') -> 0

This would improve PostgreSQL and in my use case, Tableau integration.

Possible Solutions

No response

Considered Alternatives

No response

@DHRUV6029
Copy link
Contributor

can i work on this?

@BaurzhanSakhariev
Copy link
Contributor

Sure, assigned it to you

@DHRUV6029
Copy link
Contributor

Hello,
Just a small clarification, in postgresql the index starts from 1 strpos('abracadabra', 'abra') -> 0 will be 1 if you run in postgresql db , output will be 0 if there is no match.

so question is do we want to keep 0 indexed or 1 indexed?

@surister
Copy link
Contributor Author

I'd favor postgres compatibility, but core team should advice

@DHRUV6029
Copy link
Contributor

I am done with the impl , please let me know if we are to follow postgres compatibility or want to go with 0 index?

@BaurzhanSakhariev
Copy link
Contributor

Let's do it PG compatible, 1 based and 0 for no match.
Thanks!

@DHRUV6029
Copy link
Contributor

ok

@matriv
Copy link
Contributor

matriv commented Apr 8, 2024

This has been closed by #15815
Thx again for the contribution @DHRUV6029 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants