Re: [HACKERS] Get OID of just inserted record - Mailing list pgsql-hackers

From D'Arcy" "J.M." Cain
Subject Re: [HACKERS] Get OID of just inserted record
Date
Msg-id m11izSX-0000bFC@druid.net
Whole thread Raw
In response to RE: [HACKERS] Get OID of just inserted record  ("Ansley, Michael" <Michael.Ansley@intec.co.za>)
List pgsql-hackers
Thus spake Ansley, Michael
>Well, with autocommit on, the statement would fail, and I would expect the
>insert to then roll back, if the select part failed.  No problem, really.

Well, autocommit would only matter if it was decided that it wasn't an
atomic transaction.  If, as seems both sensible and consensed (look, I
made up another word :-) the transaction should be atomic, then the
state of autocommit shouldn't matter.

However, it almost begs the question of whether there should be another
permission that could be granted.  We may want to allow someone to see
the value of just inserted data after adjustments but not on the table
in general.  This statement would give us that as well if we added a
new perm.

GRANT INSERT, SELECT_ON_INSERT ...

or

GRANT INSERT, RSELECT... -- for Restricted SELECT.  ISELECT perhaps?

So someone can get the serial number of an entry that they just inserted
but they wouldn't be able to look at the table in general.  That's a
feature that I could have used in a database I have.  Instead I had to
give SELECT perms to a user on a table that I would have preferred to
otherwise keep hidden.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-hackers by date:

Previous
From: "D'Arcy" "J.M." Cain
Date:
Subject: Re: [HACKERS] Get OID of just inserted record
Next
From: Akmal Hasan
Date:
Subject: unsubcribe