v.21.1New Features

Function position now supports POSITION(needle IN haystack) syntax for SQL compatibility

Function position now supports POSITION(needle IN haystack) synax for SQL compatibility. This closes #18701. ... #18779 (Jianmei Zhang).
The position function now supports the SQL-compatible syntax POSITION(needle IN haystack).

Why it matters

This feature improves SQL compatibility by allowing users to use the standard POSITION(needle IN haystack) syntax to find the position of a substring within a string, making it easier to migrate or write queries following common SQL standards.

How to use it

Use the function in queries as POSITION(needle IN haystack) to find the first occurrence of the substring needle in the string haystack. For example:

SELECT POSITION('abc' IN 'abcdef');