Subject Bug in Firebird 1.5.2 ?
Author fkieselbach
Hello,
I think, i have found a bug in Firebird 1.5.2.
I have a SQL-Statement that works correct with the Version
1.5.0 and beta-versions before. Then i have updated to Version 1.5.2
and the result of the Statment is false.

Here the Statment:

SELECT
a.HS, a.KONTO, c.MC,
a.JAHR, c.ANTKOST, c.ANTST,
a.BETRAG * d.WERT * c.GVKOST,
a.STEUER * d.WERT * c.GVMWST,
b.STEUER * d.WERT * c.GVMWST,
e.BEZ
FROM
KONT c, KONTOBUCHSTAT d, H_ZEITRAUM e, KONTERG a LEFT OUTER JOIN
KONTERG b
ON
-b.JAHR = a.JAHR AND
a.Monat = b.MONAT AND
a.KONTO = b.KONTO
WHERE
a.KONTO = c.KONTO AND
a.KONTO >= 1000 AND a.KONTO < 30000 AND
a.JAHR = :jahr AND
a.MONAT = :quartal + 12 AND
a.MONAT = e.LFN AND
(a.BETRAG <> 0 OR a.STEUER <> 0) AND
a.HS = d.TYP AND
(c.ANTKOST<>0 OR c.ANTST<>0) AND
(a.BETRAG * c.GVKOST>0 OR a.STEUER * c.GVMWST > 0) AND
a.STEUER * d.WERT * c.GVMWST <>0
ORDER BY
1,3,2;

and here a part of the correct Result with FB 1.5.0:

"S","2005","Auto
tanken","2005","100","100";"-96,00";"-15,36";"NULL";"I. Quartal"
"S";"2004";"Betriebsausgaben
16%";"2005";"100";"100";"-302,75";"-48,44";"NULL";"I. Quartal"
"S";"2021";"Energie";"2005";"30";"30";"-191,60";"-30,66";"-21,46";"I.
Quartal"
"S";"2039";"Miete
Server";"2005";"100";"100";"-172,24";"-27,56";"NULL";"I. Quartal"

and here a part of the false Result with FB 1.5.2:

"S";"2005";"Energie";"2005";"100";"100";"-96,00";"-15,36";"NULL";"I.
Quartal"
"S";"2004";"Energie
16%";"2005";"100";"100";"-302,75";"-48,44";"NULL";"I. Quartal"
"S";"2021";"Energie";"2005";"30";"30";"-191,60";"-30,66";"-21,46";"I.
Quartal"
"S";"2039";"Energie";"2005";"100";"100";"-172,24";"-27,56";"NULL";"I.
Quartal"

For better reading i have converted the results in csv-data.
Every new row starting with "S".

The difference is in the 3. column (c.MC). I became in every row
the word "Energie". What is the difference between the rows?
The word "Energie" is ok for the third row, not for all others.
It is only the row that have not NULL in the 9 Column. This
column is the result of the LEFT OUTER JOIN.

I hope someone can find the error.

Regards Frank