import { Savepoint } from "https://deno.land/x/postgres@v0.17.1/query/transaction.ts";
Releasing a savepoint will remove it's last instance in the transaction
import { Client } from "../client.ts";
const client = new Client();
const transaction = client.createTransaction("transaction");
const savepoint = await transaction.savepoint("n1");
await savepoint.release();
transaction.rollback(savepoint); // Error, can't rollback because the savepoint was released
It will also allow you to set the savepoint to the position it had before the last update
import { Client } from "../client.ts";
const client = new Client();
const transaction = client.createTransaction("transaction");
const savepoint = await transaction.savepoint("n1");
await savepoint.update();
await savepoint.release(); // This drops the update of the last statement
transaction.rollback(savepoint); // Will rollback to the first instance of the savepoint
This function will throw if there are no savepoint instances to drop