From e836502d64ba7fc936d8c273125e4ac298773e76 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Tue, 7 Nov 2017 13:49:36 -0500
Subject: [PATCH] Fix unportable usage of <ctype.h> functions.

isdigit(), isspace(), etc are likely to give surprising results if passed a
signed char.  We should always cast the argument to unsigned char to avoid
that.  Error in commit 63d6b97fd, found by buildfarm member gaur.
Back-patch to 9.3, like that commit.
---
 src/interfaces/ecpg/ecpglib/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 090d60277f3..5159c619bbe 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -57,7 +57,7 @@ garbage_left(enum ARRAY_TYPE isarray, char **scan_length, enum COMPAT_MODE compa
 			/* skip invalid characters */
 			do {
 				(*scan_length)++;
-			} while (isdigit(**scan_length));
+			} while (isdigit((unsigned char) **scan_length));
 		}
 
 		if (**scan_length != ' ' && **scan_length != '\0')
-- 
GitLab