David Morgenstern <d.morgenstern@synedra.com> writes:
> Can somebody explain why text_pattern_ops can be used on varchar
> columns, considering it can’t be used for bpchar columns?
The underlying rule there is that an opclass can be applied to an index
column if the column's actual type is binary-coercible to what the opclass
expects. varchar is binary-coercible to text, since they're basically the
same type. bpchar is not, because we must insert a coercion function that
strips any trailing blanks. (Essentially, the restriction exists because
the index machinery won't cope with such intermediate functions.)
regards, tom lane