Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY
От | hubert depesz lubaczewski |
---|---|
Тема | Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY |
Дата | |
Msg-id | 20120727160324.GA11439@depesz.com обсуждение исходный текст |
Ответ на | BUG #6774: FOR IN SELECT LOOP ignores ORDER BY (boris@folgmann.de) |
Ответы |
Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY
|
Список | pgsql-bugs |
On Fri, Jul 27, 2012 at 02:56:18PM +0000, boris@folgmann.de wrote: > This is an really interesting one! > I've trimmed down the problem so you can simply reproduce it by copy & > paste: > The only difference of the two functions is that the first one uses a > variable with the same name of a column. > This might be a feature and not a bug, but browsing through the > documentation I could not find any documented restrictions on variable names > in this context. and the variable name is the problem. generally - order by datname is understood as "order by *variable datname*". - which is null. change the select to: select d.* from pg_database d order by d.datname and now there is no more problem - because you're no longer using ambiguous identifier. Also, check this: http://www.depesz.com/2009/12/16/waiting-for-8-5-plpgsql-variable-resolution/ Best regards, depesz -- The best thing about modern society is how easy it is to avoid contact with it. http://depesz.com/
В списке pgsql-bugs по дате отправления: