Skip to content

SubQueryConversion = true -- error "no current record for fetch operation" with complex joins #8223

@EPluribusUnum

Description

@EPluribusUnum

Hi *!

https://www.firebirdsql.org/en/community-news/firebird-5-0-1-improvements-in-optimizer

This SQL works with SubQueryConversion = false, but fails with SubQueryConversion = true.

The cursor identified in the UPDATE or DELETE statement is not positioned on a row.
no current record for fetch operation.

select gyp.id, round(sum(ak.menny),3), g.ktmn_kod_vv, g.ikt_t_kod_vv, gyp.munkalap_szam, fj.kod,
    round(a.kiadott_menny - a.visszavett_menny - a.felhasznalt_menny,3), fj.id
    from tm_gyp_anyag_kiad_f_g fg
    join tm_gyp gyp on fg.tm_gyp_id = gyp.id
    join tm_gepsor g on gyp.tm_gepsor_id = g.id
    join tm_uzemcsarnok u on g.tm_uzemcsarnok_id = u.id
    join tm_gyp_anyag_kiad ak on ak.tm_gyp_anyag_kiad_f_g_id = fg.id
    join tm_gyp_anyag_v a on ak.tm_gyp_anyag_id = a.id
    join ktfj fj on fj.id = a.ktfj_id
    where fg.allapot in ('L') and fg.tipus = 'V' and fg.id in (select first 1 id from tm_gyp_anyag_kiad_f_g where cru = 'TESZTFULL' and tipus = 'V' order by id)
    group by gyp.id, a.ktfj_id, a.mert_id, g.ktmn_kod_vv, g.ikt_t_kod_vv, a.id, gyp.munkalap_szam, fj.kod, a.ori_id,
             a.kiadott_menny, a.visszavett_menny, a.felhasznalt_menny, fj.id
    order by gyp.id, a.ktfj_id

I'll send you the database on request.

Firebird-5.0.1.1469-0-windows-x64

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions