CREATE FUNCTION stress_fn(target_key text)
  RETURNS VOID
  LANGUAGE plpgsql
  VOLATILE
AS $$ 
BEGIN 
  PERFORM 1 AS one FROM "stress" WHERE "stress"."key" = target_key;
  IF FOUND THEN
    RAISE EXCEPTION 'already inserted';
  END IF;

  INSERT INTO "stress" ("key")
    VALUES (target_key);
END;
$$;
