In my digging around in initdb, I came to the --username option, which
supposedly allows you to initialize the database system with another
username. Not a bad idea, really.
Obviously, you'd have to be root in that case, because you want to create
files in someone else's name. But if you are root, the backends will
refuse to execute, wisely so. So this option is totally broken.
I propose that I remove it, and that it instead be possible that you can
do
root# su -l postgres -c 'initdb ...'
if you are not a fan of logging in and out of user accounts during the
install process.
That would also remove a whole bunch of the username/id checking logic,
since you just use the user you're logged in as ($UID, $USER), and if the
backend doesn't like it, it will tell you. pg_id adieu.
Another question: Is there a reason why the system views in initdb are all
created with a CREATE TABLE and then with a CREATE RULE, instead of using
CREATE VIEW? Is that a left over from the time before there were views as
such?
Question 3: Is there a reason why the template1 database is vacuumed twice
in the process? Once before all the views are created (no analyze) and
once at the very end (with analyze).
--
Peter Eisentraut Sernanders väg 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden