Difference between revisions of "Talk:PostgreSQL"

From ArchWiki
Jump to: navigation, search
m (Before you start)
(Package in the repo is not fully ready for systemd: new section)
Line 41: Line 41:
  
 
This section is confusing because it assumes "postgres" user has already been created, whereas it is created by "pacman -S postgresql" issued in the following section. I'd suggest to restructure the article this way: 1. Installing PostgreSQL - with single package installation instruction only, 2. Before you start, 3. Configuring PostgreSQL --[[User:Mloskot|Mloskot]] ([[User talk:Mloskot|talk]]) 20:03, 24 March 2013 (UTC)
 
This section is confusing because it assumes "postgres" user has already been created, whereas it is created by "pacman -S postgresql" issued in the following section. I'd suggest to restructure the article this way: 1. Installing PostgreSQL - with single package installation instruction only, 2. Before you start, 3. Configuring PostgreSQL --[[User:Mloskot|Mloskot]] ([[User talk:Mloskot|talk]]) 20:03, 24 March 2013 (UTC)
 +
 +
== Package in the repo is not fully ready for systemd ==
 +
 +
The page talks about PGROOT, but if you follow the instructions it is never set. From [https://bbs.archlinux.org/viewtopic.php?id=149446 this thread] I found that a file should be created at {{ic|/etc/conf.d/postgres}} that contains the following:
 +
 +
##
 +
## Parameters to be passed to postgresql
 +
##
 +
## Default data directory location
 +
PGROOT="/var/lib/postgres"
 +
## Passed to initdb if necessary
 +
INITOPTS="--locale en_US.UTF-8"
 +
## Default log file location
 +
PGLOG="/var/log/postgresql.log"
 +
## Additional options to pass via pg_ctl's '-o' option
 +
#PGOPTS=""
 +
 +
Maybe this could go into the postgresql.conf, I dunno. All I know is that systemd will refuse to run the service if PGROOT isn't set. I'll give putting that in the conf file a try and update with results.

Revision as of 15:53, 21 June 2013

Updated this wiki to make it more clear and up-to-date. -- Evanlec

Problem with installation

I tried to install postgresql with the wiki, but i found this problem: pg_ctl: PID file "/var/lib/postgres/data/postmaster.pid" does not exist Is server running?

I searched the forums and I found out that an instruction was missed to do:

$ initdb -D /var/lib/postgres/data/

I Hope this helps for this wiki


UTF-8

Added instructions on how to create new databases as unicode by default. This seems relevant as the default "encoding" SQL_ASCII is pretty useless for most people. --Cabrilo 06:15, 11 January 2010 (EST)

Is step 4 correct? Elipsion 08:15, 13 January 2010 (EST)

  • Good catch. Obviously it wasn't, datistemplate should've been set to TRUE for that database. Thanks for noticing it, I fixed it. --Cabrilo 12:00, 13 January 2010 (EST)

Is this section still necessary? I am just learning, but did a "show client_encoding" on template1 and it returns UTF8 out of the box. --Nitmd 11:55, 18 September 2010 (CDT)

I think it's still necessary (and thank you for making this section). Just removed "vacuum freeze", since it's no longer recommended and the command will be obsolete in future releases of postgresql. BTW: I ran into a problem with the statement to disallow connections to the template1 database. This is because I wanted to build a new database named "postgres". After dropping the postgresql db, creating a new template1 and disallowing the connections to template1, I had no database to connect to, so I couldn't create a new database. Had to delete the data dir and start over.Tankgrun 10:07, 12 August 2011 (EDT)

Better systemd support

The wiki is out dated and the package will most certainly not work with systemd without tinkering with the service files. This article needs a re-write. --Newonelectron

Installing PostgreSQL -> reboot not necessary

"Reboot the system to automatically create the file tmpfiles.d for /run/postgresql". I believe "systemd-tmpfiles --create" is enough to create /run/postfix without reboot. But I'm not confident enough to change it without asking first :). --Hiciu (talk) 13:35, 26 November 2012 (UTC)

edit: well, I was wrong. "systemd-tmpfiles --create" creates /run/postgresql, but it also (at least for me) breaks sudo so reboot is necessary anyway (sudo, after asking for password, returns "System is booting up."). --Hiciu (talk) 13:46, 26 November 2012 (UTC)

edit: correct command is "sudo systemd-tmpfiles --create /usr/lib/tmpfiles.d/postgresql.conf" --Hiciu (talk) 14:01, 26 November 2012 (UTC)

Before you start

This section is confusing because it assumes "postgres" user has already been created, whereas it is created by "pacman -S postgresql" issued in the following section. I'd suggest to restructure the article this way: 1. Installing PostgreSQL - with single package installation instruction only, 2. Before you start, 3. Configuring PostgreSQL --Mloskot (talk) 20:03, 24 March 2013 (UTC)

Package in the repo is not fully ready for systemd

The page talks about PGROOT, but if you follow the instructions it is never set. From this thread I found that a file should be created at /etc/conf.d/postgres that contains the following:

##
## Parameters to be passed to postgresql
##
## Default data directory location
PGROOT="/var/lib/postgres"
## Passed to initdb if necessary
INITOPTS="--locale en_US.UTF-8"
## Default log file location
PGLOG="/var/log/postgresql.log"
## Additional options to pass via pg_ctl's '-o' option
#PGOPTS=""

Maybe this could go into the postgresql.conf, I dunno. All I know is that systemd will refuse to run the service if PGROOT isn't set. I'll give putting that in the conf file a try and update with results.