سؤال

I want set my collation in postgresql with pgadmin3:

  1. how do see a list list of local collation names in Ubuntu?

  2. How do I set the collation in PgAdmin-III?

  3. I want set Persian collation for my database in Ubuntu

(I know how to create collation in pgadmin , but i don't know how to set this for my database?)

هل كانت مفيدة؟

المحلول

To list all locales on Ubuntu you can use locale -a. The linked page also shows how to configure locales.

AFAIK collation support in glibc is part of the locale/encoding configuration.

You can't alter the collation of an existing database safely or easily, because indexes etc would become suddenly invalid. To set the collation when creating a new database on an existing instance of PostgreSQL use:

CREATE DATABASE somedb 
    TEMPLATE template0
    ENCODING = 'UTF-8' 
    LC_COLLATE = 'fa_IR' 
    LC_CTYPE='fa_IR.UTF-8';

You can dump your existing DB then reload to this one.

I don't recommend trying to change the default encoding / locale of a DB on Ubuntu; you'd have to pg_dropcluster the db, then pg_createcluster a new one with different settings. Just CREATE DATABASE with appropriate settings.

I have no idea what you mean with (2), how to "set the collation in PgAdmin-III".

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top