Find String Position in PostgreSQL
You can use the POSITION function to find the position of a string in pg. In your query, you can use the following syntax:
SELECT POSITION('substring' IN 'string');
For example, if you want to find the position of the substring ‘World’ within the string ‘Hello, World!’, you can write it like this:
SELECT POSITION('World' IN 'Hello, World!');
This will return the starting position of the substring ‘World’ in ‘Hello, World!’.