Bash String Functions Substring In Postgresql