From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
---|---|
To: | boris(at)folgmann(dot)de |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY |
Date: | 2012-07-27 16:03:24 |
Message-ID: | 20120727160324.GA11439@depesz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Jul 27, 2012 at 02:56:18PM +0000, boris(at)folgmann(dot)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/
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2012-07-29 19:50:58 | Re: primary and hot standby database don' work now |
Previous Message | boris | 2012-07-27 14:56:18 | BUG #6774: FOR IN SELECT LOOP ignores ORDER BY |