hubert depesz lubaczewski schrieb/wrote: > generally - order by datname is understood as "order by *variable > datname*". - which is null.
It's clear that it's a shadowing problem. But it's not a "FOR IN EXECUTE" where a variable makes sense. I mean why is a "ORDER BY variable" valid in "FOR IN"? In SQL you can't use ORDER BY NULL. If the order by clause is not correct the whole statement should raise an error.