The current syntax for derived tables allows a dangling AS, which should not be allowed. For example:
select *
from (
select 1 as X from rdb$database
) as
This is the result of the syntax:
%type <selectExprNode> derived_table
derived_table
: '(' select_expr ')' as_noise correlation_name derived_column_list
{
$$ = $2;
$$->dsqlFlags |= RecordSourceNode::DFLAG_DERIVED;
if ($5)
$$->alias = $5->c_str();
$$->columns = $6;
}
;
%type <metaNamePtr> correlation_name
correlation_name
: /* nothing */ { $$ = NULL; }
| symbol_table_alias_name
;
I think the correct syntax should be:
%type <selectExprNode> derived_table
derived_table
: '(' select_expr ')' correlation_name derived_column_list
{
$$ = $2;
$$->dsqlFlags |= RecordSourceNode::DFLAG_DERIVED;
if ($5)
$$->alias = $5->c_str();
$$->columns = $6;
}
;
%type <metaNamePtr> correlation_name
correlation_name
: /* nothing */ { $$ = NULL; }
| as_noise symbol_table_alias_name
;
The current syntax for derived tables allows a dangling
AS, which should not be allowed. For example:This is the result of the syntax:
I think the correct syntax should be: