diff -cpr head/src/backend/utils/adt/bool.c boolin_accepts_onoff/src/backend/utils/adt/bool.c
*** head/src/backend/utils/adt/bool.c	Mon Jan  5 00:22:25 2009
--- boolin_accepts_onoff/src/backend/utils/adt/bool.c	Tue Feb 17 15:06:03 2009
***************
*** 20,25 ****
--- 20,28 ----
  #include "libpq/pqformat.h"
  #include "utils/builtins.h"
  
+ /* FIXME: Should include guc.h or move the prototype to another place? */
+ extern bool parse_bool_with_len(const char *value, size_t len, bool *result);
+ 
  /*****************************************************************************
   *	 USER I/O ROUTINES														 *
   *****************************************************************************/
***************
*** 27,34 ****
  /*
   *		boolin			- converts "t" or "f" to 1 or 0
   *
!  * Check explicitly for "true/false" and TRUE/FALSE, 1/0, YES/NO.
!  * Reject other values. - thomas 1997-10-05
   *
   * In the switch statement, check the most-used possibilities first.
   */
--- 30,37 ----
  /*
   *		boolin			- converts "t" or "f" to 1 or 0
   *
!  * Check explicitly for "true/false" and TRUE/FALSE, 1/0, YES/NO, ON/OFF.
!  * Reject other values.
   *
   * In the switch statement, check the most-used possibilities first.
   */
*************** boolin(PG_FUNCTION_ARGS)
*** 38,43 ****
--- 41,47 ----
  	const char *in_str = PG_GETARG_CSTRING(0);
  	const char *str;
  	size_t		len;
+ 	bool		result;
  
  	/*
  	 * Skip leading and trailing whitespace
*************** boolin(PG_FUNCTION_ARGS)
*** 50,94 ****
  	while (len > 0 && isspace((unsigned char) str[len - 1]))
  		len--;
  
! 	switch (*str)
! 	{
! 		case 't':
! 		case 'T':
! 			if (pg_strncasecmp(str, "true", len) == 0)
! 				PG_RETURN_BOOL(true);
! 			break;
! 
! 		case 'f':
! 		case 'F':
! 			if (pg_strncasecmp(str, "false", len) == 0)
! 				PG_RETURN_BOOL(false);
! 			break;
! 
! 		case 'y':
! 		case 'Y':
! 			if (pg_strncasecmp(str, "yes", len) == 0)
! 				PG_RETURN_BOOL(true);
! 			break;
! 
! 		case '1':
! 			if (pg_strncasecmp(str, "1", len) == 0)
! 				PG_RETURN_BOOL(true);
! 			break;
! 
! 		case 'n':
! 		case 'N':
! 			if (pg_strncasecmp(str, "no", len) == 0)
! 				PG_RETURN_BOOL(false);
! 			break;
! 
! 		case '0':
! 			if (pg_strncasecmp(str, "0", len) == 0)
! 				PG_RETURN_BOOL(false);
! 			break;
! 
! 		default:
! 			break;
! 	}
  
  	ereport(ERROR,
  			(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
--- 54,61 ----
  	while (len > 0 && isspace((unsigned char) str[len - 1]))
  		len--;
  
! 	if (parse_bool_with_len(str, len, &result))
! 		PG_RETURN_BOOL(result);
  
  	ereport(ERROR,
  			(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
diff -cpr head/src/backend/utils/misc/guc.c boolin_accepts_onoff/src/backend/utils/misc/guc.c
*** head/src/backend/utils/misc/guc.c	Thu Jan 22 09:48:53 2009
--- boolin_accepts_onoff/src/backend/utils/misc/guc.c	Tue Feb 17 15:06:03 2009
*************** ReportGUCOption(struct config_generic * 
*** 4096,4159 ****
  bool
  parse_bool(const char *value, bool *result)
  {
! 	size_t		len = strlen(value);
  
! 	if (pg_strncasecmp(value, "true", len) == 0)
! 	{
! 		if (result)
! 			*result = true;
! 	}
! 	else if (pg_strncasecmp(value, "false", len) == 0)
! 	{
! 		if (result)
! 			*result = false;
! 	}
  
! 	else if (pg_strncasecmp(value, "yes", len) == 0)
! 	{
! 		if (result)
! 			*result = true;
! 	}
! 	else if (pg_strncasecmp(value, "no", len) == 0)
! 	{
! 		if (result)
! 			*result = false;
! 	}
  
! 	/* 'o' is not unique enough */
! 	else if (pg_strncasecmp(value, "on", (len > 2 ? len : 2)) == 0)
  	{
! 		if (result)
! 			*result = true;
! 	}
! 	else if (pg_strncasecmp(value, "off", (len > 2 ? len : 2)) == 0)
! 	{
! 		if (result)
! 			*result = false;
! 	}
  
