pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13780: Multiple commands not allowed for creating a policy.
6+ messages / 4 participants
[nested] [flat]

* BUG #13780: Multiple commands not allowed for creating a policy.
@ 2015-11-22 13:23 calebmeredith8@gmail.com
  2015-11-23 12:16 ` Re: BUG #13780: Multiple commands not allowed for creating a policy. Michael Paquier <michael.paquier@gmail.com>
  2015-11-23 14:57 ` Re: BUG #13780: Multiple commands not allowed for creating a policy. Stephen Frost <sfrost@snowman.net>
  0 siblings, 2 replies; 6+ messages in thread

From: calebmeredith8@gmail.com @ 2015-11-22 13:23 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      13780
Logged by:          Caleb Meredith
Email address:      calebmeredith8@gmail.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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



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

* Re: BUG #13780: Multiple commands not allowed for creating a policy.
  2015-11-22 13:23 BUG #13780: Multiple commands not allowed for creating a policy. calebmeredith8@gmail.com
@ 2015-11-23 12:16 ` Michael Paquier <michael.paquier@gmail.com>
  2015-11-23 13:05   ` Re: BUG #13780: Multiple commands not allowed for creating a policy. Caleb Meredith <calebmeredith8@gmail.com>
  2015-11-23 14:59   ` Re: BUG #13780: Multiple commands not allowed for creating a policy. Stephen Frost <sfrost@snowman.net>
  1 sibling, 2 replies; 6+ messages in thread

From: Michael Paquier @ 2015-11-23 12:16 UTC (permalink / raw)
  To: calebmeredith8@gmail.com; +Cc: pgsql-bugs; Stephen Frost <sfrost@snowman.net>

On Sun, Nov 22, 2015 at 10:23 PM, <calebmeredith8@gmail.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

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

* Re: BUG #13780: Multiple commands not allowed for creating a policy.
  2015-11-22 13:23 BUG #13780: Multiple commands not allowed for creating a policy. calebmeredith8@gmail.com
  2015-11-23 12:16 ` Re: BUG #13780: Multiple commands not allowed for creating a policy. Michael Paquier <michael.paquier@gmail.com>
@ 2015-11-23 13:05   ` Caleb Meredith <calebmeredith8@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Caleb Meredith @ 2015-11-23 13:05 UTC (permalink / raw)
  To: Michael Paquier <michael.paquier@gmail.com>; +Cc: pgsql-bugs; Stephen Frost <sfrost@snowman.net>

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

>
>
> On Sun, Nov 22, 2015 at 10:23 PM, <calebmeredith8@gmail.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
>

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

* Re: BUG #13780: Multiple commands not allowed for creating a policy.
  2015-11-22 13:23 BUG #13780: Multiple commands not allowed for creating a policy. calebmeredith8@gmail.com
  2015-11-23 12:16 ` Re: BUG #13780: Multiple commands not allowed for creating a policy. Michael Paquier <michael.paquier@gmail.com>
@ 2015-11-23 14:59   ` Stephen Frost <sfrost@snowman.net>
  2015-11-23 15:19     ` Re: BUG #13780: Multiple commands not allowed for creating a policy. Caleb Meredith <calebmeredith8@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Stephen Frost @ 2015-11-23 14:59 UTC (permalink / raw)
  To: Michael Paquier <michael.paquier@gmail.com>; +Cc: pgsql-bugs

Michael,

* Michael Paquier (michael.paquier@gmail.com) wrote:
> On Sun, Nov 22, 2015 at 10:23 PM, <calebmeredith8@gmail.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

Attachments:

  signature.asc (application/pgp-signature, 818B) download

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

* Re: BUG #13780: Multiple commands not allowed for creating a policy.
  2015-11-22 13:23 BUG #13780: Multiple commands not allowed for creating a policy. calebmeredith8@gmail.com
  2015-11-23 12:16 ` Re: BUG #13780: Multiple commands not allowed for creating a policy. Michael Paquier <michael.paquier@gmail.com>
  2015-11-23 14:59   ` Re: BUG #13780: Multiple commands not allowed for creating a policy. Stephen Frost <sfrost@snowman.net>
@ 2015-11-23 15:19     ` Caleb Meredith <calebmeredith8@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Caleb Meredith @ 2015-11-23 15:19 UTC (permalink / raw)
  To: Stephen Frost <sfrost@snowman.net>; Michael Paquier <michael.paquier@gmail.com>; +Cc: 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@snowman.net> wrote:

> Michael,
>
> * Michael Paquier (michael.paquier@gmail.com) wrote:
> > On Sun, Nov 22, 2015 at 10:23 PM, <calebmeredith8@gmail.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
>

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

* Re: BUG #13780: Multiple commands not allowed for creating a policy.
  2015-11-22 13:23 BUG #13780: Multiple commands not allowed for creating a policy. calebmeredith8@gmail.com
@ 2015-11-23 14:57 ` Stephen Frost <sfrost@snowman.net>
  1 sibling, 0 replies; 6+ messages in thread

From: Stephen Frost @ 2015-11-23 14:57 UTC (permalink / raw)
  To: calebmeredith8@gmail.com; +Cc: pgsql-bugs

Caleb,

* calebmeredith8@gmail.com (calebmeredith8@gmail.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

Attachments:

  signature.asc (application/pgp-signature, 818B) download

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


end of thread, other threads:[~2015-11-23 15:19 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-11-22 13:23 BUG #13780: Multiple commands not allowed for creating a policy. calebmeredith8@gmail.com
2015-11-23 12:16 ` Michael Paquier <michael.paquier@gmail.com>
2015-11-23 13:05   ` Caleb Meredith <calebmeredith8@gmail.com>
2015-11-23 14:59   ` Stephen Frost <sfrost@snowman.net>
2015-11-23 15:19     ` Caleb Meredith <calebmeredith8@gmail.com>
2015-11-23 14:57 ` Stephen Frost <sfrost@snowman.net>

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