Обсуждение: Restore option disabled for non-superuser
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. Konstantin Pelepelin
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. -- Guillaumehttp://www.postgresql.frhttp://dalibo.com
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
Le 15/12/2010 11:35, Konstantin Pelepelin a écrit : > 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) > Actually, you were right. I fixed the issue. Thanks for your report. -- Guillaumehttp://www.postgresql.frhttp://dalibo.com