function permissions question

From: "Greg Steffensen" <greg(dot)steffensen(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: function permissions question
Date: 2007-12-09 05:21:15
Message-ID: 438a23610712082121t7827e47fqcecdce1e9334e202@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey, I'm slightly confused about how the permission checking is done
when executing functions. Basically, users that I've never granted
execution permissions to are able to execute functions. Basically,
why does this script (which I've tested on a fresh db, executing via
psql as a superuser) succeed:

--------------
CREATE SCHEMA testschema;

CREATE FUNCTION testschema.testfunc()
RETURNS character varying AS
$BODY$SELECT 'foobar'::varchar;$BODY$
LANGUAGE 'sql' VOLATILE;

CREATE USER testuser;

GRANT USAGE ON SCHEMA testschema TO testuser;

SET SESSION AUTHORIZATION testuser;

SELECT testschema.testfunc();
------------------

But permission checking works the way I thought it was supposed to
when dealing with tables, like when I execute this instead, and get a
permissions failure:

-----------------
CREATE SCHEMA testschema;

CREATE TABLE testschema.testtable (testcolumn VARCHAR);

CREATE USER testuser;

GRANT USAGE ON SCHEMA testschema TO testuser;

SET SESSION AUTHORIZATION testuser;

SELECT * FROM testschema.testtable;
----------------

Any help is greatly appreciated. Thanks,

Greg

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-12-09 06:18:23 Re: function permissions question
Previous Message Efraín López 2007-12-09 04:15:14 Re: libpq messages language