The appended patch addresses the outstanding issues of the recent guc patch.It makes PGCLIENTENCODING work again and uses bsearch() instead ofiterating over the array of guc variables in guc_get_index().
Joachim