move postgres stuff to own module
First step of a larger refactor. No semantics changed in this PR. All the postgres query stuff moved under /postgres.
First step of a larger refactor. No semantics changed in this PR. All the postgres query stuff moved under /postgres.