pull down to refresh

It's more complicated than just unpaid items or deletions. Rollbacks after inserts also leave "holes" in sequences.
Because smallserial, serial and bigserial are implemented using sequences, there may be "holes" or gaps in the sequence of values which appears in the column, even if no rows are ever deleted. A value allocated from the sequence is still "used up" even if a row containing that value is never successfully inserted into the table column. This may happen, for example, if the inserting transaction rolls back.
Afaik the best we can say about sequences is that they're monotonically increasing (if NO CYCLE is used (which is the default)).
The id is not the item count. It's a rough overestimate of the item count.
You could just make a temporary buffer (new table) until the item paid.
reply
40 sats \ 4 replies \ @k00b 22h
100% not worth it.
reply
I bet that's a pain in the ass. Any way to know the real number of paid items right now?
reply
30 sats \ 2 replies \ @k00b 22h
SQL's count.
reply
No doubt you can do it. I was just asking the pleb stacker!
reply
Write a script to check each item number