Re: BUG #4899: Open parenthesis breaks query plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter Headland" <pheadland(at)actuate(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4899: Open parenthesis breaks query plan
Date: 2009-07-05 15:38:56
Message-ID: 9589.1246808336@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Peter Headland" <pheadland(at)actuate(dot)com> writes:
> While noodling around some more, I found that a comparison to '()'
> allows use of the index, as does '(abc)' and even '(a(b(c)d)e)'. It
> appears that mismatched open/close paren pairs trigger the
> bug. Obviously something is parsing the string literal and mishandling
> parentheses.

This isn't "obvious" at all, and in fact your theory is pretty much
nonsense. What I think is happening is that '(' is a sufficiently
common value that the planner thinks a seqscan is superior to an
indexscan for it. However, since you have not shown us EXPLAIN output
(much less EXPLAIN ANALYZE output), that's just a guess.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-07-05 15:55:05 Re: BUG #4901: Column name "window" breaks pg_dump/pg_restore
Previous Message Tom Lane 2009-07-05 15:28:26 Re: Diffrent column ordering after dump/restore tables with INHERITS