Re: text column indexing in UTF-8 database

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Reece Hart <reece(at)harts(dot)net>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: text column indexing in UTF-8 database
Date: 2009-03-13 17:13:10
Message-ID: 12217.1236964390@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> It looks like an index using text_pattern_ops can be used for equality
> (see my test case below).

This is true as of 8.4; prior versions make a distinction between =
and ~=~.

> This works apparently because texteq() is defined as bitwise-equality.
> Is that really correct? I was under the impression that some locales do
> not obey that rule, and may consider two slightly different strings to
> be equal.

The locale might, but Postgres doesn't --- look at the implementation
of texteq().

There is actually some history here; the former distinction in the
equality operators arose from exactly your concern. But after we
put in the second-pass check to insist on bitwise equality, we
realized that the equality operators really were equivalent.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marco Colombo 2009-03-13 17:44:21 Re: Maximum transaction rate
Previous Message Tomasz Olszak 2009-03-13 16:36:10 Problem with accesing Oracle from plperlu function when using remote pg client client.