pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedQuery about using arrays (for accessing pg_group)
2+ messages / 2 participants
[nested] [flat]
* Query about using arrays (for accessing pg_group)
@ 2000-07-02 07:20 Greg Wickham <greg@geelong.com>
2000-07-02 16:38 ` Re: Query about using arrays (for accessing pg_group) Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Greg Wickham @ 2000-07-02 07:20 UTC (permalink / raw)
To: pgsql-sql@hub.org
Howdy,
Am trying to implement a user/group based security model for
accessing a database which is tightly integrated with the postgresql
security model.
The problem I am having is that I am not sure how to check which
groups a user is in.
For example, if I have a user (with id of 21) in a group, I'm not
sure how to start off with the user id and pull out the group name
using normal sql.
If I try the half intuitive approach
z=> select groname from pg_group where grolist = 21;
ERROR: Unable to identify an operator '=' for types '_int4' and 'int4'
You will have to retype this query using an explicit cast
The cause of my problem is the use of an array to store the user id's
associated with a group. Not sure how to get around this.
Any ideas?
Please cc replies to me as I think I've fallen off this list.
tia,
-Greg
------------------------------------------------------------------
www.geelong.com Greg Wickham
P.O. Box 1426 greg@geelong.com
Geelong VIC 3220 Ph: (+61 407) 854 566
------------------------------------------------------------------
wheNufiNdu'RselFindAngeRwheNu'rThreAtenEdbyAstrAngeRwheNitlOoksLik
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Query about using arrays (for accessing pg_group)
2000-07-02 07:20 Query about using arrays (for accessing pg_group) Greg Wickham <greg@geelong.com>
@ 2000-07-02 16:38 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2000-07-02 16:38 UTC (permalink / raw)
To: Greg Wickham <greg@geelong.com>; +Cc: pgsql-sql@hub.org
Greg Wickham <greg@geelong.com> writes:
> If I try the half intuitive approach
> z=> select groname from pg_group where grolist = 21;
> ERROR: Unable to identify an operator '=' for types '_int4' and 'int4'
> You will have to retype this query using an explicit cast
> The cause of my problem is the use of an array to store the user id's
> associated with a group. Not sure how to get around this.
You need a function that will return true if any of the elements of
an int4 array is equal to a particular int4 value. See contrib/array/
for one way to do it.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-07-02 16:38 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-02 07:20 Query about using arrays (for accessing pg_group) Greg Wickham <greg@geelong.com>
2000-07-02 16:38 ` Tom Lane <tgl@sss.pgh.pa.us>
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