Changing character set of existing databases

Hello,

I made a mistake an got a character set in SQL_ASCII as the defaut
encoding type :

$ psql -l
List of databases
Name | Owner | Encoding
--------------+----------+-----------
cmp_crm | openerp | SQL_ASCII
cmp_crm_demo | openerp | SQL_ASCII
cmp_testcrm | openerp | SQL_ASCII
postgres | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(6 rows)

I need to get them in UTF-8. ->
1) Can I modify these existing databases to switch them into UTF-8? How?
2) Can I modify the defaut character set to create further databases in
UTF-8 by default?

Thank you so much,
nm

--
Sent via pgsql-admin mailing list (pgsql-admin [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Nicolas Michel [ Do, 10 September 2009 15:38 ] [ ID #2015244 ]

Re: Changing character set of existing databases

--00032557b4d26b567704733a4494
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Sep 10, 2009 at 7:08 PM, Nicolas Michel <nicolas.michel [at] lemail.be>wrote:

> Hello,
>
> I made a mistake an got a character set in SQL_ASCII as the defaut encoding
> type :
>
> $ psql -l
> List of databases
> Name | Owner | Encoding
> --------------+----------+-----------
> cmp_crm | openerp | SQL_ASCII
> cmp_crm_demo | openerp | SQL_ASCII
> cmp_testcrm | openerp | SQL_ASCII
> postgres | postgres | SQL_ASCII
> template0 | postgres | SQL_ASCII
> template1 | postgres | SQL_ASCII
> (6 rows)
>
> I need to get them in UTF-8. ->
> 1) Can I modify these existing databases to switch them into UTF-8? How?
>

you can't modify the existing database encoding.


> 2) Can I modify the defaut character set to create further databases in
> UTF-8 by default?
>
>

you can change the default character set for new databases and use the below
command for creation of new database with diff encoding.

create database raghu template=template1 encoding='UTF-8';



Regards
Raghu Ram

>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin [at] postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

--00032557b4d26b567704733a4494
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br>
<div class=3D"gmail_quote">On Thu, Sep 10, 2009 at 7:08 PM, Nicolas Michel =
<span dir=3D"ltr"><<a href=3D"mailto:nicolas.michel [at] lemail.be">nicolas.m=
ichel [at] lemail.be</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hello,<br><br>I made a mistake a=
n got a character set in SQL_ASCII as the defaut encoding type :<br><br>$ p=
sql -l<br>
=A0 =A0 =A0 =A0 =A0List of databases<br>=A0 =A0 Name =A0 =A0 | =A0Owner =A0=
| Encoding<br>--------------+----------+-----------<br>=A0cmp_crm =A0 =A0 =
=A0| openerp =A0| SQL_ASCII<br>=A0cmp_crm_demo | openerp =A0| SQL_ASCII<br>=
=A0cmp_testcrm =A0| openerp =A0| SQL_ASCII<br>
=A0postgres =A0 =A0 | postgres | SQL_ASCII<br>=A0template0 =A0 =A0| postgre=
s | SQL_ASCII<br>=A0template1 =A0 =A0| postgres | SQL_ASCII<br>(6 rows)<br>=
<br>I need to get them in UTF-8. -><br>1) Can I modify these existing da=
tabases to switch them into UTF-8? How?<br>
</blockquote>
<div>=A0</div>
<div>you can't modify the existing database encoding.</div>
<div>=A0</div>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">2) Can I modify the defaut chara=
cter set to create further databases in UTF-8 by default?<br><br></blockquo=
te>

<div>=A0</div>
<div>=A0</div>
<div>you can change the default character set for new databases=A0and use t=
he below command for creation of new database with diff encoding.</div>
<div>=A0</div>
<div>=A0create database raghu template=3Dtemplate1 encoding=3D'UTF-8=
9;;</div>
<div>=A0</div>
<div>=A0</div>
<div>=A0</div>
<div>Regards</div>
<div>Raghu Ram</div>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br><font color=3D"#888888"><br>=
-- <br>Sent via pgsql-admin mailing list (<a href=3D"mailto:pgsql-admin [at] pos=
tgresql.org" target=3D"_blank">pgsql-admin [at] postgresql.org</a>)<br>
To make changes to your subscription:<br><a href=3D"http://www.postgresql.o=
rg/mailpref/pgsql-admin" target=3D"_blank">http://www.postgresql.org/mailpr=
ef/pgsql-admin</a><br></font></blockquote></div><br>

--00032557b4d26b567704733a4494--
raghu ram [ Do, 10 September 2009 16:46 ] [ ID #2015245 ]
Datenbanken » gmane.comp.db.postgresql.admin » Changing character set of existing databases

Vorheriges Thema: How to mask password when changing it using ALTER USER command inpsql.
Nächstes Thema: FW: integer import problem