I tracked down the error I'm getting to nsd/dbdrv.c
.
Ns_Set *Ns_DbSelect(Ns_DbHandle *handle, char *sql);
The code execs the sql command on the db handle. I know the sql query is valid and should work. The nsd gets the db handle all right and even releases it if I let it sit for a few minutes.
As far as I can the problem starts after the sql query is executed and when the data is being recieved. Tomorrow I will see how to turn logging on for postgres so I can see what it looks like from that end.