Re: Checking assumptions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Checking assumptions
Date: 2006-04-20 17:02:22
Message-ID: 19884.1145552542@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
>> src/backend/utils/adt/selfuncs.c function like_selectivity

>> Assume this function is never called with a zero length bytea
>> constant. It just looks wierd to set patt to NULL only to Assert() it
>> three lines down.

> This may be a real bug --- I'm not sure how well the bytea-LIKE path has
> been tested, and it looks odd to me too.

I checked into this, and in fact the path can't be taken: we only reach
like_selectivity when trying to estimate selectivity of a pattern that
is not an "exact match" pattern --- and in LIKE, that requires at least
one wildcard, so the pattern can't be empty.

So there's no bug, but the coding is certainly a bit obscure --- I'll
try to make it more clear.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-04-20 17:17:07 Re: Unresolved Win32 bug reports
Previous Message Jim C. Nasby 2006-04-20 17:00:07 Re: Performance decrease