Re: BUG #13780: Multiple commands not allowed for creating a policy.

Lists: Postg사설 토토 사이트SQL : Postg사설 토토 사이트SQL 메일 링리스트 : 2015-11-23 이후 PGSQL-BUGS 13:05
From: calebmeredith8(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13780: Multiple commands not allowed for creating a policy.
Date: 2015-11-22 13:23:27
Message-ID: 20151122132327.1832.52687@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 핫SQL : Postg토토 핫SQL 메일 링리스트 : 2015-11-22 이후 PGSQL-BUGS 13:23

The following bug has been logged on the website:

Bug reference: 13780
Logged by: Caleb Meredith
Email address: calebmeredith8(at)gmail(dot)com
PostgreSQL version: 9.5beta1
Operating system: OSX
Description:

When performing a grant I can do:

GRANT INSERT, UPDATE, DELETE ON TABLE person TO user;

But when creating a policy I can't do:

CREATE POLICY user_write ON person FOR INSERT, UPDATE, DELETE TO user
USING (…);

The specific error is:

ERROR: syntax error at or near ","
LINE 1: ...TE POLICY user_write ON person FOR INSERT, UPDATE, ...

This doesn't seem to be intended as the GRANT specification allows it, and
CREATE POLICY supports the ALL command.


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: calebmeredith8(at)gmail(dot)com
Cc: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: BUG #13780: Multiple commands not allowed for creating a policy.
Date: 2015-11-23 12:16:15
Message-ID: CAB7nPqT986ToW6DpOx=rz-Q_Kbn_HvVcU9us0Vk=R8V3S_6QLQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 젠 토토 페치 실패

On Sun, Nov 22, 2015 at 10:23 PM, <calebmeredith8(at)gmail(dot)com> wrote:

> This doesn't seem to be intended as the GRANT specification allows it, and
> CREATE POLICY supports the ALL command.
>

Yeah, I would tend to agree that the existence of ALL contradicts the
expression constraints that are in place when defining a non-ALL policy as
we could basically ignore either the WITH CHECK or USING clauses defined in
a policy defined depending on the DML or SELECT command used. To be more
exact, for example with an ALL policy that has both a WITH CHECK and USING
defined, we would ignore the USING clause with an INSERT query, right? We
are in beta2 state now, so I don't think anything is going to change, but
Stephen, your thoughts perhaps?
--
Michael


From: Caleb Meredith <calebmeredith8(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: BUG #13780: Multiple commands not allowed for creating a policy.
Date: 2015-11-23 13:05:51
Message-ID: CABFpK6197YqUS8+ip2FiTOb+TLF_w1bUDJAO4fu0wGCJNO-QQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg사설 토토 사이트SQL : Postg사설 토토 사이트SQL 메일 링리스트 : 2015-11-23 이후 PGSQL-BUGS 13:05

Yes, that makes sense.
On Mon, Nov 23, 2015 at 7:16 AM Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:

>
>
> On Sun, Nov 22, 2015 at 10:23 PM, <calebmeredith8(at)gmail(dot)com> wrote:
>
>> This doesn't seem to be intended as the GRANT specification allows it, and
>> CREATE POLICY supports the ALL command.
>>
>
> Yeah, I would tend to agree that the existence of ALL contradicts the
> expression constraints that are in place when defining a non-ALL policy as
> we could basically ignore either the WITH CHECK or USING clauses defined in
> a policy defined depending on the DML or SELECT command used. To be more
> exact, for example with an ALL policy that has both a WITH CHECK and USING
> defined, we would ignore the USING clause with an INSERT query, right? We
> are in beta2 state now, so I don't think anything is going to change, but
> Stephen, your thoughts perhaps?
> --
> Michael
>


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: calebmeredith8(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13780: Multiple commands not allowed for creating a policy.
Date: 2015-11-23 14:57:45
Message-ID: 20151123145745.GF3685@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Caleb,

* calebmeredith8(at)gmail(dot)com (calebmeredith8(at)gmail(dot)com) wrote:
> When performing a grant I can do:
>
> GRANT INSERT, UPDATE, DELETE ON TABLE person TO user;
>
> But when creating a policy I can't do:
>
> CREATE POLICY user_write ON person FOR INSERT, UPDATE, DELETE TO user
> USING (…);
>
> The specific error is:
>
> ERROR: syntax error at or near ","
> LINE 1: ...TE POLICY user_write ON person FOR INSERT, UPDATE, ...
>
> This doesn't seem to be intended as the GRANT specification allows it, and
> CREATE POLICY supports the ALL command.

This is certainly something which we can look at adding support for. I
agree that it'd be nice to have, though I'm curious what your specific
use-case for it is, if you don't mind sharing.

Just to be clear, this is a new feature and not a bug. The CREATE
POLICY documentation is correct- you can currently only specify one
command and the system catalog underneath only allows for one command
per policy.

Thanks!

Stephen


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: calebmeredith8(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13780: Multiple commands not allowed for creating a policy.
Date: 2015-11-23 14:59:55
Message-ID: 20151123145955.GG3685@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Michael,

* Michael Paquier (michael(dot)paquier(at)gmail(dot)com) wrote:
> On Sun, Nov 22, 2015 at 10:23 PM, <calebmeredith8(at)gmail(dot)com> wrote:
> > This doesn't seem to be intended as the GRANT specification allows it, and
> > CREATE POLICY supports the ALL command.
>
> Yeah, I would tend to agree that the existence of ALL contradicts the
> expression constraints that are in place when defining a non-ALL policy as
> we could basically ignore either the WITH CHECK or USING clauses defined in
> a policy defined depending on the DML or SELECT command used. To be more
> exact, for example with an ALL policy that has both a WITH CHECK and USING
> defined, we would ignore the USING clause with an INSERT query, right? We
> are in beta2 state now, so I don't think anything is going to change, but
> Stephen, your thoughts perhaps?

We could support allowing multiple commands for a policy and would just
need to adjust the checks to make sure that the policy definition makes
sense, but that's all new-feature type of work which would be for 9.6
and not a bug in the current implementation. I'm certainly not against
doing that, but it doesn't seem like a terribly high priority.

Thanks!

Stephen


From: Caleb Meredith <calebmeredith8(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13780: Multiple commands not allowed for creating a policy.
Date: 2015-11-23 15:19:49
Message-ID: CABFpK62sDdQBMwM59tmnPOZ9+SMdWakSXk3NvcvAytd0FbS4OA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

My use case is I want users to see more data then they can edit. So select
would have a broad USAGE clause and the write commands (insert, update,
delete) would have a narrow USAGE/WITH CLAUSE check.
On Mon, Nov 23, 2015 at 9:59 AM Stephen Frost <sfrost(at)snowman(dot)net> wrote:

> Michael,
>
> * Michael Paquier (michael(dot)paquier(at)gmail(dot)com) wrote:
> > On Sun, Nov 22, 2015 at 10:23 PM, <calebmeredith8(at)gmail(dot)com> wrote:
> > > This doesn't seem to be intended as the GRANT specification allows it,
> and
> > > CREATE POLICY supports the ALL command.
> >
> > Yeah, I would tend to agree that the existence of ALL contradicts the
> > expression constraints that are in place when defining a non-ALL policy
> as
> > we could basically ignore either the WITH CHECK or USING clauses defined
> in
> > a policy defined depending on the DML or SELECT command used. To be more
> > exact, for example with an ALL policy that has both a WITH CHECK and
> USING
> > defined, we would ignore the USING clause with an INSERT query, right? We
> > are in beta2 state now, so I don't think anything is going to change, but
> > Stephen, your thoughts perhaps?
>
> We could support allowing multiple commands for a policy and would just
> need to adjust the checks to make sure that the policy definition makes
> sense, but that's all new-feature type of work which would be for 9.6
> and not a bug in the current implementation. I'm certainly not against
> doing that, but it doesn't seem like a terribly high priority.
>
> Thanks!
>
> Stephen
>