Re: [PATCHES] PostgreSQL virtual hosting support - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [PATCHES] PostgreSQL virtual hosting support
Date
Msg-id Pine.LNX.4.21.0007110049040.28566-100000@localhost.localdomain
Whole thread Raw
List pgsql-hackers
David J. MacKenzie writes:

Greetings,

These sound like interesting features, but you need to start with the
current sources. The options handling in particular has changed, look in
src/backend/utils/misc/guc.c.

> 4. The ability to, if run as root, open a pid file in /var/run as
>    root, and then setuid to the desired user.  (mysqld -u can almost
>    do this; I had to patch it, too).

I've been wondering about this too. If we could set the user name in the
configuration file then this would certainly make the installation
procedures a lot simpler. Actually, initdb could use such an option as
well. Maybe this would work:

if test `pg_id -u` -eq 0 ; then su -l "$user" "$0 $*" exit
fi

where $user is the value of the --user/-u option.

> 1. Adds an environment variable PGUNIXSOCKET, analogous to MYSQL_UNIX_PORT,
>    and command line options -k --unix-socket to the relevant programs.

Here's the trick question, what does this do: `psql -k foo -h bar'?
Perhaps we can integrate this into the -h option:

psql -h /tmp/foo    => Unix socket
psql -h tmp.foo        => TCP/IP
psql -h foo        => TCP/IP
psql -h ./foo        => Unix socket

That way we don't have to add a new option everywhere. Just an idea.

> 2. Adds a -h option to postmaster to set the hostname or IP address to
>    listen on instead of the default INADDR_ANY.

That sounds like something that needs to be added into guc.c. You'll be
the first to add a string option, so it probably won't work. :)


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pg_backup symlink?
Next
From: "Stephan Szabo"
Date:
Subject: Re: Foreign key bugs + other problems