pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedselect * from pgadmin_users; causes error
10+ messages / 3 participants
[nested] [flat]
* select * from pgadmin_users; causes error
@ 2001-02-23 01:35 John Hatfield <jhatfield@g-s.com.au>
0 siblings, 1 reply; 10+ messages in thread
From: John Hatfield @ 2001-02-23 01:35 UTC (permalink / raw)
To: pgsql-admin
Hi
I'm new to postgresql.
When logged in as postgres (using psql)the following query returns an error
gsmain_test=# select * from pgadmin_users;
ERROR: pg_shadow: Permission denied.
I can select from pg_user and pg_shadow.
The reason I am trying to run the above query is I had the same error when trying to view users/groups from pgAdmin.
The database was created using user postgres
My system
Linux Box
Postgresql 7.0.3-2 installed from rpms
Redhat 7.0
Win98 Box
pgAdmin v7.0.5
odbc driver 6.50.00.00
mdac 2.6
Thanks in advance
John
^ permalink raw reply [nested|flat] 10+ messages in thread
* FW: select * from pgadmin_users; causes error
@ 2001-02-23 03:56 John Hatfield <jhatfield@g-s.com.au>
0 siblings, 0 replies; 10+ messages in thread
From: John Hatfield @ 2001-02-23 03:56 UTC (permalink / raw)
To: pgsql-admin
Seem to have fixed the problem by dropping and re-creating the database.
Thanks.
John
-----Original Message-----
From: John Hatfield
Sent: Friday, 23 February 2001 11:35 AM
To: 'PostgreSQL Admin News'
Subject: [ADMIN] select * from pgadmin_users; causes error
Hi
I'm new to postgresql.
When logged in as postgres (using psql)the following query returns an error
gsmain_test=# select * from pgadmin_users;
ERROR: pg_shadow: Permission denied.
I can select from pg_user and pg_shadow.
The reason I am trying to run the above query is I had the same error when trying to view users/groups from pgAdmin.
The database was created using user postgres
My system
Linux Box
Postgresql 7.0.3-2 installed from rpms
Redhat 7.0
Win98 Box
pgAdmin v7.0.5
odbc driver 6.50.00.00
mdac 2.6
Thanks in advance
John
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: select * from pgadmin_users; causes error
@ 2001-02-23 05:00 Tom Lane <tgl@sss.pgh.pa.us>
parent: John Hatfield <jhatfield@g-s.com.au>
0 siblings, 0 replies; 10+ messages in thread
From: Tom Lane @ 2001-02-23 05:00 UTC (permalink / raw)
To: jhatfield@g-s.com.au <jhatfield@g-s.com.au>; +Cc: pgsql-admin
John Hatfield <jhatfield@g-s.com.au> writes:
> When logged in as postgres (using psql)the following query returns an error
> gsmain_test=# select * from pgadmin_users;
> ERROR: pg_shadow: Permission denied.
pgadmin_users is a view, no? Which user was it created by? Views
execute with the permissions of the creating user, for reasons that
should be apparent after some thought.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* RE: select * from pgadmin_users; causes error
@ 2001-02-23 05:30 John Hatfield <jhatfield@g-s.com.au>
0 siblings, 1 reply; 10+ messages in thread
From: John Hatfield @ 2001-02-23 05:30 UTC (permalink / raw)
To: 'Tom Lane' <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
Yes your right. Thanks.
It looks as though the views are created the first time you login to
pgAdmin. So when I logged first as an ordinary user not as the postgres
(database superuser), the views were created with this user as the owner.
A trap for beginners!!
regards
John
-----Original Message-----
From: Tom Lane
Sent: Friday, 23 February 2001 3:01 PM
To: jhatfield@g-s.com.au
Cc: 'PostgreSQL Admin News'
Subject: Re: [ADMIN] select * from pgadmin_users; causes error
John Hatfield <jhatfield@g-s.com.au> writes:
> When logged in as postgres (using psql)the following query returns an
error
> gsmain_test=# select * from pgadmin_users;
> ERROR: pg_shadow: Permission denied.
pgadmin_users is a view, no? Which user was it created by? Views
execute with the permissions of the creating user, for reasons that
should be apparent after some thought.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: select * from pgadmin_users; causes error
@ 2001-02-23 15:23 Tom Lane <tgl@sss.pgh.pa.us>
parent: John Hatfield <jhatfield@g-s.com.au>
0 siblings, 0 replies; 10+ messages in thread
From: Tom Lane @ 2001-02-23 15:23 UTC (permalink / raw)
To: jhatfield@g-s.com.au <jhatfield@g-s.com.au>; +Cc: pgsql-admin; Dave Page <dpage@vale-housing.co.uk>
John Hatfield <jhatfield@g-s.com.au> writes:
> It looks as though the views are created the first time you login to
> pgAdmin. So when I logged first as an ordinary user not as the postgres
> (database superuser), the views were created with this user as the owner.
> A trap for beginners!!
Indeed. I wonder whether pgadmin actually needs to see the password
column. If not, perhaps it could make a view of pg_user instead of
pg_shadow to avoid this problem. If it does, selecting directly from
pg_shadow with no view seems like the most reliable way...
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* RE: select * from pgadmin_users; causes error
@ 2001-02-23 21:00 Dave Page <dpage@vale-housing.co.uk>
0 siblings, 1 reply; 10+ messages in thread
From: Dave Page @ 2001-02-23 21:00 UTC (permalink / raw)
To: 'Tom Lane' <tgl@sss.pgh.pa.us>; jhatfield@g-s.com.au; +Cc: pgsql-admin
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: 23 February 2001 15:23
> To: jhatfield@g-s.com.au
> Cc: 'PostgreSQL Admin News'; Dave Page
> Subject: Re: [ADMIN] select * from pgadmin_users; causes error
>
>
> John Hatfield <jhatfield@g-s.com.au> writes:
> > It looks as though the views are created the first time you
> login to
> > pgAdmin. So when I logged first as an ordinary user not as
> the postgres
> > (database superuser), the views were created with this user
> as the owner.
>
> > A trap for beginners!!
>
> Indeed. I wonder whether pgadmin actually needs to see the password
> column. If not, perhaps it could make a view of pg_user instead of
> pg_shadow to avoid this problem. If it does, selecting directly from
> pg_shadow with no view seems like the most reliable way...
>
> regards, tom lane
pgAdmin uses the view for a couple of reasons:
1) It is one of a set of views that are created and upgraded as required by
pgAdmin to simplify updating pgAdmin if the PostgreSQL system tables change
from version to version (there are loads of queries in pgAdmin, so upgrading
for a new release is far easier if I just have to update one set of views).
2) pgadmin_users includes the OID of the user tuple in pg_users which is not
in pg_shadow.
The problem in question has been fixed in the current dev code of pgAdmin
(as it has been noted as an issue by a couple of other users), soon to be
released as v7.1.0. Basically it isn't so much as the user ID that created
the views that is an issue, it's that fact that pgAdmin then didn't issue a
'GRANT ALL ON pgadmin_users TO PUBLIC'.
It may help to know that all pgAdmin created SSOs (we dubbed them Server
Side Objects 'cos it sounded good!) can be dropped and recreated using the
options on the Advanced Menu. This may be useful when preparing a finished
database for release to a customer for example.
Regards, Dave.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: select * from pgadmin_users; causes error
@ 2001-02-23 21:07 Tom Lane <tgl@sss.pgh.pa.us>
parent: Dave Page <dpage@vale-housing.co.uk>
0 siblings, 0 replies; 10+ messages in thread
From: Tom Lane @ 2001-02-23 21:07 UTC (permalink / raw)
To: Dave Page <dpage@vale-housing.co.uk>; +Cc: pgsql-admin
Dave Page <dpage@vale-housing.co.uk> writes:
> Basically it isn't so much as the user ID that created
> the views that is an issue, it's that fact that pgAdmin then didn't issue a
> 'GRANT ALL ON pgadmin_users TO PUBLIC'.
The particular case being complained of here would not be fixed by that.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* RE: select * from pgadmin_users; causes error
@ 2001-02-23 22:04 Dave Page <dpage@vale-housing.co.uk>
0 siblings, 1 reply; 10+ messages in thread
From: Dave Page @ 2001-02-23 22:04 UTC (permalink / raw)
To: 'Tom Lane' <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: 23 February 2001 21:07
> To: Dave Page
> Cc: jhatfield@g-s.com.au; 'PostgreSQL Admin News'
> Subject: Re: [ADMIN] select * from pgadmin_users; causes error
>
>
> Dave Page <dpage@vale-housing.co.uk> writes:
> > Basically it isn't so much as the user ID that created
> > the views that is an issue, it's that fact that pgAdmin
> then didn't issue a
> > 'GRANT ALL ON pgadmin_users TO PUBLIC'.
>
> The particular case being complained of here would not be
> fixed by that.
>
What exactly was the problem? I must have missed an earlier part of the
thread as I don't read pgsql-admin - I barely get time to read ODBC &
Interfaces :-(
Regards, Dave.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: select * from pgadmin_users; causes error
@ 2001-02-23 22:28 Tom Lane <tgl@sss.pgh.pa.us>
parent: Dave Page <dpage@vale-housing.co.uk>
0 siblings, 0 replies; 10+ messages in thread
From: Tom Lane @ 2001-02-23 22:28 UTC (permalink / raw)
To: Dave Page <dpage@vale-housing.co.uk>; +Cc: pgsql-admin
Dave Page <dpage@vale-housing.co.uk> writes:
> Basically it isn't so much as the user ID that created
> the views that is an issue, it's that fact that pgAdmin
>> then didn't issue a
>> 'GRANT ALL ON pgadmin_users TO PUBLIC'.
>>
>> The particular case being complained of here would not be
>> fixed by that.
>>
> What exactly was the problem?
The problem was that pgadmin was first started in a particular database
by a non-privileged user. So it created the pgadmin_users view as owned
by that non-privileged user. Then the view does not work, even for the
superuser, because its attempt to access pg_shadow is checked under the
permissions of its owner not of the invoker.
Deleting and recreating the view (to make it owned by the superuser)
will fix this problem, and I'm glad to hear that pgadmin provides a
reasonably painless way to do that. But the average Joe isn't going to
realize what the problem is or what he has to do to fix it. It'd be
better if the problem couldn't occur in the first place. If you really
need a view on pg_shadow, can you postpone creating it until you are run
as superuser?
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* RE: select * from pgadmin_users; causes error
@ 2001-02-23 22:48 Dave Page <dpage@vale-housing.co.uk>
0 siblings, 0 replies; 10+ messages in thread
From: Dave Page @ 2001-02-23 22:48 UTC (permalink / raw)
To: 'Tom Lane' <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: 23 February 2001 22:29
> To: Dave Page
> Cc: jhatfield@g-s.com.au; 'PostgreSQL Admin News'
> Subject: Re: [ADMIN] select * from pgadmin_users; causes error
>
>
> Dave Page <dpage@vale-housing.co.uk> writes:
> > Basically it isn't so much as the user ID that created
> > the views that is an issue, it's that fact that pgAdmin
> >> then didn't issue a
> >> 'GRANT ALL ON pgadmin_users TO PUBLIC'.
> >>
> >> The particular case being complained of here would not be
> >> fixed by that.
> >>
>
> > What exactly was the problem?
>
> The problem was that pgadmin was first started in a
> particular database
> by a non-privileged user. So it created the pgadmin_users
> view as owned
> by that non-privileged user. Then the view does not work,
> even for the
> superuser, because its attempt to access pg_shadow is checked
> under the
> permissions of its owner not of the invoker.
Hmm yes. I've just been playing with it and that is exactly the case.
> Deleting and recreating the view (to make it owned by the superuser)
> will fix this problem, and I'm glad to hear that pgadmin provides a
> reasonably painless way to do that. But the average Joe
> isn't going to
> realize what the problem is or what he has to do to fix it. It'd be
> better if the problem couldn't occur in the first place. If
> you really
> need a view on pg_shadow, can you postpone creating it until
> you are run
> as superuser?
That shouldn't be a major problem, I'll look into it for the next release.
Regards,
Dave.
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2001-02-23 22:48 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-23 01:35 select * from pgadmin_users; causes error John Hatfield <jhatfield@g-s.com.au>
2001-02-23 05:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-02-23 03:56 FW: select * from pgadmin_users; causes error John Hatfield <jhatfield@g-s.com.au>
2001-02-23 05:30 RE: select * from pgadmin_users; causes error John Hatfield <jhatfield@g-s.com.au>
2001-02-23 15:23 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-02-23 21:00 RE: select * from pgadmin_users; causes error Dave Page <dpage@vale-housing.co.uk>
2001-02-23 21:07 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-02-23 22:04 RE: select * from pgadmin_users; causes error Dave Page <dpage@vale-housing.co.uk>
2001-02-23 22:28 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-02-23 22:48 RE: select * from pgadmin_users; causes error Dave Page <dpage@vale-housing.co.uk>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox