mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 01:23:03 +01:00
Fixed (methinks) CORE-3697: String truncation error when selecting from a VIEW with UNION inside. It doesn't look like a good idea to modify dsc_length in place, as it can be used afterwards (e.g. MAKE_desc(field) after GEN_expr(rse), see define_view() in ddl.cpp). We only need to ensure that the generated BLR has the real byte length and it can be achieved with a temporary descriptor copy. Other solutions are also possible but this one seems better at the first glance.
This commit is contained in:
parent
91cdb8e5f3
commit
529e0bc593
@ -1653,10 +1653,12 @@ static void gen_constant( CompiledStatement* statement, const dsc* desc, bool ne
|
||||
**/
|
||||
static void gen_constant( CompiledStatement* statement, dsql_nod* node, bool negate_value)
|
||||
{
|
||||
if (node->nod_desc.dsc_dtype == dtype_text)
|
||||
node->nod_desc.dsc_length = ((dsql_str*) node->nod_arg[0])->str_length;
|
||||
dsc desc = node->nod_desc;
|
||||
|
||||
gen_constant(statement, &node->nod_desc, negate_value);
|
||||
if (desc.dsc_dtype == dtype_text)
|
||||
desc.dsc_length = ((dsql_str*) node->nod_arg[0])->str_length;
|
||||
|
||||
gen_constant(statement, &desc, negate_value);
|
||||
}
|
||||
|
||||
|
||||
@ -3098,7 +3100,7 @@ static void gen_union( CompiledStatement* statement, const dsql_nod* union_node)
|
||||
dsql_nod* map_item = items->nod_arg[0];
|
||||
// AB: First item could be a virtual field generated by derived table.
|
||||
if (map_item->nod_type == nod_derived_field) {
|
||||
map_item = map_item->nod_arg[e_alias_value];
|
||||
map_item = map_item->nod_arg[e_derived_field_value];
|
||||
}
|
||||
dsql_ctx* union_context = (dsql_ctx*) map_item->nod_arg[e_map_context];
|
||||
stuff_context(statement, union_context);
|
||||
|
Loading…
Reference in New Issue
Block a user