X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6756253805 for ; Mon, 18 Apr 2005 04:23:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93075-04 for ; Mon, 18 Apr 2005 07:23:36 +0000 (GMT) Received: from mx-00.sil.at (mx-00.sil.at [62.116.68.196]) by svr1.postgresql.org (Postfix) with ESMTP id 40FAC53802 for ; Mon, 18 Apr 2005 04:23:34 -0300 (ADT) Received: (qmail-ldap/ctrl 37446 invoked from network); 18 Apr 2005 07:23:33 -0000 Received: from unknown (HELO jupiter.sonorys.at) ([213.235.243.42]) (envelope-sender ) by mx-00.sil.at (qmail-ldap-1.03) with SMTP for ; 18 Apr 2005 07:23:33 -0000 Received: from neptun.sonorys.at (neptun.sonorys.at [172.24.1.17]) by jupiter.sonorys.at (8.11.7+Sun/8.11.7) with ESMTP id j3I7NY120723 for ; Mon, 18 Apr 2005 09:23:34 +0200 (MEST) Received: by neptun.sonorys.at with Internet Mail Service (5.5.2653.19) id <2JD5WH6G>; Mon, 18 Apr 2005 09:23:33 +0200 Message-ID: From: =?ISO-8859-1?Q?K=D6PFERL_Robert?= To: pgsql-sql@postgresql.org Subject: btree and is null in a static expression Date: Mon, 18 Apr 2005 09:23:25 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="ISO-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200504/241 X-Sequence-Number: 21134 Hi, I've written a function but I don't understand the the plan, the planner makes. If variables are replaced, the function looks like that: select a,b,c from "Tbl1" where (a='454') or ('454' is null); a has got an btree-Index. explain verbose tells me that Postgres wants to do a SEQSCAN If the last subexpression is omitted like select a,b,c from "Tbl1" where (a='454') or false; The planner wants expecedly utilize an index. How comes that, while it is obvious that the last subexpression evaluates to false and thus can be omitted or can even be statically evaluated I read about btree-Indexes and that they can't be used when null comes into play. But there? Thanks