String Functions In Postgres Sql Syntax For If Statements