Subject Re: Found possible bug on FB 1.0 build 821
Author Fernando Deola
--- In ib-support@y..., Lele Gaifax <lele@s...> wrote:
> >>>>> On Thu, 19 Sep 2002 19:08:35 -0300, "Fernando Deola"
<fernandodeola@b...> said:
>
> FD> I believe I've possibly found a strange bug. Look at this
> FD> query: SELECT P.ID_PESSOA, F.NR_FONE FROM PESSOA P INNER
JOIN
> FD> FONE F ON (F.ID_PESSOA = P.ID_PESSOA AND F.NR_FONE NOT IN
> FD> (SELECT SKIP 1 FF.NR_FONE FROM FONE FF WHERE FF.ID_PESSOA =
> FD> P.ID_PESSOA))
>
> I would not use the IN clause in such case, since it FB won't use
> indexes to resolve the query when the elements are given by a
> subquery.
>
> I'd probably try something like
>
> SELECT P.ID_PESSOA
> , (SELECT FIRST 1 F.NR_FONE
> FROM FONE F
> WHERE F.ID_PESSOA = P.ID_PESSOA) NR_FONE
> FROM PESSOA P
>
> hth,

WOW !

That really worked fine! It's a bull's eyes shot, pal. Thank you.

But it seems that the bug involving the FIRST clause in subqueries
is really confirmed. Unfortunatelly, it's not listed in the open
bugs nor in release notes.

Cheers,

Fernando Deola
EFEX Systems Ltda.
Blumenau - SC - Brazil