Re: question about stored procedure / function

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: "Alain Roger" <raf(dot)news(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: question about stored procedure / function
Date: 2007-03-11 19:57:41
Message-ID: 20070311155741.d5401386.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Alain Roger" <raf(dot)news(at)gmail(dot)com> wrote:
>
> Hi,
>
> i created the following function :
> -- Function: immense.sp_a_001(username "varchar", pwd "varchar")
> -- DROP FUNCTION immense.sp_a_001(username "varchar", pwd "varchar");
>
> CREATE OR REPLACE FUNCTION immense.sp_a_001(username "varchar", pwd
> "varchar")
> RETURNS int4 AS
> $BODY$
>
> DECLARE
> myrec immense.accounts%ROWTYPE;
> count INTEGER := 0;
> /**************************************/
>
> BEGIN
>
> FOR myrec IN
> SELECT * FROM immense.accounts WHERE account_login=$1 and account_pwd=$2
> LOOP
> count := count + 1;
> END LOOP;
> RETURN count;
>
> END;
>
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE;
> ALTER FUNCTION immense.sp_a_001(username "varchar", pwd "varchar") OWNER TO
> immensesk;
> GRANT EXECUTE ON FUNCTION immense.sp_a_001(username "varchar", pwd
> "varchar") TO immensesk;
>
> However, postgreSQL add automatically the following line to each procedure
> and i do not know why ?
> GRANT EXECUTE ON FUNCTION immense.sp_a_001(username "varchar", pwd
> "varchar") TO public;
>
> normally, in such case (i mean without granted execution right to public on
> this procedure), only immensesk user should be able to run it... so why such
> thing ?
> it is not secured...

Default rights for newly created functions allow execution by public.

To remove this, use REVOKE.

--
Bill Moran
http://www.potentialtech.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rajarshi Guha 2007-03-11 22:37:26 passing an array type to a plpython procedure
Previous Message Anton Melser 2007-03-11 19:42:49 Re: question about stored procedure / function