Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how can i change encoding in template1 DB?

0 views
Skip to first unread message

Nando67

unread,
Dec 12, 2009, 8:32:34 AM12/12/09
to
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

Scott Marlowe

unread,
Dec 12, 2009, 2:41:49 PM12/12/09
to
On Sat, Dec 12, 2009 at 6:32 AM, Nando67 <xxx...@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.

--
Sent via pgsql-general mailing list (pgsql-...@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Scott Marlowe

unread,
Dec 12, 2009, 2:43:01 PM12/12/09
to
******************************
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...@zzz.it> wrote:

> --
> Sent via pgsql-general mailing list (pgsql-...@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.

Adrian Klaver

unread,
Dec 12, 2009, 2:47:02 PM12/12/09
to

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
akl...@comcast.net

Nando67

unread,
Dec 12, 2009, 3:54:05 PM12/12/09
to
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...@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

Nando67

unread,
Dec 12, 2009, 4:01:00 PM12/12/09
to
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:

Nando67

unread,
Dec 12, 2009, 4:08:15 PM12/12/09
to
Thank you, Adrian

i solve my problem

thanks for you post anyway

Bye


Adrian Klaver ha scritto:

Adrian Klaver

unread,
Dec 12, 2009, 5:54:59 PM12/12/09
to
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.

Nando67

unread,
Dec 13, 2009, 9:46:38 AM12/13/09
to
Thanks, Adrian

i'll keep in mind your post

many thanks

Adrian Klaver ha scritto:

0 new messages