From 4c91723d35b8ba6673dbcf33c15034b8c309a8ba Mon Sep 17 00:00:00 2001
From: "Thomas G. Lockhart" <lockhart@fourpalms.org>
Date: Sun, 16 Aug 1998 05:37:04 +0000
Subject: [PATCH] Check for null pointer returned from get_opname(). Don't
 bother checking for alternate strategies if so  since it was more likely a
 function or some other non-operator anyway.

---
 src/backend/optimizer/path/indxpath.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 41583a1c1c6..f8fe91ed875 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.29 1998/08/14 16:13:07 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.30 1998/08/16 05:37:04 thomas Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -642,7 +642,10 @@ match_clause_to_indexkey(RelOptInfo *rel,
 					Operator  newop;
 
 					opname = get_opname(restrict_op);
-					newop = oper(opname, ltype, ltype, TRUE);
+					if (opname != NULL)
+						newop = oper(opname, ltype, ltype, TRUE);
+					else
+						newop = NULL;
 
 					/* actually have a different operator to try? */
 					if (HeapTupleIsValid(newop) && (oprid(newop) != restrict_op))
@@ -698,7 +701,10 @@ match_clause_to_indexkey(RelOptInfo *rel,
 					restrict_op = ((Oper *) ((Expr *) clause)->oper)->opno;
 
 					opname = get_opname(restrict_op);
-					newop = oper(opname, rtype, rtype, TRUE);
+					if (opname != NULL)
+						newop = oper(opname, rtype, rtype, TRUE);
+					else
+						newop = NULL;
 
 					if (HeapTupleIsValid(newop) && (oprid(newop) != restrict_op))
 					{
-- 
GitLab