Meszaros Attila <tilla(at)draconis(dot)elte(dot)hu> writes:
> WHY SHALL IT MATERIALIZE A CONSTANT RESULT IN A LOOP OF 120000 TIMES ??
> [it would be enough to materialize only once,
Which in fact is exactly what the materialize node is for. The reported
costs are pretty bogus, but AFAICT the plan is the right thing.
regards, tom lane