From: Tom Lane on
Bernd Helmle <mailings(a)oopsware.de> writes:
> -- assertion failure
> EXPLAIN SELECT 1 FROM foo WHERE UPPER(value) = 'xyz';

> I tried it back from current -HEAD to 8.3.11 and managed to reproduce it
> everywhere. Non-cassert builds are working correctly, so i'm not sure
> wether this is an over-aggressive assert() or masks a problem from
> somewhere else.

I can reproduce it back to 8.0, and I'm not sure it couldn't be done in
older branches with a slightly different test case :-(.

I think that at bottom the issue is that the planner plays fast and
loose with binary-compatible data types by being willing to strip off
RelabelType nodes whenever it's trying to arrive at selectivity
estimates. This isn't something we can easily change, though.

I'm quite hesitant to remove that Assert from deconstruct_array(), but
it strikes me that an easy workaround is to make get_attstatsslot()
use ARR_ELEMTYPE(statarray) rather than the passed-in atttype. This
at least moves the fast-and-looseness into a function that's basically
a creature of the planner, rather than fooling with a fundamental
utility like deconstruct_array().

If anybody feels really uncomfortable with that, we could add a
compensating "Assert(IsBinaryCoercible(ARR_ELEMTYPE(statarray),
atttype))" into get_attstatsslot(). Not sure if it's worth the cycles.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Alvaro Herrera on
Excerpts from Tom Lane's message of vie jul 09 12:16:42 -0400 2010:

> If anybody feels really uncomfortable with that, we could add a
> compensating "Assert(IsBinaryCoercible(ARR_ELEMTYPE(statarray),
> atttype))" into get_attstatsslot(). Not sure if it's worth the cycles.

Cycles spent only in assert-enabled builds? Why not?

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Tom Lane on
Alvaro Herrera <alvherre(a)commandprompt.com> writes:
> Excerpts from Tom Lane's message of vie jul 09 12:16:42 -0400 2010:
>> If anybody feels really uncomfortable with that, we could add a
>> compensating "Assert(IsBinaryCoercible(ARR_ELEMTYPE(statarray),
>> atttype))" into get_attstatsslot(). Not sure if it's worth the cycles.

> Cycles spent only in assert-enabled builds? Why not?

I decided not to do it, not so much because of any performance worries
as that I didn't want to make lsyscache.c depend on the parser. Maybe
sometime we should rethink where the parse_coerce.c functionality lives.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Andres Freund on
1;2401;0cOn Fri, Jul 09, 2010 at 06:49:27PM -0400, Alvaro Herrera wrote:
> Excerpts from Tom Lane's message of vie jul 09 12:16:42 -0400 2010:
>
> > If anybody feels really uncomfortable with that, we could add a
> > compensating "Assert(IsBinaryCoercible(ARR_ELEMTYPE(statarray),
> > atttype))" into get_attstatsslot(). Not sure if it's worth the cycles.
> Cycles spent only in assert-enabled builds? Why not?
The slower assert-enabled is, the less likely it is that somebody can
run serious testing on it - potentially catching bugs way much easier.
Contrarily to your statement I would actually like to remove some
older asserts.
For example AtEOXact_Buffers makes it significantly expensive to do
assert tests on larger shbuf setups.

Andres

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers