From: | Robins Tharakan <tharakan(at)gmail(dot)com> |
---|---|
To: | pgsql-docs(at)postgresql(dot)org |
Subject: | Re: CREATE OPERATOR query |
Date: | 2013-05-22 00:32:35 |
Message-ID: | CAEP4nAws7hm0xxgcd2MUEFZAvaw-stzcZ0RbnxA4=u0O2O-x=w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
Further, I seem to have a similar problem with the EXECUTE check
requirement as well.
Sample SQL given below.
BEGIN TRANSACTION;
CREATE ROLE rol_op3;
CREATE TYPE type_op3 AS ENUM ('new', 'open', 'closed');
CREATE FUNCTION fn_op3(type_op3, type_op3)
RETURNS type_op3 AS $$
SELECT NULL::type_op3;
$$ LANGUAGE sql IMMUTABLE;
REVOKE EXECUTE ON FUNCTION fn_op3(type_op3, type_op3) FROM rol_op3;
SET ROLE rol_op3;
CREATE OPERATOR #*# (
leftarg = type_op3,
rightarg = type_op3,
procedure = fn_op3
);
RESET ROLE;
ROLLBACK;
Thanks.
--
Robins Tharakan
On 22 May 2013 05:50, Robins Tharakan <tharakan(at)gmail(dot)com> wrote:
> Hi,
>
> While trying to create regression tests for CREATE OPERATOR, I am able to
> create an operator despite not have USAGE / ALL access to the given
> argument type. Shouldn't the following SQL throw an error?
>
> BEGIN TRANSACTION;
> CREATE ROLE rol_op3;
> CREATE TYPE type_op3 AS ENUM ('new', 'open', 'closed');
> CREATE FUNCTION fn_op3(type_op3, type_op3)
> RETURNS type_op3 AS $$
> SELECT NULL::type_op3;
> $$ LANGUAGE sql IMMUTABLE;
> REVOKE ALL ON TYPE type_op3 FROM rol_op3;
> SET ROLE rol_op3;
> CREATE OPERATOR #*# (
> leftarg = type_op3,
> rightarg = type_op3,
> procedure = fn_op3
> );
> RESET ROLE;
> ROLLBACK;
>
> This what the doc says:
>
> > To be able to create an operator, you must have USAGE privilege on the
> argument types and the return type, as well as EXECUTE privilege on the
> underlying function. If a commutator or negator operator is specified, you
> must own these operators.
>
> Any pointers would be helpful.
>
> Thanks
> --
> Robins Tharakan
>
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2013-05-22 01:42:49 | Re: CREATE OPERATOR query |
Previous Message | Robins Tharakan | 2013-05-22 00:20:07 | CREATE OPERATOR query |