Re: [GENERAL] function permissions question

2007-12-08 Thread Greg Steffensen
Excellent, thanks for the quick response.

Greg

On Dec 9, 2007 1:18 AM, Tom Lane <[EMAIL PROTECTED]> wrote:
> "Greg Steffensen" <[EMAIL PROTECTED]> writes:
> > 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.
>
> You didn't read the part of the GRANT man page that says that functions
> have execute permissions granted to PUBLIC by default.
>
> You can revoke that if you don't like it.
>
> regards, tom lane
>

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[GENERAL] function permissions question

2007-12-08 Thread Greg Steffensen
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

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[GENERAL] plpythonu and bytea

2005-07-02 Thread Greg Steffensen
Hey, I'm trying to write some plpython procedures that read binary data
from images on the disk and store it in bytea fields.  I'm
basically trying to write a plpython procedure that accepts a varchar
and returns a bytea, with these procedure contents:

data = "">
return data

(The actual procedure will have more in it, but that's the tricky
part).  But the returned data is always severely truncated. 
Is returning a bytea from plpython impossible, or is there some way I
should escape the data string?  I've tried using the built in
encode and decode functions, but they don't seem to help.  If
worse comes to worse, I can store the base64 encoded version, of
course, but I'd rather not do that.  Any ideas?

Greg