2013-10-17 7 views
6

में कैसे मैं मिलान, CTYPE को बदल सकता हूँ - en_INen_US.UTF-8बदलें डाटाबेस मिलान, CTYPE Postgresql

       List of databases 
    Name | Owner | Encoding | Collation | Ctype | Access privileges 
-----------+----------+----------+-------------+-------------+----------------------- 
postgres | postgres | UTF8  | en_US.UTF-8 | en_US.UTF-8 | 
template0 | postgres | UTF8  | en_US.UTF-8 | en_US.UTF-8 | =c/postgres 
                  : postgres=CTc/postgres 
template1 | postgres | UTF8  | en_US.UTF-8 | en_US.UTF-8 | =c/postgres 
                  : postgres=CTc/postgres 

मेरे वर्तमान postgresversion से 8.4 Ive

sudo apt-get install postgresql-8.4 postgresql-contrib-8.4 

im में ऐसा करने का उपयोग कर यह स्थापित है मेरा यूबंटू अमेज़ॅन सर्वर ec2

+0

आप डेटाबेस संयोजन को बदल नहीं सकते हैं। नए collation –

+0

के साथ डेटाबेस को फिर से बनाने (डंप/पुनः लोड) करने की आवश्यकता है जब मैं इसे करने में असमर्थ en_IN के साथ डेटाबेस बनाने का प्रयास करता हूं :( –

+0

वर्तमान में सर्वर के रूप में अपने स्थानीय सिस्टम का उपयोग कर रहा हूं .. और पहले से चल रहा है अब मुझे अमेज़ॅन से नया यूबंटू 12.04 अमेज़ॅन ec2 इंस्टेंस मिला है और मैं अपने सर्वर को स्थानांतरित करने की कोशिश कर रहा हूं। तो आप कैसे कहें कि मुझे ऐसा करना चाहिए? कृपया –

उत्तर

6

मेरी सिफारिश:

  1. एक pg_dumpall ले

  2. फिर से प्रारंभ db क्लस्टर, सुनिश्चित करें कि स्थान जानकारी सही है

  3. अपने डंप बहाल बना रही है।

मैं ने पाया है कि कभी कभी यह संभव है एक एक गैर init-db स्थान का उपयोग करने के टेम्पलेट template0 (बैश से -टी template0 या WITH TEMPLATE template0 psql से) के साथ एक डाटाबेस बनाने के लिए हो सकता है।

+0

मुझे बिंदु 2 –

+0

समझ में नहीं आया आप निश्चित रूप से दस्तावेज़ों को पढ़ना चाहते हैं और देखें कि आपका सिस्टम लोकेल कैसे स्थापित किया गया है, लेकिन आप आम तौर पर: 'initdb --lc-collate en_IN --lc-ctype en_IN -D .... ' –

3

पूरे डेटाबेस क्लस्टर को पुन: बनाना आवश्यक नहीं है। हालांकि आपको अपने डेटाबेस को फिर से बनाने की आवश्यकता है। इन विकल्पों के साथ

भागो createdb (man createdb):

-E encoding, --encoding=encoding 
     Specifies the character encoding scheme to be used in this 
     database. The character sets supported by the PostgreSQL server 
     are described in Section 22.3.1, “Supported Character Sets”, in 
     the documentation. 

    -l locale, --locale=locale 
     Specifies the locale to be used in this database. This is 
     equivalent to specifying both --lc-collate and --lc-ctype. 

    --lc-collate=locale 
     Specifies the LC_COLLATE setting to be used in this database. 

    --lc-ctype=locale 
     Specifies the LC_CTYPE setting to be used in this database. 

यह क्या तुम सच में लगता है एक मौजूदा डेटाबेस का मिलान नहीं बदल सकते:

=> ALTER DATABASE dbname SET "Collate" To Russian; 
ERROR: unrecognized configuration parameter "Collate" 

ध्यान दें कि आप एक के लिए मिलान सेट कर सकते हैं टेबल या कॉलम, PostgreSQL में collations पर एक अच्छा tutorial देखें।

संबंधित मुद्दे