Write PostgreSQL string-manipulation query | Bloomberg