Postgresql Get First Character Javascript Substring Indexof