construct postgresql array from js array