* <A NAME="tableExpression">tableExpression</A>
*/
final public SelectNode tableExpression(ResultColumnList selectList) throws ParseException, StandardException {
SelectNode selectNode;
FromList fromList;
ValueNode whereClause = null;
GroupByList groupByList = null;
ValueNode havingClause = null;
Token whereToken;
fromList = fromClause();
switch (jj_nt.kind) {
case WHERE:
whereToken = jj_consume_token(WHERE);
whereClause = whereClause(whereToken);
break;
default:
jj_la1[169] = jj_gen;
;
}
switch (jj_nt.kind) {
case GROUP:
groupByList = groupByClause();
break;
default:
jj_la1[170] = jj_gen;
;
}
switch (jj_nt.kind) {
case HAVING:
havingClause = havingClause();
break;
default:
jj_la1[171] = jj_gen;
;
}
// fix for HAVING without GROUP BY, makes sure we get one
// aggregate operator by adding a count(*), this fixes beetle 5853, 5890
if (havingClause != null && groupByList == null) {
ValueNode vn = (ValueNode) nodeFactory.getNode(
C_NodeTypes.AGGREGATE_NODE,
null,
org.apache.derby.impl.sql.compile.CountAggregateDefinition.class,
Boolean.FALSE, // distinct Boolean.TRUE?
"COUNT(*)",