text: CREATE PROCEDURE transaction_test1()
  LANGUAGE plperl
  AS $$
  foreach my $i (0..9) {
      spi_exec_query("INSERT INTO test1 (a) VALUES ($i)");
      if ($i % 2 == 0) {
          spi_commit();
      } else {
          spi_rollback();
      }
  }
  $$;
  
  CALL transaction_test1();
  