I have once set up something like this for an ACS 3.x site that required access to a second Oracle database. I have no clue whether it will help you with Postgres:
Set up another database pool in your AOLserver config file:
ns_section ns/db/pool/bobdata2
ns_param maxidle 1000000000
ns_param maxopen 1000000000
ns_param connections 5
ns_param verbose $debug
ns_param extendedtableinfo true
ns_param logsqlerrors $debug
if { $database == "oracle" } {
ns_param driver ora8
ns_param datasource {}
ns_param user $db_name
ns_param password $db_password
} else {
ns_param driver postgres
ns_param datasource localhost::bobdata2
ns_param user nsadmin
ns_param password ""
}
The trick here is that I needed to exclude this pool from automatic access by the database API. The corresponding setting was in parameters/yourserver.ini so I have no clue where you have to set this in OpenACS 4.x and if you have to set this at all.
[ns/server/yourserver/acs/database]
AvailablePool=pool1
AvailablePool=pool2
AvailablePool=pool3
In the end, you should be able to access the second database with
set db2 [ns_db gethandle bobdata2]