Re: usernames of a group from SQL - Mailing list pgsql-sql

From Markus Schaber
Subject Re: usernames of a group from SQL
Date
Msg-id 44704222.5080807@logix-tt.com
Whole thread Raw
In response to Re: usernames of a group from SQL  (kijato <kijato@gmail.com>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: kijato
Date:
Subject: Re: usernames of a group from SQL
Next
From: Tom Lane
Date:
Subject: Re: timestamp query doesn't use an index ...