Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XwZBW-0006Tp-5T for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Dec 2014 16:23:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XwZBV-000741-Hm for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Dec 2014 16:23:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XwZBU-00073q-HZ for pgsql-bugs@postgresql.org; Thu, 04 Dec 2014 16:23:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XwZBM-0003Xx-Id for pgsql-bugs@postgresql.org; Thu, 04 Dec 2014 16:23:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id sB4GML2k027035; Thu, 4 Dec 2014 11:22:22 -0500 From: Tom Lane To: dima@koulikoff.ru cc: pgsql-bugs@postgresql.org Subject: Re: BUG #12137: ORDER BY with expresion changes the output if added In-reply-to: <20141204064346.2573.21378@wrigleys.postgresql.org> References: <20141204064346.2573.21378@wrigleys.postgresql.org> Comments: In-reply-to dima@koulikoff.ru message dated "Thu, 04 Dec 2014 06:43:46 +0000" Date: Thu, 04 Dec 2014 11:22:21 -0500 Message-ID: <27034.1417710141@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org dima@koulikoff.ru writes: > The request ... > returns Russian names in :name field from the geoname_names table > But if I add a line > ORDER BY CASE WHEN geoname_names.name IS NOT NULL THEN geoname_names.name > ELSE geonames.name END > at the end of the request all the values for name are taken from the > geonames table. I can't reproduce any such misbehavior with the given information and some made-up data. Can you provide a self-contained test case? Or at least EXPLAIN (ANALYZE, VERBOSE) output for both queries? regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs