Skip site navigation (1) Skip section navigation (2)

Re: UTF-8 and LIKE vs =

From: David Wheeler <david(at)kineticode(dot)com>
To: Ian Barwick <barwick(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: UTF-8 and LIKE vs =
Date: 2004-08-23 21:04:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Aug 23, 2004, at 1:58 PM, Ian Barwick wrote:

> er, the characters in "name" don't seem to match the characters in the
> query - '국방비' vs. '북한의' - does that have any bearing?

Yes, it means that = is doing the wrong thing!!

I noticed this because I had a query that was looking in the keyword 
table for an existing record using LIKE. If it didn't find it, it 
inserted it. But the inserts were giving me an error because the name 
column has a UNIQUE index on it. Could it be that the index and the = 
operator are comparing bytes, and that '국방비' and '북한의' have the same 
bytes but different characters??

If so, this is a pretty serious problem. How can I get = and the 
indices to use character semantics rather than byte semantics? I also 
need to be able to store data in different languages in the database 
(and in the same column!), but all in Unicode.



In response to


pgsql-general by date

Next:From: Carlos MorenoDate: 2004-08-23 21:06:15
Subject: Deadlocks -- what can I do about them?
Previous:From: Ian BarwickDate: 2004-08-23 20:58:45
Subject: Re: UTF-8 and LIKE vs =

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group