Re: BUG #4899: Open parenthesis breaks query plan - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4899: Open parenthesis breaks query plan
Date
Msg-id 9589.1246808336@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #4899: Open parenthesis breaks query plan  ("Peter Headland" <pheadland@actuate.com>)
Responses Re: BUG #4899: Open parenthesis breaks query plan
List pgsql-bugs
"Peter Headland" <pheadland@actuate.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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Diffrent column ordering after dump/restore tables with INHERITS
Next
From: "Steve Purcell"
Date:
Subject: BUG #4901: Column name "window" breaks pg_dump/pg_restore