Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YBw5H-00082x-Vj for pgsql-bugs@arkaria.postgresql.org; Fri, 16 Jan 2015 01:52:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YBw5H-0005hN-Gs for pgsql-bugs@arkaria.postgresql.org; Fri, 16 Jan 2015 01:52:23 +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 1YBw5G-0005hH-SA for pgsql-bugs@postgresql.org; Fri, 16 Jan 2015 01:52:23 +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 1YBw5E-0001Fv-0J for pgsql-bugs@postgresql.org; Fri, 16 Jan 2015 01:52:21 +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 t0G1qIJu004538; Thu, 15 Jan 2015 20:52:18 -0500 From: Tom Lane To: Josh Berkus cc: pgsql-bugs@postgresql.org Subject: Re: Partial indexes on VARCHAR get double converted from text In-reply-to: <54B84278.2000800@agliodbs.com> References: <54B84278.2000800@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Fri, 16 Jan 2015 11:43:04 +1300" Date: Thu, 15 Jan 2015 20:52:18 -0500 Message-ID: <4537.1421373138@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 Josh Berkus writes: > create table stately ( id int, filename varchar(255), state varchar(255) ); > create index on stately(state) where state in ( 'pending', 'waiting', > 'done' ); > \d stately > Table "public.stately" > Column | Type | Modifiers > ----------+------------------------+----------- > id | integer | > filename | character varying(255) | > state | character varying(255) | > Indexes: > "stately_state_idx" btree (state) WHERE state::text = ANY > (ARRAY['pending'::character varying, 'waiting'::character varying, > 'done'::character varying]::text[]) I see no bug here. It's doing what's expected. > Further, it seems to me from testing that this double type conversion > affects the planner's costing of the index, causing it to not want to > use the index. That's not a bug report, that's just unsupported speculation. Moreover, if there were any such effect, it would cause the planner to reject the index entirely, not just penalize it cost-wise. 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