Thread: Creating users in a second postgres server.

Creating users in a second postgres server.

From
"skennedy"
Date:
Hi..

I have a Solaris 2.8 machine on which I have Postgresql 7.2.4 postgres
listening on port 5432.  This works fine.

I have a user who needs a newer version and has asked specifically for
7.3.  I have compiled and installed a 7.3.4
successfully, using
./configure --prefix=/usr/local/p_sql734 --with-pg_port=5433

I created a new os user, p_sql734, group postgres (same group as the
7.2.4) and initdb works fine.
pg_ctl start shows the following output
bash-2.03$ more p_sql734.log
LOG:  database system was shut down at 2003-11-05 10:23:33 WET
LOG:  checkpoint record is at 0/83B238
LOG:  redo record is at 0/83B238; undo record is at 0/0; shutdown TRUE
LOG:  next transaction id: 480; next oid: 16976
LOG:  database system is ready

which seems to indicate that everything is fine.

The processes are alive

ps -ef |grep post
p_sql734 26503 26502  0 10:25:44 ?        0:00
/usr/local/p_sql734/bin/postmaster
postgres 27012 26760  0 10:36:26 pts/1    0:00 -bash
postgres 27386 27385  0   Oct 22 ?        0:01
/usr/local/pgsql/bin/postmaster
p_sql734 26502 26501  0 10:25:44 ?        0:00
/usr/local/p_sql734/bin/postmaster
postgres 27383     1  0   Oct 22 ?        0:02
/usr/local/pgsql/bin/postmaster
postgres 27385 27383  0   Oct 22 ?        0:00
/usr/local/pgsql/bin/postmaster
p_sql734 26501     1  0 10:25:44 ?        0:00
/usr/local/p_sql734/bin/postmaster
postgres 27231 27012  0 10:39:45 pts/1    0:00 -bash

however, when I try and create a user  I get
bash-2.03$ createuser idip_734
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n
psql: FATAL 1:  user "p_sql734" does not exist
createuser: creation of user "idip_734" failed

I tried the same thing with p_sql734 (though I don't remember having had
to create the owner in the database before) and got the same message

bash-2.03$ id
uid=122(p_sql734) gid=202(postgres)
bash-2.03$ createuser p_sql734
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) y
psql: FATAL 1:  user "p_sql734" does not exist
createuser: creation of user "p_sql734" failed


I've edited ${PGDATA}/postgresql.conf and set port=5433 to make sure
that I'm on the correct port.

I'm sure Ive missed something fairly basic but I can't find it.

Any ideas?

Thanks

Stephen.


Re: Creating users in a second postgres server.

From
Tom Lane
Date:
"skennedy" <skennedy@tissat.es> writes:
> however, when I try and create a user  I get
> bash-2.03$ createuser idip_734
> Shall the new user be allowed to create databases? (y/n) y
> Shall the new user be allowed to create more new users? (y/n) n
> psql: FATAL 1:  user "p_sql734" does not exist

Looks to me like you are talking to the old server.  Perhaps you have
PGPORT set to 5432 in your environment?  Or you got your PATH wrong,
so that you are invoking the older copy of createuser, which will
naturally default to port 5432?

            regards, tom lane

Re: Creating users in a second postgres server.

From
"skennedy"
Date:
Thanks Tom,

PGPORT was unset in the environment.
I set it to 5433 and things started to work.

If I configured the server to user 5433 before building (using --with-pg_port=5433 in configure) shouldn't the clients, etc
automatically look for port 5433?

The executables ARE the ones I compiled using 5433, (according to "which" anyway) :)

Everything seems to work now anyway but it would be interesting/useful to know what I did wrong.  Is there a trace/log
of some sort which might hold the answer?

Stephen Kennedy.

Tom Lane wrote:
"skennedy" <skennedy@tissat.es> writes: 
however, when I try and create a user  I get
bash-2.03$ createuser idip_734
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n
psql: FATAL 1:  user "p_sql734" does not exist   
Looks to me like you are talking to the old server.  Perhaps you have
PGPORT set to 5432 in your environment?  Or you got your PATH wrong,
so that you are invoking the older copy of createuser, which will
naturally default to port 5432?
		regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command   (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
 

Re: Creating users in a second postgres server.

From
Tom Lane
Date:
"skennedy" <skennedy@tissat.es> writes:
> If I configured the server to user 5433 before building (using
> --with-pg_port=5433 in configure) shouldn't the clients, etc
> automatically look for port 5433?

They should, and they do for me (I routinely run several different
versions of PG on different ports on my development machines).

Hmm ... are you sure you spelled the configure option correctly?
It should be --with-pgport=PORTNUM.  One of the less endearing aspects
of GNU autoconf is that it won't complain about unrecognized --with-foo
and --enable-foo switches.

            regards, tom lane

Re: Creating users in a second postgres server.

From
"skennedy"
Date:
Bang on Tom.

As you can see from the snippet of my mail below, I had it pg_port.
Oh well, make distclean again I suppose

Thanks.

Tom Lane wrote:

>"skennedy" <skennedy@tissat.es> writes:
>
>
>>If I configured the server to user 5433 before building (using
>>--with-pg_port=5433 in configure) shouldn't the clients, etc
>>automatically look for port 5433?
>>
>>
>
>They should, and they do for me (I routinely run several different
>versions of PG on different ports on my development machines).
>
>Hmm ... are you sure you spelled the configure option correctly?
>It should be --with-pgport=PORTNUM.  One of the less endearing aspects
>of GNU autoconf is that it won't complain about unrecognized --with-foo
>and --enable-foo switches.
>
>            regards, tom lane
>
>
>


Re: Creating users in a second postgres server.

From
Oli Sennhauser
Date:
Hello Stephen

I am actually working on a concept for this problems: Many clusters with
different versions on a server:

It consists off 3 docs and some skripts:

* Optimal Flexible Architecture (OFA) for PostgreSQL
* Flexible Environment for PostgreSQL in a Multi-Cluster-Multi-Database
(MCMD) system
* Install-Guide for PostgreSQL with pg_env

* pg_env the PostgreSQL environment for MCMD and normal PostgreSQL systems

I am unfortuneately not yet finished. I plan to give everything under
GPL/GDL and would like to ask (later) PostgreSQL community for comments
(ev. Std. Env. for PostgreSQL???). If you like I can send you a draft.

Regards Oli

-------------------------------------------------------

Oli Sennhauser
Database-Engineer (Oracle & PostgreSQL)
Rebenweg 6
CH - 8610 Uster / Switzerland

Phone (+41) 1 940 24 82 or Mobile (+41) 79 450 49 14
e-Mail oli.sennhauser@bluewin.ch
Website http://mypage.bluewin.ch/shinguz/PostgreSQL/

Secure (signed/encrypted) e-Mail with a Free Personal SwissSign ID:
http://www.swisssign.ch

Import the SwissSign Root Certificate:
http://swisssign.net/cgi-bin/trust/import


Attachment