BUG #13004: PostgreSQL 9.5 policy for table bug? - Mailing list pgsql-bugs

From digoal@126.com
Subject BUG #13004: PostgreSQL 9.5 policy for table bug?
Date
Msg-id 20150409024355.26380.72252@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #13004: PostgreSQL 9.5 policy for table bug?  (Stephen Frost <sfrost@snowman.net>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      13004
Logged by:          digoal
Email address:      digoal@126.com
PostgreSQL version: Unsupported/Unknown
Operating system:   CentOS 6
Description:

postgres=# \d test
     Table "public.test"
 Column |  Type   | Modifiers
--------+---------+-----------
 id     | integer |
 r      | name    |
Policies:
    POLICY "p4" FOR UPDATE
      TO r3
      USING (r = "current_user"())
postgres=# \c postgres r3
You are now connected to database "postgres" as user "r3".

postgres=> update test set id=4 where r='r3';
UPDATE 1

There is no policy for r3's select command , why cann't see rows?

postgres=> select * from test;
 id | r
----+---
(0 rows)

postgres=# create policy p1 on test for select to r3 using ( r =
current_user);
CREATE POLICY
postgres=# \d+ test
                         Table "public.test"
 Column |  Type   | Modifiers | Storage | Stats target | Description
--------+---------+-----------+---------+--------------+-------------
 id     | integer |           | plain   |              |
 r      | name    |           | plain   |              |
Policies:
    POLICY "p1" FOR SELECT
      TO r3
      USING (r = "current_user"())
    POLICY "p4" FOR UPDATE
      TO r3
      USING (r = "current_user"())
postgres=# \c postgres r3
You are now connected to database "postgres" as user "r3".
postgres=> select * from test;
 id | r
----+----
  4 | r3
(1 row)

There is no policy for r3's delete command , why cann't delete?

postgres=> delete from test ;
DELETE 0


another nonsuper role , and not owner:

postgres=> \c postgres r1
You are now connected to database "postgres" as user "r1".
postgres=# select * from test;
 id | r
----+----
  1 | r1
  2 | r2
  4 | r1
  4 | r2
  4 | r1
  4 | r2
  4 | r1
  4 | r3
(8 rows)

pgsql-bugs by date:

Previous
From: eshkinkot@gmail.com
Date:
Subject: BUG #13010: After promote postgres try to send old timeline WALs to archive
Next
From: Peter Slavov
Date:
Subject: Re: BUG #12910: Memory leak with logical decoding