Unfortunately to use pgsql in medium trust would require installing the Npgsql.dll into the GAC (Global Assembly Cache) on the server.
Even if you do this there may still be troubles if the version of that dll in the GAC is not the same version that mojoPortal was compiled against. Possibly such errors can be solved by configuration to map assembly versions.
If you have control of the server it would be far easier if you just allow full trust on the site. I do not understand how it could have worked with an older version of mojoPortal, the medium trust issues would be the same.
Hope it helps,