• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / storage / 47093613656
89%

Build:
DEFAULT BRANCH: master
Ran 03 Dec 2026 11:13AM UTC
Jobs 2
Files 408
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Dec 2026 11:12AM UTC coverage: 88.877% (+0.02%) from 88.857%
47093613656

push

github

web-flow
fix: name savepoints with a per-transaction counter instead of a UUID (#1758)

Fixes #1754.

## Problem

`StoragePgDB` and `PgMetastore` name every savepoint
`storage_pg_query_<uuid>` / `iceberg_pg_transaction_<uuid>`. With
`pg_stat_statements.track_utility = on`, PostgreSQL 15 and 16 keep the
savepoint name in the normalized statement text. Each nested transaction
therefore adds two entries (`SAVEPOINT …` and `RELEASE`/`ROLLBACK TO
SAVEPOINT …`) that never repeat and push application queries out of
`pg_stat_statements` (see #1754 for the numbers from a real project).

## Change

A small shared helper, `nextSavepointName(tnx, prefix)` in
`src/storage/database/savepoint.ts`, returns `<prefix>_1`, `<prefix>_2`,
… from a counter kept per transaction object in a `WeakMap`. Both call
sites in `StoragePgDB` and the one in `PgMetastore` use it, and their
two private UUID helpers are removed.

I used a counter that only goes up, not the nesting depth suggested in
the issue. A depth-based name can be reused while an earlier savepoint
with that name is still open, for example by sibling units that
interleave on one transaction. `RELEASE` and `ROLLBACK TO` then act on
the most recent savepoint with that name, which can be the wrong one. A
counter never repeats inside a transaction, so every name stays unique
there exactly as it was with UUIDs. Only names *across* transactions now
repeat, which is what `pg_stat_statements` needs.

## Measured

Real PostgreSQL with `pg_stat_statements` and `track_utility = on`. I
ran 100 transactions, each with two nested savepoints and their
releases, and counted the savepoint entries in `pg_stat_statements`:

| PostgreSQL | UUID names (current) | counter names (this PR) |
|---|---|---|
| 15 | 400 entries, 1 call each | 4 entries, 100 calls each |
| 16 | grows the same way (name kept in the text) | 4 entries |
| 17 | already normalized to `savepoint $1` | unchanged |

So the fix matters on PostgreSQL 15 and 16. On 17+, the server... (continued)

10466 of 12367 branches covered (84.63%)

Branch coverage included in aggregate %.

10 of 10 new or added lines in 5 files covered. (100.0%)

17987 of 19647 relevant lines covered (91.55%)

1276.85 hits per line

Jobs
ID Job ID Ran Files Coverage
1 rest-pg18 - 47093613656.1 03 Dec 2026 11:19AM UTC 381
68.83
GitHub Action Run
2 unit - 47093613656.2 03 Dec 2026 11:13AM UTC 400
73.13
GitHub Action Run
Source Files on build 47093613656
  • Tree
  • List 408
  • Changed 7
  • Source Changed 4
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #47093613656
  • 90955b8b on github
  • Prev Build on master (#46910103077)
  • Next Build on master (#47351969327)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc