Fix regression test issues till 8.3

Modify regression tests so that it works on pg versions < 9.2
Regression tests work cleanly till 8.3.
More work is required for 8.2 and 8.1.