Re: UTF-8 and LIKE vs =

Поиск
Список
Период
Сортировка
От David Wheeler
Тема Re: UTF-8 and LIKE vs =
Дата
Msg-id F5FA9A60-F557-11D8-990D-000A95972D84@kineticode.com
обсуждение исходный текст
Ответ на Re: UTF-8 and LIKE vs =  (Markus Bertheau <twanger@bluetwanger.de>)
Список pgsql-general
On Aug 23, 2004, at 3:46 PM, Markus Bertheau wrote:

> The collation rules of your (and my) locale say that these strings are
> the same:
>
> [markus@teetnang markus]$ cat > t
> 국방비
> 북한의
> [markus@teetnang markus]$ uniq t
> 국방비
> [markus@teetnang markus]$

Interesting.

> Make sure that you have initdb'd the database under the right locale.
> There's not much PostgreSQL can do if strcoll() says that the strings
> are equal.

Well, I have data from a number of different locales in the same
database. I'm hoping that setting the locale to "C" will do the trick.
It seems to work properly on my Mac:

sharky=# select * from keyword where name = '국방비';
  id |  name  | screen_name | sort_name | active
----+--------+-------------+-----------+--------
   0 | 국방비 | 국방비      | 국방비    |      1
(1 row)

sharky=# select * from keyword where name = '북한의';
  id | name | screen_name | sort_name | active
----+------+-------------+-----------+--------
(0 rows)

sharky=# select * from keyword where name like '북한의';
  id | name | screen_name | sort_name | active
----+------+-------------+-----------+--------
(0 rows)

sharky=# select * from keyword where lower(name) like '국방비';
  id |  name  | screen_name | sort_name | active
----+--------+-------------+-----------+--------
   0 | 국방비 | 국방비      | 국방비    |      1
(1 row)

Regards,

David
Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: David Wheeler
Дата:
Сообщение: Re: UTF-8 and LIKE vs =
Следующее
От: Tom Lane
Дата:
Сообщение: Re: UTF-8 and LIKE vs =