Sql Get String From Charindex Postgresql Create Function