From e539eb2f44a01dd4d7ccee71a21c74877fdac37c Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Sun, 7 Nov 1999 12:18:37 +0000
Subject: [PATCH] Fix ecpg quoting bug in 6.5.* release.

---
 src/interfaces/ecpg/lib/ecpglib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c
index aae621fed45..2b9a984c007 100644
--- a/src/interfaces/ecpg/lib/ecpglib.c
+++ b/src/interfaces/ecpg/lib/ecpglib.c
@@ -365,7 +365,7 @@ next_insert(char *text)
 	bool		string = false;
 
 	for (; *ptr != '\0' && (*ptr != '?' || string); ptr++)
-		if (*ptr == '\'')
+		if (*ptr == '\'' && *(ptr-1) != '\\')
 			string = string ? false : true;
 
 	return (*ptr == '\0') ? NULL : ptr;
-- 
2.39.5