* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.55 2003/12/03 17:45:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.56 2004/04/07 17:42:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
List *retval = NIL;
int retvallen = 0;
int outer_query_keys = length(root->query_pathkeys);
+ List *sub_tlist = rel->subplan->targetlist;
List *l;
foreach(l, subquery->query_pathkeys)
Node *sub_key = sub_item->key;
List *k;
- foreach(k, subquery->targetList)
+ foreach(k, sub_tlist)
{
TargetEntry *tle = (TargetEntry *) lfirst(k);