Index: src/bin/initdb/initdb.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/initdb/initdb.c,v
retrieving revision 1.41
diff -c -c -r1.41 initdb.c
*** src/bin/initdb/initdb.c	1 Jul 2004 00:51:36 -0000	1.41
--- src/bin/initdb/initdb.c	12 Jul 2004 01:29:19 -0000
***************
*** 1137,1143 ****
  	PG_CMD_OPEN;
  
  	if (fprintf(pg,
! 		  "ALTER USER \"%s\" WITH PASSWORD '%s';\n", username, pwd1) < 0)
  	{
  		/* write failure */
  		exit_nicely();
--- 1137,1143 ----
  	PG_CMD_OPEN;
  
  	if (fprintf(pg,
! 		  "ALTER USER \"%s\" WITH PASSWORD '%s';\n", effective_user, pwd1) < 0)
  	{
  		/* write failure */
  		exit_nicely();
***************
*** 1433,1439 ****
  	PG_CMD_OPEN;
  
  	priv_lines = replace_token(privileges_setup,
! 							   "$POSTGRES_SUPERUSERNAME", username);
  	for (line = priv_lines; *line != NULL; line++)
  		PG_CMD_PUTLINE;
  
--- 1433,1439 ----
  	PG_CMD_OPEN;
  
  	priv_lines = replace_token(privileges_setup,
! 							   "$POSTGRES_SUPERUSERNAME", effective_user);
  	for (line = priv_lines; *line != NULL; line++)
  		PG_CMD_PUTLINE;
  
***************
*** 2002,2010 ****
  		exit(1);
  	}
  
! 	effective_user = get_id();
! 	if (!strlen(username))
! 		username = effective_user;
  
  	if (strlen(encoding))
  		encodingid = get_encoding_id(encoding);
--- 2002,2011 ----
  		exit(1);
  	}
  
! 	if (strlen(username))
! 		effective_user = username;
! 	else
! 		effective_user = get_id();
  
  	if (strlen(encoding))
  		encodingid = get_encoding_id(encoding);
***************
*** 2033,2039 ****
  				PG_VERSION,
  				pg_data, share_path, bin_path,
  				encoding, encodingid,
! 				username, bki_file,
  				desc_file, conf_file,
  				hba_file, ident_file);
  		if (show_setting)
--- 2034,2040 ----
  				PG_VERSION,
  				pg_data, share_path, bin_path,
  				encoding, encodingid,
! 				effective_user, bki_file,
  				desc_file, conf_file,
  				hba_file, ident_file);
  		if (show_setting)
