Thanks for the hint.
In fact, my current_period_id() is based on time, but it should be constant along the query execution. I mean, I don't want some records filtered with some values and other with other values... I'll have an uncongruent recordset.
Well - you didn't read the chapter I noticed you, did you?
Look at function now(). It returns always the same value inside transaction. If your current_period_id() works the same way as now() then declare it as STABLE.
Regards, Tomasz Myrta
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend