On Thu, May 28, 2015 at 6:31 PM, Peter Geoghegan <p...@heroku.com> wrote:
> This concerns a thinko in unique index inference. See the commit
> message for full details.

It seems I missed a required defensive measure here. Attached patch
adds it, too.

-- 
Peter Geoghegan
From c5aee669bbdf58f38f1063934a1d93286506de7b Mon Sep 17 00:00:00 2001
From: Peter Geoghegan <peter.geoghega...@gmail.com>
Date: Fri, 29 May 2015 02:53:41 -0700
Subject: [PATCH 4/4] Additional defensive measure

---
 src/backend/optimizer/util/plancat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index 1b81f4c..4f38972 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -758,7 +758,7 @@ infer_collation_opclass_match(InferenceElem *elem, Relation idxRel,
 			if (((Var *) elem->expr)->varattno == attno)
 				return true;
 		}
-		else
+		else if (attno == 0)
 		{
 			Node	   *nattExpr = list_nth(idxExprs, (natt - 1) - nplain);
 
-- 
1.9.1

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to