Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DE65C475AE4 for ; Sun, 20 Oct 2002 17:16:04 -0400 (EDT) Received: from mail.secureworks.net (mail.secureworks.net [209.101.212.155]) by postgresql.org (Postfix) with SMTP id 12DD9475A09 for ; Sun, 20 Oct 2002 17:16:04 -0400 (EDT) Received: (qmail 41123 invoked from network); 20 Oct 2002 21:14:31 -0000 Received: from unknown (HELO gabrielle.secureworks.net) (209.101.212.253) by mail.secureworks.net with SMTP; 20 Oct 2002 21:14:31 -0000 Content-Type: text/plain; charset="us-ascii" From: Casey Allen Shobe Organization: SecureWorks, Inc. To: pgsql-admin@postgresql.org Subject: User/group association Date: Sun, 20 Oct 2002 17:13:05 -0400 User-Agent: KMail/1.4.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210201713.05705.cshobe@secureworks.net> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/155 X-Sequence-Number: 6013 I'm working on a users view for my database (what I have so far can be foun= d=20 below), and I was wondering how postgres associates users with groups, as= =20 there is no grosysid column in pg_user. I would like to display informatio= n=20 like so: Username: Primary Group: Other Groups: ----------------------------------------------------------------------- cshobe Administrators Security Operations, Development [etc.] See the question marks below for an in-context request. Any help is greatly appreciated, - Casey create view "users" as select ps."usesysid" as "UID", ps."usename" as "Username", ps."passwd" as "Password", coalesce ( ( select cast (p."position_name" as varchar) from only "positions" as "p" where p."position_id" =3D ( select cast (ui."info_value" as integer) from only "user_info" as "ui" inner join only "user_info_types" as "uit" on uit."type_id" =3D ui."info_type_id" where uit."info_type" =3D 'Position ID' and uit."info_type_name" =3D 'Default' and ui."user_id" =3D ps."usesysid" ) ), 'Undefined' ) as "Position", coalesce ( ( select cast (pg."groname" as varchar) from only "pg_group" as "pg" where pg."grosysid" =3D ( ????????where do I get this from????????? ) ), 'Undefined' ) as "Group", coalesce ( ( select cast (ui."info_value" as integer) from only "user_info" as "ui" inner join only "user_info_types" as "uit" on uit."type_id" =3D ui."info_type_id" where uit.info_type =3D 'Creator ID' and uit.info_type_name =3D 'Default' and ui."user_id" =3D ps."usesysid" ), 0 ) as "Creator ID", coalesce ( ( select cast (ui."info_value" as varchar) from only "user_info" as "ui" inner join only "user_info_types" as "uit" on uit."type_id" =3D ui."info_type_id" where uit.info_type =3D 'E-Mail' and uit.info_type_name =3D 'Work' and ui."user_id" =3D ps."usesysid" ), 'None' ) as "Work E-Mail Address", coalesce ( ( select cast (ui."info_value" as varchar) from only "user_info" as "ui" inner join only "user_info_types" as "uit" on uit."type_id" =3D ui."info_type_id" where uit.info_type =3D 'Extension' and uit.info_type_name =3D 'Work' and ui."user_id" =3D ps."usesysid" ), 'None' ) as "Extension", coalesce ( ( select cast (ui."info_value" as varchar) from only "user_info" as "ui" inner join only "user_info_types" as "uit" on uit."type_id" =3D ui."info_type_id" where uit.info_type =3D 'Telephone' and uit.info_type_name =3D 'Home' and ui."user_id" =3D ps."usesysid" ), 'None' ) as "Home Telephone", coalesce ( ( select cast (ui."info_value" as varchar) from only "user_info" as "ui" inner join only "user_info_types" as "uit" on uit."type_id" =3D ui."info_type_id" where uit.info_type =3D 'Telephone' and uit.info_type_name =3D 'Mobile' and ui."user_id" =3D ps."usesysid" ), 'None' ) as "Mobile Telephone" from only "pg_shadow" as "ps" where ps."usesysid" > 100 order by "UID"; --=20 Casey Allen Shobe / Network Security Analyst & PHP Developer SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144 cshobe@secureworks.net / http://www.secureworks.net Content is my own and does not necessarily represent my company.