Subject | RE: [Firebird-Architect] Uses of named s aka aliases |
---|---|
Author | Claudio Valderrama C. |
Post date | 2005-01-11T03:37:17Z |
Ann W. Harrison wrote:
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.
> My instinct is thatThat speaks for consistent and predictable values.
>
> 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.
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.