PgSQL Query objects

Some refactoring and brand new PgSQL Query objects