Postgres Insert Into Array Javascript Iterations