Thread: User table porting

User table porting

From
Carol Walter
Date:
I want to recreate users with their passwords from one database
cluster on another database cluster.  What would be the best way for
me to do this?

Thanks,
Carol


Re: User table porting

From
Kevin Kempter
Date:
On Tuesday 10 March 2009 11:13:54 Carol Walter wrote:
> I want to recreate users with their passwords from one database
> cluster on another database cluster. What would be the best way for
> me to do this?
>
> Thanks,
> Carol


from the "old" server run this (where <new_db_cluster> is the new server):


pg_dumpall -g | psql -h <new_db_cluster>

Re: User table porting

From
Tom Lane
Date:
Carol Walter <walterc@indiana.edu> writes:
> I want to recreate users with their passwords from one database
> cluster on another database cluster.  What would be the best way for
> me to do this?

See pg_dumpall with -g option.

            regards, tom lane

Re: User table porting

From
Jan-Peter Seifert
Date:
Hello,

Kevin Kempter wrote:

> On Tuesday 10 March 2009 11:13:54 Carol Walter wrote:
>> I want to recreate users with their passwords from one database
>> cluster on another database cluster. What would be the best way for
>> me to do this?

> from the "old" server run this (where <new_db_cluster> is the new server):

> pg_dumpall -g | psql -h <new_db_cluster>

Isn't it generally better to use the newer binaries from the target
server especially with psql?
I remember getting quite a few errors when restoring a pg_dumpall from
an 8.1 server, because the create user syntax in the dump file was obsolete.
You might need some more options for piping (-U etc.):

http://www.postgresql.org/docs/8.3/interactive/app-pg-dumpall.html

Peter

Re: User table porting

From
Scott Marlowe
Date:
On Tue, Mar 10, 2009 at 12:29 PM, Jan-Peter Seifert
<Jan-Peter.Seifert@gmx.de> wrote:
>
> Isn't it generally better to use the newer binaries from the target
> server especially with psql?

Generally this is true.

> I remember getting quite a few errors when restoring a pg_dumpall from
> an 8.1 server, because the create user syntax in the dump file was obsolete.
> You might need some more options for piping (-U etc.):

But we're not really doing a pg_dumpall of everything, just he global
objects.  Not sure if there's any issues with a later version versus a
newer version there.  Probably best to use the newer pg_dumpall /
pg_dump than the older one though.