Fill in the values as shown above.
-------------------------------------------------------------------
vi work/bind-9.4.2-P2/bin/named/main.c:

Three entries have to be made here, type /xx then hit enter, the first you'll see is
/* #include "xxdb.h" */
Underneath that add
#include "pgsqldb.h"
Rerun the xx search and the next line will show
/* xxdb_init(); */
Underneath that add
pgsqldb_init();
Rerun the xx search again and the next line will show
/* xxdb_clear(); */
Underneath that add
pgsqldb_clear();

Save and exit vi, run make then make install, test the installation for database connectivity. Voila. If the build itself fails due to not finding either the pgsql include or lib, double check your edits as shown above. Note I didn't run make clean in the case where you may need to review the above edited files for any troubleshooting.

Configuring zones in named.conf, and postgres server itself falls outside the scope of this document. The basic format of a zone entry that uses pgsql for zone data is:

pgsql defines the sdb database interface type
dbname is the name of the database that holds the zone tables
table is the table name that holds that zones data (one table per zone)
dbhost is the hostname or IP of the pgsql server
dbuser is the database user that has, preferrably, read only access to the database in question
password is the dbusers password

Included in the bind source code in /usr/ports/dns/bind94/work/bind-9.4.2-P2/contrib/sdb/pgsql/ is the source code for aq program called zonetodb, it takes zone files and inputs them into the database for you.

name column holds the hostname, or in-addr.arpa
ttl is time to live
rdtype is the record type, SOA/A/AAAA/PTR/NS/TXT/CNAME etc
rdata is the IP if A/AAAA, fqdn if PTR/NS/MX/CNAME, text string for TXT, and SOA gets special treatment, primary ns fqdn email.address serial_num and 4 various cache and ttl values as shown in a normal bind zone file.

More documentation available in /usr/ports/dns/bind94/work/bind-9.4.2-P2/doc/misc/sdb

I read freebsd-questions listmail, and can be found on IRC on EFNets #freebsdhelp.