1

I created my database like this:

CREATE DATABASE MYDATABASE WITH ENCODING 'UTF8' LC_COLLATE='ro_RO.utf8' TEMPLATE template0;

And I have a table county populated with UTF8 county names

This query returns the result as I expect:

SELECT * from county WHERE name='Iași'; (note the comma under s, known as S-comma)

However, this query returns no result:

SELECT * from county WHERE name='Iasi'; (note that the comma has disappeared)

How should I create the database such that the second query also works? I'm switching to postgres, but when I was using MySQL, everything worked fine.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
Mihai Zamfir
  • 2,167
  • 4
  • 22
  • 37
  • 2
    possible duplicate of [Does PostgreSQL support "accent insensitive" collations?](http://stackoverflow.com/questions/11005036/does-postgresql-support-accent-insensitive-collations) – Dave Sep 06 '15 at 13:29
  • I began answering this, found that duplicate, and realised I could never possibly match it's explanation or advice. Hope that question helps. – Dave Sep 06 '15 at 13:30
  • Ha. When you were using MySQL you got the wrong results, but you wanted the wrong results, so it worked how you wanted. Funny. `Iaşi` and `Iasi` are not equal, and a database that treats them as such by default is wrong. MySQL doesn't do that, at least not recent versions, unless you configure it to by using an [*accent-insensitive (non-UCA) collation*](https://dev.mysql.com/doc/refman/5.7/en/charset-collation-implementations.html) or you're using a non-Unicode multi-byte charset. PostgreSQL, unfortunately, does not support accent-insensitive collations, you'll have to work around it. – Craig Ringer Sep 07 '15 at 04:14
  • Hey @CraigRinger I think MySQL worked correctly because I was setting collation to ``utf8_general_ci`` – Mihai Zamfir Sep 07 '15 at 14:29

0 Answers0