Mario Jorge Nunes Filipe <mjnf@uevora.pt> writes:
> Yestrday a new class was added (this is the only difference from before,
> and since then the following query no longer works:
> select distinct disciplina from lecciona* l where l.docente='$id' and
> l.ano_lectivo<= $ano_lectivo and l.classe in ('lecciona','respons�vel')
> and not exists (select 1 from lecciona* l1 where
> l1.disciplina=l.disciplina and l1.docente <> l.docente and
> l1.ano_lectivo <= $ano_lectivo and l1.ano_lectivo > l.ano_lectivo and
> l.classe = l1.classe ) order by disciplina";
Subselects in inherited queries are a tricky area (in fact I just
yesterday fixed a bug in 7.1RC1 in that specific area).
> this system is a 6.4.2,
Try updating to something less ancient --- there are tons of bugs in
6.4.*'s subselect implementation. I'm amazed not that this crashes,
but that it ever worked at all. You really should be on 7.0.3, if
not experimenting with 7.1.
regards, tom lane