import { Savepoint } from "https://deno.land/x/postgres@v0.19.2/mod.ts";
Releasing a savepoint will remove it's last instance in the transaction
import { Client } from "https://deno.land/x/postgres/mod.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 "https://deno.land/x/postgres/mod.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