From 548157e177c4d8d5fda9881849bfacea6f83b81a Mon Sep 17 00:00:00 2001
From: Mark Rofail <mark.rofail@shahry.app>
Date: Sat, 20 Mar 2021 20:29:24 +0200
Subject: [PATCH v11 3/4] anyarray_anyelement_operators_edits

---
 src/backend/access/gin/ginarrayproc.c | 30 +++------------------------
 1 file changed, 3 insertions(+), 27 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index ca6a972ee3..eb7d13dbba 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -95,10 +95,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 		/* single element is passed, set elems to its pointer */
 		elems = palloc(sizeof(*elems));
 		*elems = PG_GETARG_DATUM(0);
-
 		nulls = palloc(sizeof(*nulls));
 		*nulls = PG_ARGISNULL(0);
-
 		nelems = 1;
 	}
 	else
@@ -142,7 +140,7 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 				*searchMode = GIN_SEARCH_MODE_INCLUDE_EMPTY;
 			break;
 		case GinContainsElemStrategy:
-				*searchMode = GIN_SEARCH_MODE_DEFAULT;
+			*searchMode = GIN_SEARCH_MODE_DEFAULT;
 			break;
 		default:
 			elog(ERROR, "ginqueryarrayextract: unknown strategy number: %d",
@@ -190,6 +188,7 @@ ginarrayconsistent(PG_FUNCTION_ARGS)
 			}
 			break;
 		case GinContainsStrategy:
+		case GinContainsElemStrategy:
 			/* result is not lossy */
 			*recheck = false;
 			/* must have all elements in check[] true, and no nulls */
@@ -228,18 +227,6 @@ ginarrayconsistent(PG_FUNCTION_ARGS)
 				}
 			}
 			break;
-		case GinContainsElemStrategy:
-			/* result is not lossy */
-			*recheck = false;
-
-			res = false;
-			for (i = 0; i < nkeys; i++) {
-				if(!nullFlags[i] && check[i]) {
-					res = true;
-					break;
-				}
-			}
-			break;
 		default:
 			elog(ERROR, "ginarrayconsistent: unknown strategy number: %d",
 				 strategy);
@@ -289,6 +276,7 @@ ginarraytriconsistent(PG_FUNCTION_ARGS)
 			}
 			break;
 		case GinContainsStrategy:
+		case GinContainsElemStrategy:
 			/* must have all elements in check[] true, and no nulls */
 			res = GIN_TRUE;
 			for (i = 0; i < nkeys; i++)
@@ -325,18 +313,6 @@ ginarraytriconsistent(PG_FUNCTION_ARGS)
 				}
 			}
 			break;
-		case GinContainsElemStrategy:
-			res = GIN_FALSE;
-			for (i = 0; i < nkeys; i++) {
-				if(!nullFlags[i] && check[i] == GIN_TRUE) {
-					res = GIN_TRUE;
-					break;
-				}
-				else if (check[i] == GIN_MAYBE) {
-					res = GIN_MAYBE;
-				}
-			}
-			break;
 		default:
 			elog(ERROR, "ginarrayconsistent: unknown strategy number: %d",
 				 strategy);
-- 
2.27.0

