Re: Restore option disabled for non-superuser

From: Konstantin Pelepelin <cat(at)dtf(dot)ru>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: pgadmin-support(at)postgresql(dot)org
Subject: Re: Restore option disabled for non-superuser
Date: 2010-12-15 10:35:43
Message-ID: 4D0899FF.1020107@dtf.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

15.12.2010 9:48, Guillaume Lelarge пишет:
> Le 14/12/2010 22:35, Konstantin Pelepelin a écrit :
>> PgAdmin 1.12.2 on WindowsXP
>> postgresql 9.0 on linux
>>
>> When connecting as 'postgres', 'Restore' option is available, but when
>> connecting as 'testuser' (simple user, nocreatedb), even for database
>> owned by testuser, restore options are greyed out.
>>
>> I think they should not be disabled, in many scenarios db may be
>> restored by non-superuser.
>>
>
> I didn't checked, don't have the time right now. But I read the source
> code. It seems you only need to have the CREATE priviledge in the
> database. So no need to be superuser or to have the createdb priviledge,
> but you need to be a user who can create objects in that database. Which
> seems fine to me.

I can restore with pg_restore, but cannot with pgadmin in my case.

I do no specific rights management usually. I don't know much about
them, but seems it's not enough.

I do simple steps. PG is installed from rpm, local connections are
'trust' and remote are 'md5' in pg_hba.conf. createuser, set passwords

Then I create DB locally with
createdb -U postgres -E KOI8 --locale ru_RU.KOI8-R --template template0
testdb
I don't think locale setting matters here, so it could be simply
createdb -U postgres testdb

Then I restore a database remotely with command
pg_restore -h server -1 -U testuser -v -S postgres --disable-triggers
--no-owner -Ft -d testdb -L pg_restore_list.txt backup.tar

And everything is restored fine.

But option 'restore' is disabed in pgadmin if I log in as testuser. (And
if I log in as postgres, I cannot use --no-owner to reset all ownership
to testuser, so it seems I would have to change owners by some script)

Thanks,
Konstantin

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Erasmo Zottola - Elman 2010-12-16 10:20:17 Compare DB schema
Previous Message Guillaume Lelarge 2010-12-15 06:48:50 Re: Restore option disabled for non-superuser