varbit.patch

text/plain

Filename: varbit.patch
Type: text/plain
Part: 0
Message: bugfix: invalid bit/varbit input causes the log file to be unreadable

Patch

Format: unified
File+
src/backend/utils/adt/varbit.c 4 4
diff --git a/src/backend/utils/adt/varbit.c b/src/backend/utils/adt/varbit.c
index f0c6a44b84..506cc35446 100644
--- a/src/backend/utils/adt/varbit.c
+++ b/src/backend/utils/adt/varbit.c
@@ -230,8 +230,8 @@ bit_in(PG_FUNCTION_ARGS)
 			else if (*sp != '0')
 				ereport(ERROR,
 						(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
-						 errmsg("\"%c\" is not a valid binary digit",
-								*sp)));
+						 errmsg("\"0x%02X\" is not a valid binary digit",
+								(unsigned char)*sp)));
 
 			x >>= 1;
 			if (x == 0)
@@ -531,8 +531,8 @@ varbit_in(PG_FUNCTION_ARGS)
 			else if (*sp != '0')
 				ereport(ERROR,
 						(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
-						 errmsg("\"%c\" is not a valid binary digit",
-								*sp)));
+						 errmsg("\"0x%02X\" is not a valid binary digit",
+								(unsigned char)*sp)));
 
 			x >>= 1;
 			if (x == 0)