Subject Re: [firebird-support] Re: Procedures and inner/left joins - Strange behavior
Author Alexandre Benson Smith
Hi Fabiano,

fabiano_bonin wrote:

>>ok,
>>
>>But the result you get was what I have expected from your query.
>>
>>Did I miss something ?
>>
>>What result do you think will be the correct ?
>>
>>see you !
>>
>>
>
>I expected the procedure would be evaluated just one time using the
>first parameter it received, giving me the following result:
>
> TEST_ID FIELD1 TEST
>============ ============ ============
>
> 1 1 1
> 1 1 1
> 2 2 1
> 2 2 1
> 3 3 1
> 3 3 1
>
>Instead of the actual bevahior:
>
> TEST_ID FIELD1 TEST
>============ ============ ============
>
> 1 1 1
> 1 1 1
> 2 2 2
> 2 2 2
> 3 3 3
> 3 3 3
>
>Note that i had a good surprise with the actual behavior. It fits all
>my needs. I just want to confirm it's expected to start to use and
>abuse it!
>
>Best regards,
>
>Fabiano.
>
>
>
hummm

Now I see what you expected...

I am talking about what I think, I am sure someone will correct me if I
am wrong.

If the SP is the last joined stream it will be executed (and
materialized) for each row and if the result of the SP will be diferent
because the parameter values changes for the current row to be joined
then the result will be (and should be) diferent.

I have some SP's that I join with tables in the same manner you use, and
I rely on then, so I hope it will not change in the future (at least if
it's not against the SQL standard) and without a good and big advise
from the FB team. FB has a strong commitment to backwards compatibility.

Taking the "commitment to backwards compatibility" I belive you could
use it without fear.

Let's see if anyone has some point to add to this thread.

see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br