circle-in-input-format-fix-v2.patch

text/plain

Filename: circle-in-input-format-fix-v2.patch
Type: text/plain
Part: 0
Message: Re: ERROR: invalid input syntax for type circle

Patch

Format: unified
Series: patch v2
File+
src/backend/utils/adt/geo_ops.c 5 3
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index 373784f..c69844e 100644
--- a/src/backend/utils/adt/geo_ops.c
+++ b/src/backend/utils/adt/geo_ops.c
@@ -4503,14 +4503,16 @@ circle_in(PG_FUNCTION_ARGS)
 	s = str;
 	while (isspace((unsigned char) *s))
 		s++;
-	if ((*s == LDELIM_C) || (*s == LDELIM))
+	if (*s == LDELIM_C)
+		depth++, s++;
+	else if (*s == LDELIM)
 	{
-		depth++;
+		/* If there are two left parens, consume the first one */
 		cp = (s + 1);
 		while (isspace((unsigned char) *cp))
 			cp++;
 		if (*cp == LDELIM)
-			s = cp;
+			depth++, s = cp;
 	}
 
 	pair_decode(s, &circle->center.x, &circle->center.y, &s, "circle", str);