On Sat, May 30, 2015 at 3:12 PM, Peter Geoghegan <p...@heroku.com> wrote:
> Debugging this allowed me to come up with a significantly simplified
> approach. Attached is a new version of the original fix. Details are
> in commit message -- there is no actual need to have
> search_indexed_tlist_for_var() care about Vars being resjunk in a
> special way, which is a good thing.

It feels wrong to not have the additional, paranoid IsVar() check
within pull_var_targetlist_clause() check added in most recent
revision, even though it should not be necessary. Attached delta patch
adds this check.

I need to stop working on weekends...
-- 
Peter Geoghegan
From 8542ff2623d7f2142ecb8c21c572b47d67500231 Mon Sep 17 00:00:00 2001
From: Peter Geoghegan <peter.geoghega...@gmail.com>
Date: Sat, 30 May 2015 15:25:55 -0700
Subject: [PATCH 2/7] Add additional, paranoid check

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

diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index 6b7adb7..8c418d2 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -432,7 +432,7 @@ pull_var_targetlist_clause(OnConflictExpr *onconfl, List* clause,
 		if (tlist_member((Node *) var, onconfl->exclRelTlist))
 			continue;		/* already got it */
 
-		if (var->varattno != InvalidAttrNumber)
+		if (!IsA(var, Var) || var->varattno != InvalidAttrNumber)
 			elog(ERROR, "cannot pull up non-wholerow Var in excluded targetlist");
 
 		tle = makeTargetEntry((Expr *) var, var->varattno, NULL, true);
-- 
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