Thread: Default encoding in database

Default encoding in database

From
"Jacob Vennervald Madsen"
Date:
Hi List

I'm using PostgreSQL version PostgreSQL 7.1.2
When I create a new database it's made with SQL_ASCII by default.
What do I have to do to make LATIN1 the default encoding?
This is how I configured Postgres
./configure --with-java --enable-odbc --enable-multibyte=LATIN1
--enable-locale --enable-unicode-conversion

Can anybody help me?

Best regards,
Jacob Vennervald Madsen
Mobile Systems Developer

GoPinocchio
Norrebrogade 45
DK-2200 Copenhagen
www.gopinocchio.com
+45 26750106

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Re: Default encoding in database

From
Tatsuo Ishii
Date:
> I'm using PostgreSQL version PostgreSQL 7.1.2
> When I create a new database it's made with SQL_ASCII by default.
> What do I have to do to make LATIN1 the default encoding?
> This is how I configured Postgres
> ./configure --with-java --enable-odbc --enable-multibyte=LATIN1
> --enable-locale --enable-unicode-conversion

I guess you have multibyte disabled or not configured as
"--enable-multibyte=LATIN1" another PostgreSQL somewhere.

Or you have done initdb with such PostgreSQL.

How does the output from "psql -l" look like?
--
Tatsuo Ishii

RE: Default encoding in database

From
Tatsuo Ishii
Date:
> > How does the output from "psql -l" look like?
>          List of databases
>   Database  |  Owner   | Encoding
> ------------+----------+-----------
>  template0  | postgres | SQL_ASCII
>  template1  | postgres | SQL_ASCII
> Jacob

I don't know why your template1 DB's encoding is SQL_ASCII, but you
need to change the encoding of the DB anyway.

try:

psql -c "update pg_database set encoding = 7 where datname =
'template1'" template1
--
Tatsuo Ishii

RE: Default encoding in database

From
"Jacob Vennervald Madsen"
Date:
If I do rebuild it with initdb will I still have all my data?

Jacob

-----Original Message-----
From: Karel Zak [mailto:zakkr@zf.jcu.cz]
Sent: 30. august 2001 11:03
To: Tatsuo Ishii
Cc: Jacob Vennervald Madsen; pgsql-general@postgresql.org
Subject: Re: Default encoding in database


On Thu, Aug 30, 2001 at 05:28:16PM +0900, Tatsuo Ishii wrote:
> > > How does the output from "psql -l" look like?
> >          List of databases
> >   Database  |  Owner   | Encoding
> > ------------+----------+-----------
> >  template0  | postgres | SQL_ASCII
> >  template1  | postgres | SQL_ASCII
> > Jacob
>
> I don't know why your template1 DB's encoding is SQL_ASCII, but you
> need to change the encoding of the DB anyway.
>
> try:
>
> psql -c "update pg_database set encoding = 7 where datname =
> 'template1'" template1

IMHO more careful is re-build it by initdb with option -E LATIN1.

        KArel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

Re: Default encoding in database

From
Karel Zak
Date:
On Thu, Aug 30, 2001 at 05:28:16PM +0900, Tatsuo Ishii wrote:
> > > How does the output from "psql -l" look like?
> >          List of databases
> >   Database  |  Owner   | Encoding
> > ------------+----------+-----------
> >  template0  | postgres | SQL_ASCII
> >  template1  | postgres | SQL_ASCII
> > Jacob
>
> I don't know why your template1 DB's encoding is SQL_ASCII, but you
> need to change the encoding of the DB anyway.
>
> try:
>
> psql -c "update pg_database set encoding = 7 where datname =
> 'template1'" template1

IMHO more careful is re-build it by initdb with option -E LATIN1.

        KArel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

Re: Default encoding in database

From
Karel Zak
Date:
On Thu, Aug 30, 2001 at 11:04:39AM +0200, Jacob Vennervald Madsen wrote:
> If I do rebuild it with initdb will I still have all my data?

 No of course, initdb create everything again... but if you have
only templates DB you probably haven't some data, else you must
dump all your DB and backup it and rebuild templates.

> > >          List of databases
> > >   Database  |  Owner   | Encoding
> > > ------------+----------+-----------
> > >  template0  | postgres | SQL_ASCII
> > >  template1  | postgres | SQL_ASCII
> > > Jacob

 BTW, I don't understand why you don't create new databases by
CREATE DATABASE bar WITH ENCODING = 'foo' or by "createdb -E".

            Karel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz