> 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