($INBOX_DIR/description missing)  
help / color / mirror / Atom feed
From: Justin Pryzby <[email protected]>
Subject: [PATCH 2/3] fix
Date: Sat, 13 Mar 2021 15:51:29 -0600

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



view thread (70+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH 2/3] fix
  In-Reply-To: <no-message-id-1874043@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox