pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: kijato <kijato@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: usernames of a group from SQL
Date: Sun, 21 May 2006 12:34:10 +0200
Message-ID: <44704222.5080807@logix-tt.com> (raw)
In-Reply-To: <200605211004.30969.kijato@gmail.com>
References: <Pine.LNX.4.44.0605191304380.3491-100000@matrix.gatewaynet.com>
	<200605211004.30969.kijato@gmail.com>

Hi, Kijato,

kijato schrieb:

> CREATE FUNCTION kodok.group_users(group_name "varchar")
> RETURNS SETOF "varchar" AS
> $BODY$
> SELECT pg_user.usename
> FROM pg_user, pg_group
> WHERE usesysid = any (pg_group.grolist) AND pg_group.groname=$1;
> $BODY$
> LANGUAGE 'sql' VOLATILE;

The pg_user.username column uses the PostgreSQL internal type "name"
which is used for identifiers like table and user names. The PostgreSQL
Documentation contains more about this.

I think you can cast it to varchar, like:

SELECT pg_user.username::varchar


HTH,
Markus




view thread (4+ messages)

Message-ID: <44704222.5080807@logix-tt.com>
Permalink:  ../44704222.5080807@logix-tt.com/
Also on:    postgresql.org/message-id/44704222.5080807@logix-tt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: schabi@logix-tt.com, kijato@gmail.com
  Subject: Re: usernames of a group from SQL
  In-Reply-To: <44704222.5080807@logix-tt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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