Re: [HACKERS] Get OID of just inserted record

Поиск
Список
Период
Сортировка
От D'Arcy" "J.M." Cain
Тема Re: [HACKERS] Get OID of just inserted record
Дата
Msg-id m11iqiU-0000bFC@druid.net
обсуждение исходный текст
Ответ на Re: [HACKERS] Get OID of just inserted record  ("Aaron J. Seigo" <aaron@gtv.ca>)
Ответы Re: [HACKERS] Get OID of just inserted record  ("Aaron J. Seigo" <aaron@gtv.ca>)
Список pgsql-hackers
Thus spake Aaron J. Seigo
> > => insert into foo values (4, 'aaa');
> > INSERT 7998067 1
> 
> this assumes that one is using libpq.. it would be nice to have access to this
> from psql or anywhere for that matter.. and not just oids.. but, say for
> instance, default values in tables that are generated dynamically... etc

Just to see if I understand you, is this what you want to be able to do?

UPDATE t1 SET other_oid =   (INSERT INTO t2 VALUES (1, 'aaa') RETURN OID)   WHERE someting = 'something';

or

SELECT (INSERT INTO t2 (f1, f2) VALUES (1, 'aaa') RETURN f3);

In other words, sub-inserts.  It is kind of a neat idea.  I don't know
that it is worth spending much time on but it would be a neat feature
that no one else has.

Just wondering, how would you handle insert only tables?  That is, you
have insert privleges but not select.  Would you still return the field
or fields requested surprising the database designer, accept the insert
but return an error or refuse the insert entirely since the task could
not be completed?

-- 
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 по дате отправления:

Предыдущее
От: wieck@debis.com (Jan Wieck)
Дата:
Сообщение: Re: [HACKERS] Get OID of just inserted record
Следующее
От: "Aaron J. Seigo"
Дата:
Сообщение: Re: [HACKERS] Get OID of just inserted record