Add test for pgsql output.

This includes cloning the output, and turned up a couple of bugs with initialising `table_t` as a copy.