Rework psql support