Peter Korsgaard <jacmet(at)control(dot)auc(dot)dk> writes:
> After I send the ReadyForQuery packet I recieve a Query packet containing
> "select getdatabaseencoding()", which I cannot find information about
> anywhere.
It's just an SQL function in the backend.
> What am I supposed to return in response to this select?
You're supposed to send it to the backend for execution and pass back
the resulting output.
You'll find that libpq (and psql even more so) issue a number of queries
all by themselves after connection startup; just because you don't think
you've done anything doesn't mean that the backend hasn't cycled through
several queries ...
regards, tom lane