initdb -U wrongness

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: initdb -U wrongness
Date: 2006-02-22 03:24:28
Message-ID: 43FBD96C.6040307@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


I have just noticed some major wrongness about the way initdb handles
userids and the -U argument, dating apparently from an attempted bug fix
in July 2004 at version 1.42 (and thus present in both 8.0 and 8.1)

Illustration below.

I'm too tired to fix it now - will try on the weekend if I get a chaance
unless someone else jumps on it.

cheers

andrew

[andrew(at)alphonso inst.plperl-pq]$ bin/initdb -U floobl gloop
The files belonging to this database system will be owned by user "floobl".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.

creating directory gloop ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers/max_fsm_pages ... 3500/175000
creating configuration files ... ok
creating template1 database in gloop/base/1 ... ok
initializing pg_authid ... ok
enabling unlimited row size for system tables ... ok
initializing dependencies ... ok
creating system views ... ok
loading pg_description ... ok
loading pg_shdescription ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

bin/postmaster -D gloop
or
bin/pg_ctl -D gloop -l logfile start

[andrew(at)alphonso inst.plperl-pq]$ ls -la gloop
total 68
drwx------ 10 andrew andrew 4096 Feb 21 22:12 .
drwxrwxr-x 9 andrew andrew 4096 Feb 21 22:11 ..
drwx------ 5 andrew andrew 4096 Feb 21 22:12 base
drwx------ 2 andrew andrew 4096 Feb 21 22:12 global
drwx------ 2 andrew andrew 4096 Feb 21 22:11 pg_clog
-rw------- 1 andrew andrew 3396 Feb 21 22:11 pg_hba.conf
-rw------- 1 andrew andrew 1460 Feb 21 22:11 pg_ident.conf
drwx------ 4 andrew andrew 4096 Feb 21 22:11 pg_multixact
drwx------ 2 andrew andrew 4096 Feb 21 22:11 pg_subtrans
drwx------ 2 andrew andrew 4096 Feb 21 22:11 pg_tblspc
drwx------ 2 andrew andrew 4096 Feb 21 22:11 pg_twophase
-rw------- 1 andrew andrew 4 Feb 21 22:11 PG_VERSION
drwx------ 3 andrew andrew 4096 Feb 21 22:11 pg_xlog
-rw------- 1 andrew andrew 13680 Feb 21 22:11 postgresql.conf
[andrew(at)alphonso inst.plperl-pq]$ bin/pg_ctl -D gloop -l logfile start
postmaster starting
[andrew(at)alphonso inst.plperl-pq]$ bin/psql -U floobl template1
psql: FATAL: role "floobl" does not exist
[andrew(at)alphonso inst.plperl-pq]$ bin/psql template1
Welcome to psql 8.2devel, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

template1=# \du
List of roles
Role name | Superuser | Create role | Create DB | Connections | Member of
-----------+-----------+-------------+-----------+-------------+-----------
andrew | yes | yes | yes | no limit |
(1 row)

template1=# \q
[andrew(at)alphonso inst.plperl-pq]$

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2006-02-22 03:59:58 PL/pgSQL caught exceptions leak memory?
Previous Message Andrew Dunstan 2006-02-22 02:29:59 Re: windows / initdb oddness