Tomas Berndtsson <tomas(at)nocrew(dot)org> writes:
> Since it works in psql, it must be possible for my application to work
> too, but I just can't figure out why it doesn't.
I think it's got to be a bug in your application code.
A bug in libpq is the only other possibility --- but seeing that psql
also uses libpq, I'm inclined to discount that. (You're sure you are
linking the same version of libpq into your app that psql uses,
right?)
regards, tom lane