Re: Difference between text_pattern_ops and varchar_pattern_ops

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: David Morgenstern <d(dot)morgenstern(at)synedra(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Difference between text_pattern_ops and varchar_pattern_ops
Date: 2021-06-25 11:43:05
Message-ID: 7755cbb6a96ebab699d52f7801f799fb9815cd8a.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2021-06-25 at 12:29 +0200, David Morgenstern wrote:
> The documentation for operator classes (https://www.postgresql.org/docs/current/indexes-opclass.html)
> seems to indicate that text_pattern_ops should only be used for text columns
> and varchar_pattern_ops should be used for varchar columns.
> However today I stumbled upon an index using text_pattern_ops on a varchar column.
> Everything seems to be working fine. Now I am wondering what the difference
> between text_pattern_ops and varchar_pattern_ops might be.
>
> Can somebody explain why text_pattern_ops can be used on varchar columns, considering it
> can’t be used for bpchar columns? And are there any downsides in doing this
> (aside from my confusion of course)?

https://www.postgresql.org/message-id/flat/A737B7A37273E048B164557ADEF4A58B17CCE003%40ntex2010i.host.magwien.gv.at

Yours,
Laurenz Albe
--
+43-670-6056265
CYBERTEC PostgreSQL International GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-06-25 13:38:51 Re: Difference between text_pattern_ops and varchar_pattern_ops
Previous Message David Morgenstern 2021-06-25 10:29:41 Difference between text_pattern_ops and varchar_pattern_ops