Add adapter for postgresql. Fix some of codestyle issues