Re: basic questions: Postgres with yum on CentOS 5.1

From: Chuck <chuckr(at)velofish(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: basic questions: Postgres with yum on CentOS 5.1
Date: 2008-01-02 02:49:40
Message-ID: p0623095ec3a0a6a279c1@[192.168.1.50]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for Tomasz and Andrew's responses (as well as one person's
response off the list). There was a lot of valuable information. I've
done some further reading in the postgres manual and I've exchanged a
few emails from my web host.

My web host recommends sticking with the CentOS repo packages for
simplicities sake. They said that I can use "yum update postgres
postgres-devel postgres-server" to upgrade when they release the new
version. This sounds fine to me. I'm not sure how to "make sure
automatic updates are turned on" as Tometzky recommended. Is that a
yum setting?

Since I have root access, I believe that I should open a root shell
use a commands like this: sudo -u postgres createdb myDB

### background:
Since I have a packaged installation, I don't believe that I will
call initdb directly. I believe the following commands the proper way
to start and stop my database server:
#start server
service postgresql start
#stop server
service postgresql stop

I executed 'service postgresql start' and got the following output:
[root(at)vs191 ~]# service postgresql start
Initializing database: [ OK ]
Starting postgresql service: [ OK ]

When I listed the current databases, I found out that UTF-8 is not being used.
[root(at)vs191 ~]# sudo -u postgres psql -l
could not change directory to "/root"
List of databases
Name | Owner | Encoding
-----------+----------+-----------
postgres | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(3 rows)

I created a test database and confirmed that it's created with
'SQL_ASCII' encoding.
[root(at)vs191 ~]# sudo -u postgres createdb myTest
could not change directory to "/root"
CREATE DATABASE
[root(at)vs191 ~]# sudo -u postgres psql -l
could not change directory to "/root"
List of databases
Name | Owner | Encoding
-----------+----------+-----------
myTest | postgres | SQL_ASCII
postgres | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(4 rows)

I found the installation location: /var/lib/pgsql/

### more info:
I need to store multiple languages in my database such as English,
French and Japanese.

The end of the "21.2.2. Setting the Character Set" section says, "One
way to use multiple encodings safely is to set the locale to C or
POSIX during initdb, thus disabling any real locale awareness."
http://www.postgresql.org/docs/8.1/interactive/multibyte.html

Without a package manager, I believe that this would be my initdb command:
sudo -u postgres initdb -D /var/lib/pgsql/data -E UTF8 --no-locale

I found the '--no-locale' option from 'initdb --help' and from this link:
http://docs.planetargon.com/PostgreSQL_Installation
I couldn't find the '--no-locale' option in the documentation.

### main question:
I think that need to figure where initdb is being called from to
modify its parameters. Or, I need to determine how to set the default
encoding to be UTF8. This might be more of a yum package question.

Thanks for your help,
Chuck

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2008-01-02 03:04:56 Re: basic questions: Postgres with yum on CentOS 5.1
Previous Message Stuart Bishop 2008-01-02 02:43:59 Re: Need help requiring uniqueness in text columns