Fix regression test issues till 8.2

Modify regression tests so that it works on pg versions < 9.2
Regression tests work cleanly till 8.2.