Problem: has_function_privilege()

This is a multi-part message in MIME format.

------=_NextPart_000_0082_01C40AD6.C7B9D3E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi *,

can somebody help to solve this?

[has_function_privilege(user, function, privilege)]:

my_example=3D# select has_function_privilege('postgres', 'cash_cmp', 'execu=
te');

ERROR: expected a left parenthesis


[has_function_privilege(function, privilege) ]:

my_example=3D# 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 20030=
222 (Red Hat Linux 3.2.2-5)


thx in advance

greetings from munich

stefan

------=_NextPart_000_0082_01C40AD6.C7B9D3E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi *,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>can somebody help to solve this?</FONT></D=
IV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>[<FONT size=3D3><FONT
face=3D"Courier New">has_function_privilege(<VAR class=3DPARAMETER>user</VA=
R>, <VAR
class=3DPARAMETER>function</VAR>, <VAR
class=3DPARAMETER>privilege</VAR>)</FONT><FONT
face=3D"Courier New">]:</FONT></FONT></FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>my_example=3D# select
has_function_privilege('postgres', 'cash_cmp', 'execute');</FONT></DIV><FON=
T
face=3DArial size=3D2>
<DIV><BR>ERROR:  expected a left parenthesis</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>[<FONT face=3D"Courier New">has_function_privilege(<VAR
class=3DPARAMETER>function</VAR>, <VAR class=3DPARAMETER>privilege</VAR>)</=
FONT>
]:</DIV>
<DIV><BR>my_example=3D# select has_function_privilege('cash_cmp',
'execute');</DIV>
<DIV><BR>ERROR:  expected a left
parenthesis<BR>          =
            &nb=
sp;            =
            &nb=
sp;            =
          
<BR> ------------------------------------------------------------ -----------=
--------------------------------<BR> PostgreSQL
7.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 20030222 (Red Hat=

Linux 3.2.2-5)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>thx in advance</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>greetings from munich</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>stefan</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>

------=_NextPart_000_0082_01C40AD6.C7B9D3E0--
Stefan Hans [ Mo, 15 März 2004 21:45 ] [ ID #141683 ]

Re: Problem: has_function_privilege()

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


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo [at] postgresql.org
Joe Conway [ Mo, 15 März 2004 22:42 ] [ ID #141684 ]
Datenbanken » gmane.comp.db.postgresql.php » Problem: has_function_privilege()

Vorheriges Thema: Query Problem
Nächstes Thema: Please help: PHP4/postgres db woes