Re: Database encoding and collation

From: Rodrigo Barboza <rodrigombufrj(at)gmail(dot)com>
To: Craig James <cjames(at)emolecules(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Database encoding and collation
Date: 2013-04-20 17:03:11
Message-ID: CANs8QJa6gr8EOnL9njH6oq+X-=bX=ToUSxTFfj3hBzHPnmaM6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Sat, Apr 20, 2013 at 1:52 PM, Craig James <cjames(at)emolecules(dot)com> wrote:

>
> On Fri, Apr 19, 2013 at 5:12 PM, Rodrigo Barboza <rodrigombufrj(at)gmail(dot)com>wrote:
>
>> Hi guys.
>> I created a database with default encoding (SQL_ASCII) and default
>> collate (C).
>> I created a table test like this:
>> create table test (a varchar (10));
>> Then i executed "insert into teste (a) values ('áéç&ã','Æ','ß');
>>
>> After that:
>> select * from test;
>> a
>> ---------
>> áéç&ã
>> Æ
>> ß
>>
>> Why did it stora correctly if those values are not ASCII?
>>
>
> Characters are interpreted and displayed by your terminal, not the
> Postgres system. I suspect that you have language settings on whatever
> windowing system you use. Postgres merely interprets the characters you
> send as a series of 8-bit bytes. It's up to your display system to
> interpret them. If you change your display terminal's language, I expect
> you'll see something different.
>
> The language settings of Postgres don't change what is stored, only how it
> is interpreted (such as sorting).
>
> Craig
>
>
I see.
When you say "Postgres merely interprets the characters you send as a
series of 8-bit bytes", you meant for SQL_ASCII or every encoding?
Isn't sorting defined by collation?

Could I dump my database, create a new one with LATIN1 and restores?

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message chanh.tran 2013-04-22 11:27:29 Re: Pb migrating database from Postgres 8.1 to 8.4
Previous Message Craig James 2013-04-20 16:52:55 Re: Database encoding and collation