I am working on adding some functionality to pgTAP, in order to detect
unintended data modification side-effects.

The idea is to,
1. store the insert/update counts for all tables in a temporary table,
2. then run the test unit in a subtransaction,
3. then compare the new insert/update counts for all tables,
4. in addition to all the normal tests in the test unit, I will also keep a
lookup table of how many inserts/updates to expect per table for each test

I noticed pg_stat_clear_snapshot() doesn't
affect pg_stat_get_tuples_inserted() within the same transaction.

Is there some other clever way of figuring out how many tuples were
updated/inserted per table by the current transaction?

Alternatively, some way to force the top level transaction system to report
the statistics for the current transaction?

I understand the clear benefits of making sure all the stat functions always
return the same results in the same transaction, this is of course what you
usually want to happen, but in my case I want the ability to override this.

Thankful for any ideas.

Best regards,

Joel Jacobson
Glue Finance

E: jj@gluefinance.com
T: +46 70 360 38 01

Postal address:
Glue Finance AB
Box 549
114 11 Stockholm

Visiting address:
Glue Finance AB
Birger Jarlsgatan 14
114 34 Stockholm

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-general @
postedMay 4, '10 at 4:04p
activeMay 4, '10 at 4:04p

1 user in discussion

Joel Jacobson: 1 post



site design / logo © 2022 Grokbase