Re: Delayed result from another connection

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Delayed result from another connection
Дата
Msg-id 26896.1099590388@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Delayed result from another connection  (SZŰCS Gábor <surrano@mailbox.hu>)
Список pgsql-sql
SZŰCS Gábor <surrano@mailbox.hu> writes:
> The php connects to the database and updates retval where id=seq.
> It seems to be OK, but the function returns the value of php_retval.retval
> _before_ the call.

Yes, because your transaction is working with a database snapshot that
predates the other transaction run by the separate PHP connection.

> I thought it's something about "35.2 Visibility of Data Changes", but that's
> only for triggers, isn't it?

Nope.

> Also, the rule "query sees results of any
> previously started queries" seems to be invaded: the perform runs right
> before the query for retval.

Prior to PG 8.0, new snapshots are not taken between commands of a function,
even in READ COMMITTED mode.  You could get the behavior you want by
issuing separate interactive commands instead of wrapping the sequence
in a function.

This has been a sore spot for a long time, but we didn't get consensus
about changing it till recently ...
        regards, tom lane


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

Предыдущее
От: Franco Bruno Borghesi
Дата:
Сообщение: Re: Group by and aggregates
Следующее
От: Oliver Elphick
Дата:
Сообщение: Re: Group by and aggregates