pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7557: Transaction sees outdated grants.
3+ messages / 3 participants
[nested] [flat]

* BUG #7557: Transaction sees outdated grants.
@ 2012-09-19 11:09  zimnyx@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: zimnyx@gmail.com @ 2012-09-19 11:09 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7557
Logged by:          Piotr Czachur
Email address:      zimnyx@gmail.com
PostgreSQL version: 9.2.0
Operating system:   Ubuntu 12.04.1 LTS
Description:        

After upgrading from 9.1 to 9.2 I noticed that behaviour of veryfying table
permissions during transaction has changed, and may be just wrong.
I give you a simple example how this behaviour has changed from 9.1 to 9.2:


-- start admin session
-- sudo -u postgres psql postgres
DROP DATABASE IF EXISTS test;
DROP ROLE IF EXISTS joe;
CREATE USER joe WITH PASSWORD 'joe';
CREATE DATABASE test;
\c test
CREATE TABLE kingdoms
(
  id serial NOT NULL,
  name character varying,
  CONSTRAINT university_pkey PRIMARY KEY (id)
);
CREATE TABLE wizards
(
  id serial NOT NULL,
  name character varying,
  kingdom_id integer,
  CONSTRAINT wizards_pkey PRIMARY KEY (id),
  CONSTRAINT wizards_kingdom_id_fkey FOREIGN KEY (kingdom_id) REFERENCES
kingdoms (id)
);

GRANT ALL ON DATABASE test TO joe;
GRANT ALL ON ALL TABLES IN SCHEMA public TO joe;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO joe;


-- start joe session
-- psql -h 127.0.0.1 -U joe test
BEGIN;
INSERT INTO "kingdoms" ("name") VALUES ('Mordor');

-- jump back to admin session
REVOKE INSERT ON table "kingdoms" FROM joe;

-- jump back to joe session
INSERT INTO "wizards" ("name", "kingdom_id") VALUES ('Gandalf', 1);

-- jump back to admin session
GRANT INSERT ON table "kingdoms" TO joe;

-- jump back to joe session (HERE IS THE ERROR)
INSERT INTO "kingdoms" ("name") VALUES ('Mordor');
-- ERROR:  permission denied for relation kingdoms.
-- Why permission denied? We've granted INSERT in a previous statemtnt.
-- Error appears in 9.2, in 9.1 there is no error.
ROLLBACK;
INSERT INTO "kingdoms" ("name") VALUES ('Mordor'); -- INSERT 0 1
-- After rolling back INSERT succeeded.
-- Looks like transaction doesn't always see "fresh" grants.









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

* Re: BUG #7557: Transaction sees outdated grants.
@ 2012-09-19 21:15  Tom Lane <tgl@sss.pgh.pa.us>
  parent: zimnyx@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2012-09-19 21:15 UTC (permalink / raw)
  To: zimnyx@gmail.com; +Cc: pgsql-bugs

zimnyx@gmail.com writes:
> After upgrading from 9.1 to 9.2 I noticed that behaviour of veryfying table
> permissions during transaction has changed, and may be just wrong.

Fixed (or at least restored to the historical behavior).  Thanks for the
report!

			regards, tom lane




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

* Re: BUG #7557: Transaction sees outdated grants.
@ 2012-10-10 10:17  Piotr Czachur <zimnyx@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Piotr Czachur @ 2012-10-10 10:17 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

Tom,

On 09/19/2012 11:15 PM, Tom Lane wrote:
> zimnyx@gmail.com writes:
>> After upgrading from 9.1 to 9.2 I noticed that behaviour of veryfying table
>> permissions during transaction has changed, and may be just wrong.
> Fixed (or at least restored to the historical behavior).  Thanks for the
> report!
>
> 			regards, tom lane
I confirm, bug no longer exists in 9.2.1.
Thanks!

Regards,
Piotrek




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


end of thread, other threads:[~2012-10-10 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-09-19 11:09 BUG #7557: Transaction sees outdated grants. zimnyx@gmail.com
2012-09-19 21:15 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-10-10 10:17   ` Piotr Czachur <zimnyx@gmail.com>

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