Fix flakiness in tests that rely on PostgreSQL database
The set of tests uses a PostgreSQL database instance for implementation verification. The setup uses a PgBouncer in between tests and the database. The tests fail pretty frequently on CI because of the next error: 'pq: canceling statement due to user request'. The thing is that there is no requests to cancel the statement that is failing. As the failing statement is a TRUNCATE operation this change makes an attempt to replace it with the DELETE statement in pair with restarting of the tables sequences if any.
Closes: #3208 (closed)
Edited by Pavlo Strokov