From: Tom Lane <tgl@sss.pgh.pa.us>
To: maxim.boguk@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6662: Database do not push condition to subquery, test case for bug 6658
Date: Tue, 22 May 2012 21:46:04 -0400
Message-ID: <18199.1337737564@sss.pgh.pa.us> (raw)
In-Reply-To: <E1SX08O-00085J-HA@wrigleys.postgresql.org>
References: <E1SX08O-00085J-HA@wrigleys.postgresql.org>
maxim.boguk@gmail.com writes:
> I managed create simple self-contained test case for 6658.
This works fine in HEAD. The reason it doesn't work fine in 9.1 (or
9.0) is that in those branches, anytextcat() and textanycat() are marked
volatile, for reasons that were good at the time but were superseded by
later policy changes. So you have a subselect containing a volatile
output expression, which prevents flattening of the subselect, so the
restriction clause doesn't get pushed down to where it could be used
with the index. For some history see
http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=c82d931dd180965a9a0c06acc7...http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=aab353a60b95aadc00f81da0c6...http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=3db6524fe63f0598dcb2b307bb...
If this is a big problem for you, you could safely adjust the
provolatile marking of those functions by hand in 9.1. It might be
better just to include an explicit cast to text, though, instead of
relying on the assumption that the system will let you concat an integer
directly to a text string.
regards, tom lane
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, maxim.boguk@gmail.com
Subject: Re: BUG #6662: Database do not push condition to subquery, test case for bug 6658
In-Reply-To: <18199.1337737564@sss.pgh.pa.us>
References: <E1SX08O-00085J-HA@wrigleys.postgresql.org> <18199.1337737564@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