\set seed random(1, 1000000000000)
\set i0 pr_perm(0, 3, :seed)
\set i1 pr_perm(1, 3, :seed)
\set i2 pr_perm(2, 3, :seed)
INSERT INTO perm_count AS pc (perm)
  VALUES (:i0 + :i1 * 10 + :i2*100)
  ON CONFLICT (perm) DO UPDATE SET cnt = pc.cnt+1;
