From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dmitri Bichko <dbichko@aveopharma.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: UNION index use help
Date: Thu, 06 Oct 2005 12:32:17 -0400
Message-ID: <20942.1128616337@sss.pgh.pa.us> (raw)
In-Reply-To: <F18A6F7CF1661F46920F2CF713122FED46CCC4@mail.aveo.aveopharma.com>
References: <F18A6F7CF1661F46920F2CF713122FED46CCC4@mail.aveo.aveopharma.com>
"Dmitri Bichko" <dbichko@aveopharma.com> writes:
> Ok, I'm thoroughly confused.
You didn't say which PG version you are using, but if it's something
reasonably recent then it should be able to push upper qual conditions
down into a UNION. I think you are getting bit by this restriction:
* 3. For subqueries using UNION/UNION ALL/INTERSECT/INTERSECT ALL, we can
* push quals into each component query, but the quals can only reference
* subquery columns that suffer no type coercions in the set operation.
* Otherwise there are possible semantic gotchas.
You're getting burnt because you're unioning a text with a varchar.
Make the column types the same and it'll work better.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, dbichko@aveopharma.com
Subject: Re: UNION index use help
In-Reply-To: <20942.1128616337@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