Index: java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/compile/SelectNode.java	(revision 279263)
+++ java/engine/org/apache/derby/impl/sql/compile/SelectNode.java	(working copy)
@@ -1337,9 +1337,7 @@
 			 *	   from the same conglomerate in order to get consistent data.
 			 */
 			boolean distinctScanPossible = false;
-			if (origFromListSize == 1 &&
-				(! orderByAndDistinctMerged) &&
-				resultColumns.countNumberOfSimpleColumnReferences() == resultColumns.size())
+			if (origFromListSize == 1 && !orderByAndDistinctMerged)
 			{
 				boolean simpleColumns = true;
 				HashSet distinctColumns = new HashSet();
Index: java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java	(revision 279263)
+++ java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java	(working copy)
@@ -2573,31 +2573,6 @@
 	}
 
 	/**
-	 * Count the number of RCs with simple ColumnReferences.  
-	 * (RC.expression instanceof ColumnReference)  This is useful
-	 * for ensuring that the number of columns in the group by list
-	 * equals the number of grouping columns.
-	 *
-	 * @return int	The number of simple ColumnReferences.
-	 */
-	public int countNumberOfSimpleColumnReferences()
-	{
-		int				numCRs = 0;
-
-		int size = size();
-
-		for (int index = 0; index < size; index++)
-		{
-			if (((ResultColumn) elementAt(index)).getExpression() instanceof ColumnReference)
-			{
-				numCRs++;
-			}
-		}
-
-		return numCRs;
-	}
-
-	/**
 	 * Given a ResultColumn at the next deepest level in the tree, 
 	 * search this RCL for its parent ResultColumn.
 	 *
