Re: [HACKERS] Handy user/group hack

2003-11-28 Thread Tom Hebbron
Here's a slightly condensed version - do SQL functions have an advantage in that they can be inlined? Or have I misunderstood? CREATE OR REPLACE FUNCTION user_in_group(name,name) RETURNS boolean STRICT AS ' SELECT EXISTS(SELECT u.* FROM pg_catalog.pg_user u INNER JOIN pg_catalog.pg_group g ON

[HACKERS] Handy user/group hack

2003-11-20 Thread David Fetter
Kind people, Here's something I came up with for finding whether a PostgreSQL 7.4 user is in a group. Cheers, D CREATE OR REPLACE FUNCTION in_group (text, text) RETURNS BOOLEAN AS ' DECLARE the_user ALIAS FOR $1; the_group ALIAS FOR $2; dummy text; -- SELECT INTO dummy because