pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
User/Groups
4+ messages / 4 participants
[nested] [flat]

* User/Groups
@ 2000-04-03 21:21  Michael Fork <mfork@toledolink.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Michael Fork @ 2000-04-03 21:21 UTC (permalink / raw)
  To: pgsql-sql

I am trying to populate a select box on a form with all users in the group
with the sysid of 1 using the following query:

SELECT usename FROM pg_user, pg_group WHERE pg_user.usesysid IN 
pg_group.grolist AND pg_group.grosysid = 1;

however, everytime I run it I recieve the following error:

ERROR:  parser: parse error at or near "pg_group"

which leads me to belive that the IN operator is not correct, is there
another one that I should be using?  Thanks in advance.

Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: User/Groups
@ 2000-04-03 23:07  tjk@tksoft.com <tjk@tksoft.com>
  parent: Michael Fork <mfork@toledolink.com>
  2 siblings, 0 replies; 4+ messages in thread

From: tjk@tksoft.com @ 2000-04-03 23:07 UTC (permalink / raw)
  To: mfork@toledolink.com; +Cc: pgsql-sql

Michael,

The IN operator should precede a sub query.

E.g.

SELECT usename FROM pg_user, pg_group WHERE pg_group.grosysid = 1 and 
pg_user.usesysid IN (select usesysid from pg_group);

This probably doesn't do what you want. The example is just to 
demonstrate the point.


Troy


> 
> I am trying to populate a select box on a form with all users in the group
> with the sysid of 1 using the following query:
> 
> SELECT usename FROM pg_user, pg_group WHERE pg_user.usesysid IN 
> pg_group.grolist AND pg_group.grosysid = 1;
> 
> however, everytime I run it I recieve the following error:
> 
> ERROR:  parser: parse error at or near "pg_group"
> 
> which leads me to belive that the IN operator is not correct, is there
> another one that I should be using?  Thanks in advance.
> 
> Michael Fork - CCNA - MCP - A+
> Network Support - Toledo Internet Access - Toledo Ohio
> 
> 




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: User/Groups
@ 2000-04-04 10:25  Peter Eisentraut <e99re41@DoCS.UU.SE>
  parent: Michael Fork <mfork@toledolink.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Peter Eisentraut @ 2000-04-04 10:25 UTC (permalink / raw)
  To: Michael Fork <mfork@toledolink.com>; +Cc: pgsql-sql

Somewhere in contrib/ there is some array walking code which is what you
want. I'm not thoroughly familiar with it, though.


On Mon, 3 Apr 2000, Michael Fork wrote:

> I am trying to populate a select box on a form with all users in the group
> with the sysid of 1 using the following query:
> 
> SELECT usename FROM pg_user, pg_group WHERE pg_user.usesysid IN 
> pg_group.grolist AND pg_group.grosysid = 1;
> 
> however, everytime I run it I recieve the following error:
> 
> ERROR:  parser: parse error at or near "pg_group"
> 
> which leads me to belive that the IN operator is not correct, is there
> another one that I should be using?  Thanks in advance.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: User/Groups
@ 2000-04-04 10:45  Karel Zak <zakkr@zf.jcu.cz>
  parent: Michael Fork <mfork@toledolink.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Karel Zak @ 2000-04-04 10:45 UTC (permalink / raw)
  To: Michael Fork <mfork@toledolink.com>; +Cc: pgsql-sql


On Mon, 3 Apr 2000, Michael Fork wrote:

> I am trying to populate a select box on a form with all users in the group
> with the sysid of 1 using the following query:
> 
> SELECT usename FROM pg_user, pg_group WHERE pg_user.usesysid IN 
> pg_group.grolist AND pg_group.grosysid = 1;
> 
> however, everytime I run it I recieve the following error:
> 
> ERROR:  parser: parse error at or near "pg_group"
> 
> which leads me to belive that the IN operator is not correct, is there
> another one that I should be using?  Thanks in advance.

 In the postgreSQL contrib tree is modul (array_iterator) with operators 
for arrays. 

A solution for you:

SELECT	usename 
FROM	pg_user, pg_group 
WHERE	pg_group.grolist *= pg_user.usesysid AND pg_group.grosysid = 1;

							Karel 

/* ----------------
 * Karel Zak  *  zakkr@zf.jcu.cz  *  http://home.zf.jcu.cz/~zakkr/
 *           C, PostgreSQL, PHP, WWW, http://docs.linux.cz
 * ----------------
 */




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2000-04-04 10:45 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-04-03 21:21 User/Groups Michael Fork <mfork@toledolink.com>
2000-04-03 23:07 ` tjk@tksoft.com <tjk@tksoft.com>
2000-04-04 10:25 ` Peter Eisentraut <e99re41@DoCS.UU.SE>
2000-04-04 10:45 ` Karel Zak <zakkr@zf.jcu.cz>

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