Skip to content

Commit

Permalink
wip: see if we use multiple savepoints
Browse files Browse the repository at this point in the history
  • Loading branch information
gak committed Jul 23, 2024
1 parent 899be16 commit 7a1a04e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/controller/sql/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func (t *Tx) Tx() pgx.Tx { return t.tx }
func (t *Tx) Begin(ctx context.Context) (*Tx, error) {
savepoint := fmt.Sprintf("savepoint_%d", len(t.savepoints))
t.savepoints = append(t.savepoints, savepoint)
if len(t.savepoints) > 1 {
panic("checking if this is used")
}
_, err := t.tx.Exec(ctx, `SAVEPOINT `+savepoint)
if err != nil {
return nil, err
Expand Down

0 comments on commit 7a1a04e

Please sign in to comment.