Re: Checking assumptions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Checking assumptions
Date
Msg-id 19884.1145552542@sss.pgh.pa.us
Whole thread Raw
In response to Re: Checking assumptions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> Martijn van Oosterhout <kleptog@svana.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: float8 regression test failure in head
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Unresolved Win32 bug reports