Attached are the files that have been modified from the latest release to ensure it works with PostgreSQL. I strongly doubt this fixes all the problems, it lets you get thru the first couple of screens error free.
Just from looking at the code, it seems that PostgreSQL part of the engine is quite buggy and isn't tested. It seems the best way to resolve this would be to separate PostgreSQL calls from MySQL calls into separate files since it'd be much easier to debug.
ScriptHead