Subject RE: [Firebird-Architect] Uses of named s aka aliases
Author Claudio Valderrama C.
Ann W. Harrison wrote:
> My instinct is that
>
> select x.a, gen_id (gen_1, 1) as b, x.c
> from table1 x
> where b < 30
> order by b
>
> should evaluate b once and bind the value to the alias rather than
> reevaluating the expression on each reference. I've got low
> confidence in that instinct.

That speaks for consistent and predictable values.
However, what about coalesce? We based some constructions on blr_value_if
that will evaluate each argument, thus
coalesce(a, b) =>
blr_value_if(a is not null, a, b)
and effectively "a" is evaluated twice. Same follows for coalesce with more
parameters that will be converted to nested value_if's. This concern was
brought more than two years ago by Dave and apparently nobody paid
attention.

C.