Re: [HACKERS] Get OID of just inserted record

From: "D'Arcy" "J(dot)M(dot)" Cain <darcy(at)druid(dot)net>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Get OID of just inserted record
Date: 1999-11-03 12:24:13
Message-ID: m11izSX-0000bFC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at){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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Akmal Hasan 1999-11-03 13:57:43 unsubcribe
Previous Message D'Arcy J.M. Cain 1999-11-03 12:10:23 Re: [HACKERS] Get OID of just inserted record