"No current record for fetch operation" with queries with aggregated subselect
------------------------------------------------------------------------------

                 Key: CORE-6171
                 URL: http://tracker.firebirdsql.org/browse/CORE-6171
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 4.0 Beta 1, 3.0.4
         Environment: Windows 10 64 bits
            Reporter: Paquito Ines


Firebird 3 gives error "no current record for fetch operation" with queries 
filtering a table using an index, and with a second filter using a subselect 
with an aggregation function running over a second table correlated with the 
table of the outer select.

It can be reproduced with the following (nonsense) query:

select *
from rdb$relations r
where 
  rdb$relation_name = '' 
  or (
    select sum(rdb$relation_id)
    from rdb$database d
    where d.rdb$character_set_name = r.rdb$owner_name
  ) > 0

-

FB 2.1, 2.5:
  PLAN (D NATURAL)
  PLAN (R NATURAL)

Runs ok (no results)

-

FB 3.0.4, 3.0.5.33182-0_x64_nightly, Firebird-4.0.0.1636-0_x64_nightly:
  PLAN (D NATURAL)
  PLAN (R NATURAL, R INDEX (RDB$INDEX_0))

Select Expression
    -> Singularity Check
        -> Aggregate
            -> Filter
                -> Table "RDB$DATABASE" as "D" Full Scan
Select Expression
    -> Filter
        -> Condition
            -> Table "RDB$RELATIONS" as "R" Full Scan
            -> Table "RDB$RELATIONS" as "R" Access By ID
                -> Bitmap
                    -> Index "RDB$INDEX_0" Unique Scan

Statement failed, SQLSTATE = 22000
no current record for fetch operation

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to