pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Partial indexes on VARCHAR get double converted from text
Date: Thu, 15 Jan 2015 20:52:18 -0500
Message-ID: <4537.1421373138@sss.pgh.pa.us> (raw)
In-Reply-To: <54B84278.2000800@agliodbs.com>
References: <54B84278.2000800@agliodbs.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Josh Berkus <josh@agliodbs.com> 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



view thread (3+ messages)  latest in thread

Message-ID: <4537.1421373138@sss.pgh.pa.us>
Permalink:  ../4537.1421373138@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4537.1421373138@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, josh@agliodbs.com
  Subject: Re: Partial indexes on VARCHAR get double converted from text
  In-Reply-To: <4537.1421373138@sss.pgh.pa.us>
  References: <54B84278.2000800@agliodbs.com> <4537.1421373138@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox