Upgrade fails with:
Caused by: java.sql.BatchUpdateException: Batch entry 1 UPDATE xwikiattachment_archive SET xwa_archive2 = (SELECT oid FROM (SELECT oid, lowrite(lo_open(oid, 131072), xwikiattachment_archive.xwa_archive) FROM lo_create(0) o(oid)) x) was aborted. Call getNextException to see the cause.
(see attached logs for full stack trace)
How to reproduce:
Do a clean install using the WAR method (unpacked xwiki-enterprise-web-3.5.war to webapps). The only modification I made is to hibernate.cfg.xml (commented out the default database, and uncommented the postgres section) and copied postgresql-9.1-901.jdbc4.jar to WEB-INF/lib. Import xwiki-enterprise-ui-all-3.5.xar.
Stop Tomcat, delete all files from webapps/xwiki. Unpack xwiki-enterprise-web-4.0-rc-1.war to webapps. Copy postgresql-9.1-901.jdbc4.jar to WEB-INF/lib and customized hibernate.cfg.xml again. Start Tomcat again.