! 	else if (pg_strcasecmp(value, "1") == 0)
! 	{
! 		if (result)
! 			*result = true;
! 	}
! 	else if (pg_strcasecmp(value, "0") == 0)
! 	{
! 		if (result)
! 			*result = false;
  	}
  
! 	else
! 	{
! 		if (result)
! 			*result = false;	/* suppress compiler warning */
! 		return false;
! 	}
! 	return true;
  }
  
- 
- 
  /*
   * Try to parse value as an integer.  The accepted formats are the
   * usual decimal, octal, or hexadecimal formats, optionally followed by
--- 4096,4187 ----
  bool
  parse_bool(const char *value, bool *result)
  {
! 	bool	ok;
! 	bool	r;
  
! 	ok = parse_bool_with_len(value, strlen(value), &r);
! 	if (result)
! 		*result = r;
! 	return ok;
! }
  
! bool
! parse_bool_with_len(const char *value, size_t len, bool *result)
! {
! 	AssertArg(value != NULL);
! 	AssertArg(result != NULL);
  
! 	switch (*value)
  	{
! 		case 't':
! 		case 'T':
! 			if (pg_strncasecmp(value, "true", len) == 0)
! 			{
! 				*result = true;
! 				return true;
! 			}
! 			break;
! 		case 'f':
! 		case 'F':
! 			if (pg_strncasecmp(value, "false", len) == 0)
! 			{
! 				*result = false;
! 				return true;
! 			}
! 			break;
! 		case 'y':
! 		case 'Y':
! 			if (pg_strncasecmp(value, "yes", len) == 0)
! 			{
! 				*result = true;
! 				return true;
! 			}
! 			break;
! 		case 'n':
! 		case 'N':
! 			if (pg_strncasecmp(value, "no", len) == 0)
! 			{
! 				*result = false;
! 				return true;
! 			}
! 			break;
! 		case 'o':
! 		case 'O':
! 			/* 'o' is not unique enough */
! 			if (pg_strncasecmp(value, "on", (len > 2 ? len : 2)) == 0)
! 			{
! 				*result = true;
! 				return true;
! 			}
! 			else if (pg_strncasecmp(value, "off", (len > 2 ? len : 2)) == 0)
! 			{
! 				*result = false;
! 				return true;
! 			}
! 			break;
! 		case '1':
! 			if (pg_strncasecmp(value, "1", len) == 0)
! 			{
! 				*result = true;
! 				return true;
! 			}
! 			break;
! 		case '0':
! 			if (pg_strncasecmp(value, "0", len) == 0)
! 			{
! 				*result = false;
! 				return true;
! 			}
! 			break;
  
! 		default:
! 			break;
  	}
  
! 	*result = false;	/* suppress compiler warning */
! 	return false;
  }
  
  /*
   * Try to parse value as an integer.  The accepted formats are the
   * usual decimal, octal, or hexadecimal formats, optionally followed by
diff -cpr head/src/include/utils/guc.h boolin_accepts_onoff/src/include/utils/guc.h
*** head/src/include/utils/guc.h	Mon Jan  5 00:22:25 2009
--- boolin_accepts_onoff/src/include/utils/guc.h	Tue Feb 17 15:06:03 2009
*************** extern void AtEOXact_GUC(bool isCommit, 
*** 258,263 ****
--- 258,264 ----
  extern void BeginReportingGUCOptions(void);
  extern void ParseLongOption(const char *string, char **name, char **value);
  extern bool parse_bool(const char *value, bool *result);
+ extern bool parse_bool_with_len(const char *value, size_t len, bool *result);
  extern bool parse_int(const char *value, int *result, int flags,
  					  const char **hintmsg);
  extern bool parse_real(const char *value, double *result);