8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 14:03:07 +01:00

Small improvement partially related to CORE-1181. It allows to keep the field name if the cast source is an aggregated column.

This commit is contained in:
dimitr 2007-03-28 09:27:54 +00:00
parent 3e48e9a66b
commit 27e2ee9be7

View File

@ -8165,8 +8165,14 @@ static void pass1_union_auto_cast(dsql_nod* input, const dsc& desc,
}
// When a cast is created we're losing our fieldname, thus
// create a alias to keep it.
if (select_item->nod_type == nod_field) {
dsql_fld* sub_field = (dsql_fld*) select_item->nod_arg[e_fld_field];
const dsql_nod* name_node = select_item;
while (name_node->nod_type == nod_map) {
// skip all the nod_map nodes
const dsql_map* map = (dsql_map*) name_node->nod_arg[e_map_map];
name_node = map->map_node;
}
if (name_node->nod_type == nod_field) {
dsql_fld* sub_field = (dsql_fld*) name_node->nod_arg[e_fld_field];
// Create new node for alias and copy fieldname
alias_node = MAKE_node(nod_alias, e_alias_count);
// Copy fieldname to a new string.