Postgresql Index Array Javascript Methods Syntax Error