I didn't find much out there on PostgreSQL drivers for Erlang. There's one built into jungerl, and one put out by Erlang Consulting, as far as I can tell. I can't stand CVS, there's no package download, and didn't already have jungerl or its 'pgsql' driver anywhere on my local, so I moved on to the Erlang Consulting 'psql' driver, which had a tarball.
after untarring in ~/dev/erlang/psql-0.1.3, I just typed 'make' and the /ebin folder filled nicely (i.e. my Erlang is working)
So, under the /docs folder, in overview.edoc, it said to modify sys.config (a file usually in $ERL_OTP_ROOT/releases/$VERSION) and add in your connection strings like such:
{psql, [{default, {"192.168.1.101", 5432, "dev", "secret", "sql_test"}},
{pools, [{default, 1}]}]}
I now think this is a bit dated, because the following code gave me a bit of a connection error during startup of the driver.
make_dat_files() ->
ensure_started(psql),
Pid = psql:allocate(),
psql:sql_query(Pid, "select * from accounts;").
Config stuffies seem to have moved into the psql.app file in /ebin, but you don't edit that directly. I found ~/dev/erlang/psql-0.1.3/src/psql.app.src, modified for my specific connection settings, and back at the root of the tarball, typed 'make' again. Now, the psql.app file in /ebin had my connection info and I could go about my business.
I'm still very much a newb, but articles like this one would have saved me an hour on this issue, so enjoy.
So after the most recent 10.5.3 Leopard upgrade, I go to fire up the Erlang REPL and I get "Bus error." Evidently this is somewhat common (as noted in #couchdb IRC channel), so I thought I'd just upgrade to a more recent Erlang.
MacPorts barfs on me, so I decide to clean everything and start over. Now with no trace of erlang, couchdb, or couchdb-devel, I start again.
Hitting the megaco flex errors pisses me off, but I find this nice article that helps. Basically, update flex to 2.5.35 or higher before trying erlang on OS X 5.3. Here's a sample of the errors:
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/ _opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_erlang/work/erlang-R12B-2" && make all " returned error 2
Command output: megaco_flex_scanner_drv.flex:31: unknown error processing section 1
megaco_flex_scanner_drv.flex:31: unknown error processing section 1
megaco_flex_scanner_drv.flex:31: unknown error processing section 1
megaco_flex_scanner_drv.flex:31: unknown error processing section 1
megaco_flex_scanner_drv.flex:31: unknown error processing section 1
megaco_flex_scanner_drv.flex:32: bad character: *
So, given errors surrounding hipe (MacPorts bug, can't find link) I removed it from my install command:
sudo port install erlang -hipe +smp
Cool, now Erlang works. Let's get a new CouchDB from /trunk...
./bootstrap
./configure --with-erlang=/opt/local/lib/erlang/usr/include --prefix=/opt/local
make
sudo make install
Nice. Now I have all of the new reduce hotness.