Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XhMgI-0005Sy-7W for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Oct 2014 18:00:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XhMgH-0000Jm-Mp for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Oct 2014 18:00:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XhKTn-0006JF-Km for pgsql-bugs@postgresql.org; Thu, 23 Oct 2014 15:39:11 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XhKTf-0004wo-5l for pgsql-bugs@postgresql.org; Thu, 23 Oct 2014 15:39:09 +0000 MIME-Version: 1.0 Subject: BUG #11771: wrong behaviour of planner when pushing conditions To: pgsql-bugs@postgresql.org From: chocholousp@avast.com Date: Thu, 23 Oct 2014 15:38:16 +0000 Message-ID: <20141023153816.2676.95359@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.2 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 The following bug has been logged on the website: Bug reference: 11771 Logged by: Pavel Chocholous Email address: chocholousp@avast.com PostgreSQL version: 9.3.4 Operating system: Centos Description: wrong behaviour of planner when pushing conditions from outer query to subselect (just when joining??) drop table t; --create table for varchars create temporary table t (t varchar(64)); --fill it with two columns insert into t (t) values ('88652f64-6cca-4ffa-a756-000007406ba6'); insert into t (t) values ('bad guid'); insert into t (t) values ('88652f64-6cca-4ffa-a756'); --this just works select * from (select t::uuid from t --filter out all non-uuid varchars where t ~ '^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$' ) x where x.t::uuid = '88652f64-6cca-4ffa-a756-000007406ba6'::uuid --and then... --here we go, do you see something wrong? select * from (select t::uuid from t --filter out all non-uuid varchars where t ~ '^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$' ) x inner join t on t.t::uuid=x.t::uuid where x.t::uuid = '88652f64-6cca-4ffa-a756-000007406ba6'::uuid -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs