improve pgsql plugin