pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problem: has_function_privilege()
2+ messages / 2 participants
[nested] [flat]

* Problem: has_function_privilege()
@ 2004-03-15 20:45 Stefan Hans <shans@tanagra.de>
  2004-03-15 21:42 ` Re: Problem: has_function_privilege() Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Stefan Hans @ 2004-03-15 20:45 UTC (permalink / raw)
  To: pgsql-php

Hi *,

can somebody help to solve this?

[has_function_privilege(user, function, privilege)]:

my_example=# select has_function_privilege('postgres', 'cash_cmp', 'execute');

ERROR:  expected a left parenthesis


[has_function_privilege(function, privilege) ]:

my_example=# select has_function_privilege('cash_cmp', 'execute');

ERROR:  expected a left parenthesis
                                                                       
-------------------------------------------------------------------------------------------------------
 PostgreSQL 7.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)


thx in advance

greetings from munich

stefan

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Problem: has_function_privilege()
  2004-03-15 20:45 Problem: has_function_privilege() Stefan Hans <shans@tanagra.de>
@ 2004-03-15 21:42 ` Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Joe Conway @ 2004-03-15 21:42 UTC (permalink / raw)
  To: Stefan Hans <shans@tanagra.de>; +Cc: pgsql-php

Stefan Hans wrote:
> my_example=# select has_function_privilege('postgres', 'cash_cmp', 'execute');
> 
> ERROR:  expected a left parenthesis

The documentation isn't real clear on this, but reread:
http://www.postgresql.org/docs/current/interactive/functions-misc.html
particularly this paragraph:

"has_function_privilege checks whether a user can access a function in a 
particular way. The possibilities for its arguments are analogous to 
has_table_privilege. When specifying a function by a text string rather 
than by OID, the allowed input is the same as for the regprocedure data 
type. The desired access privilege type must currently evaluate to EXECUTE."

Since function names can be overloaded in Postgres, you need to be more 
specific with your function name, i.e. provide input data types in 
parenthesis. E.g.:

regression=# select has_function_privilege('postgres', 'byteacat(bytea, 
bytea)', 'execute');
  has_function_privilege
------------------------
  t
(1 row)

HTH,

Joe




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-03-15 21:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-03-15 20:45 Problem: has_function_privilege() Stefan Hans <shans@tanagra.de>
2004-03-15 21:42 ` Joe Conway <mail@joeconway.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox