task-database-pg + postgresql-dev will do the trick. I compiled PG 7.1 and used the goodies from the Debian package to make my compiled PG behave exactly as if I had it installed the package ("apt-get source postgresql*" is beatiful!).
However, the postgres-pl package, that installs the PL/PgSQL language (upon which OpenACS depends) installs the libraries on /usr/lib/postgresql/lib/plpgsql.so and you have to set your www/doc/sql/postgres.sql file to point to that. Read the comments in the beginning of the file and you'll see what you have to modify.
That's most likely the reason why you are getting server errors. Dump the database, recreate it, modify the postgres.sql file, reload the datamodel, and you should be fine.