promise postgres that I will only ROLLBACK - Mailing list pgsql-general

From Gergely Riskó
Subject promise postgres that I will only ROLLBACK
Date
Msg-id CAMhZOOz-2puuxYA57Bs746wK9VvRoYGx_XaqyzCGybXgpmFm5g@mail.gmail.com
Whole thread Raw
List pgsql-general
Hey,

I have a unit testing framework, where every test is ran in BEGIN..ROLLBACK, to ensure that data created during testing is never persisted.

Now, my question is: is there any way to tell postgres that

"Look, I will never ask you for a COMMIT, therefore you don't have to lock anything for me,
you just have to do a 'snapshot', fake my writes in my view of the world, then destroy all this on rollback".

This way, I would be able to run my many test cases in parallel, without worrying about locks/deadlocks between different testcases.

Something like BEGIN READ ONLY TRANSACTION WITH TEMPORARY WRITES...

I of course researched this a little bit, and I know that there are no out of the box syntax for this, but is there maybe some combinations of options which I can abuse to provide this?

(I can naturally do this on the filesystem with snapshots and LVM, but I would like something in postgres, so it doesn't become a sysadmin nightmare.)

Thank you for your ideas,
Gergely Risko

pgsql-general by date:

Previous
From: Vlad Bokov
Date:
Subject: Partition by hash formula
Next
From: Mariya Rampurawala
Date:
Subject: Wal receiver process listens to physical IP