Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 82B2516AF4E2 for ; Mon, 30 Jul 2012 07:15:11 -0300 (ADT) Received: from news.hub.org ([200.46.204.72]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Svn0F-0003jd-0E for pgsql-bugs@postgresql.org; Mon, 30 Jul 2012 10:15:11 +0000 Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.5/8.14.5) with ESMTP id q6UAEr6w065615 for ; Mon, 30 Jul 2012 07:14:53 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.5/8.14.5/Submit) id q6U9ubdj044773 for pgsql-bugs@postgresql.org; Mon, 30 Jul 2012 06:56:37 -0300 (ADT) (envelope-from news) From: Boris Folgmann X-Newsgroups: pgsql.bugs Subject: Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY Date: Mon, 30 Jul 2012 11:56:35 +0200 Organization: Hub.Org Networking Services Lines: 14 Message-ID: References: <20120727160324.GA11439@depesz.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120715 Firefox/14.0.1 SeaMonkey/2.11 In-Reply-To: <20120727160324.GA11439@depesz.com> To: pgsql-bugs@postgresql.org X-Pg-Spam-Score: -0.0 (/) X-Archive-Number: 201207/228 X-Sequence-Number: 33704 Hi, 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. Tnx, Boris