Postgresql range support

@tenderlove will add rest range to this pull request later. But for now you can check and tell if i missed something :) or may be if some improvements can be done.