Thread: how can i change encoding in template1 DB?

how can i change encoding in template1 DB?

From
Nando67
Date:
I installed postgresql by pacman (i'm using an ArchLinux Distr)
the default encoding of template1 is SQL_ASCII, i want to change this
one with UTF8 encoding

i try to use ALTER DATABASE but this statemanent hasn't the clause
encoding (while the CREATE DATABASE has it) so i can't modify the
template1 db by this one.

how can i do it?

many thanks

nando

Re: how can i change encoding in template1 DB?

From
Scott Marlowe
Date:
On Sat, Dec 12, 2009 at 6:32 AM, Nando67 <xxx.yyy@zzz.it> wrote:
> I installed postgresql by pacman (i'm using an ArchLinux Distr)
> the default encoding of template1 is SQL_ASCII, i want to change this
> one with UTF8 encoding
>
> i try to use ALTER DATABASE but this statemanent hasn't the clause
> encoding (while the CREATE DATABASE has it) so i can't modify the
> template1 db by this one.

I think you'll have to drop it and then create database with template0
as the template and set encoding then.

Re: how can i change encoding in template1 DB?

From
Scott Marlowe
Date:
******************************
PLEASE do not send emails to the list from a bogus email address.  If
you have spam considerations there are other, more polite ways of
handling it.


On Sat, Dec 12, 2009 at 6:32 AM, Nando67 <xxx.yyy@zzz.it> wrote:
> I installed postgresql by pacman (i'm using an ArchLinux Distr)
> the default encoding of template1 is SQL_ASCII, i want to change this
> one with UTF8 encoding
>
> i try to use ALTER DATABASE but this statemanent hasn't the clause
> encoding (while the CREATE DATABASE has it) so i can't modify the
> template1 db by this one.
>
> how can i do it?
>
> many thanks
>
> nando
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>



--
When fascism comes to America, it will be intolerance sold as diversity.

Re: how can i change encoding in template1 DB?

From
Adrian Klaver
Date:
On Saturday 12 December 2009 5:32:34 am Nando67 wrote:
> I installed postgresql by pacman (i'm using an ArchLinux Distr)
> the default encoding of template1 is SQL_ASCII, i want to change this
> one with UTF8 encoding
>
> i try to use ALTER DATABASE but this statemanent hasn't the clause
> encoding (while the CREATE DATABASE has it) so i can't modify the
> template1 db by this one.
>
> how can i do it?
>
> many thanks
>
> nando

First I would run the locale command.
Ex:
aklaver@tucker:~$ locale
LANG=en_US.UTF-8
LANGUAGE=en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


Then I would read the Notes section of:
http://www.postgresql.org/docs/8.4/interactive/sql-createdatabase.html
There is a description of the various issues that can arise with the interaction
of database encoding and locale settings.

Then I would post here again to ask about your preferred db encoding and if it
is possible with the locale information from the first step.

--
Adrian Klaver
aklaver@comcast.net

Re: how can i change encoding in template1 DB?

From
Nando67
Date:
Thank you, Adrian

i solve my problem

thanks for you post anyway

Bye


Adrian Klaver ha scritto:
> On Saturday 12 December 2009 5:32:34 am Nando67 wrote:

>
> Then I would read the Notes section of:
> http://www.postgresql.org/docs/8.4/interactive/sql-createdatabase.html
> There is a description of the various issues that can arise with the interaction
> of database encoding and locale settings.
>
> Then I would post here again to ask about your preferred db encoding and if it
> is possible with the locale information from the first step.
>

Re: how can i change encoding in template1 DB?

From
Nando67
Date:
thank you Scott,

what i needed of i found it to the follow link

http://www.postgresql.org/docs/8.2/static/app-initdb.html

so

1. i stopped postgres daemon
2. i removed the PGROOT directory
3. i modified the start-up script at the line where there is the initdb
comand:
- (removed line) . su - postgres -c "/usr/bin/initdb -D $PGROOT/data"
- (insert line)  . su - postgres -c "/usr/bin/initdb -D $PGROOT/data -E
UTF8"
4. i start postgres daemon
5. there is the init procedure
6. execute the "$psql -l" comand (under postgres user) and it's all ok i
see the template1 encoding set to UTF8 as i desired



Scott Marlowe ha scritto:
> On Sat, Dec 12, 2009 at 6:32 AM, Nando67 <xxx.yyy@zzz.it> wrote:
>
> I think you'll have to drop it and then create database with template0
> as the template and set encoding then.
>

now, i'll try also this way

many thanks

Bye

Re: how can i change encoding in template1 DB?

From
Nando67
Date:
Hi, scott


i've just tried to remove the e-mail field from my client newsgroup but
after it i can't send message!

sorry, but what do i have to do to satisfy your request?

I wouldn't put my e-mail, is it possible?

Hi

Nando


Scott Marlowe ha scritto:
> ******************************
> PLEASE do not send emails to the list from a bogus email address.  If
> you have spam considerations there are other, more polite ways of
> handling it.
>
>
> On Sat, Dec 12, 2009 at 6:32 AM, Nando67 <xxx.yyy@zzz.it> wrote:

Re: how can i change encoding in template1 DB?

From
Adrian Klaver
Date:
On Saturday 12 December 2009 1:08:15 pm Nando67 wrote:
> Thank you, Adrian
>
> i solve my problem
>
> thanks for you post anyway
>
> Bye
>
>

I would still go read the section I pointed you at earlier as well as this:
http://www.postgresql.org/docs/8.4/interactive/charset.html

You may find you have not solved all your problems.


--
Adrian Klaver
aklaver@comcast.net

Re: how can i change encoding in template1 DB?

From
Nando67
Date:
Thanks, Adrian

i'll keep in mind your post

many thanks

Adrian Klaver ha scritto:
> On Saturday 12 December 2009 1:08:15 pm Nando67 wrote:
>
> I would still go read the section I pointed you at earlier as well as this:
> http://www.postgresql.org/docs/8.4/interactive/charset.html
>
> You may find you have not solved all your problems.
>
>