Re: any way for a transaction to "see" inserts done earlier in the transaction?

Поиск
Список
Период
Сортировка
От Steven Schlansker
Тема Re: any way for a transaction to "see" inserts done earlier in the transaction?
Дата
Msg-id E3DB597E-863B-42A9-A04F-1674BFF46041@likeness.com
обсуждение исходный текст
Ответ на any way for a transaction to "see" inserts done earlier in the transaction?  (Susan Cassidy <susan.cassidy@decisionsciencescorp.com>)
Список pgsql-general
On Apr 16, 2014, at 4:27 PM, Susan Cassidy <susan.cassidy@decisionsciencescorp.com> wrote:

> Is there any way to let a transaction "see" the inserts that were done earlier in the transaction?  I want to insert
arow, then later use it within the same transaction. 
>
> If not, I will have to commit after each insert, and I don't want to do that until add the rows are added, if I can
possiblyavoid it. 

Did you try it?  This is already how it works, unless I misunderstand your question…

postgres=# create temporary table foo (i integer primary key);
CREATE TABLE
postgres=# begin;
BEGIN
postgres=# insert into foo values(1);
INSERT 0 1
postgres=# select * from foo;
 i
---
 1
(1 row)

postgres=# commit;
COMMIT




В списке pgsql-general по дате отправления:

Предыдущее
От: Susan Cassidy
Дата:
Сообщение: any way for a transaction to "see" inserts done earlier in the transaction?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: any way for a transaction to "see" inserts done earlier in the transaction?