Bug in local SQL of Delphi 2.0

I found bug in local SQL in Delphi 2.0.

I have tested paradox V5.0 (and V7.0 too) tables with 69000 records
which defined as

create table ints (
ufld integer,
primary key (ufld)

After execution SQL statement

select max(ufld) from ints
where ufld<80000

When constant in "where" clause more than any number I get wrong

"Any number" is more than field "ufld" from record number 10000h+X
and lower or equal then field "ufld" from last record.

X is unknown number from 100 to 1000.

Wrong result placed in table per 10000h steps up from expected right

I test that SQL statement with char(12) and Timestamp types of field
with same bad result.

When I delete primary key from tested table or
When I change constant in "Where" clause to expression
I gets right result always.

I have reproduced this bug on Pentium and 486 processors.

That test table and SQL statement been simplificated from real ones of
my project.
That statement containes aggregate functions "SUM" and "COUNT",
"GROUP BY" clause and "WHERE" condition per first field in primary
When tables containes more than 10000h+X records
I have wrong result.

I think it is a bug in optimization of SQL execution.

I have not found this bug in Delphi16.

How may I correct this problem, or how may I disable that optimization
if it's one.

Please E-Mail  t...@quadrat.omsk.su  or/and answer in news.

Thanks for help.