pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: SZŰCS Gábor <surrano@mailbox.hu>
Cc: pgsql-sql@postgresql.org
Subject: Re: Delayed result from another connection
Date: Thu, 04 Nov 2004 12:46:28 -0500
Message-ID: <26896.1099590388@sss.pgh.pa.us> (raw)
In-Reply-To: <012601c4c292$6804b810$0403a8c0@fejleszt4>
References: <012601c4c292$6804b810$0403a8c0@fejleszt4>

=?iso-8859-2?B?U1rbQ1MgR+Fib3I=?= <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



view thread (4+ messages)  latest in thread

Message-ID: <26896.1099590388@sss.pgh.pa.us>
Permalink:  ../26896.1099590388@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26896.1099590388@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, surrano@mailbox.hu
  Subject: Re: Delayed result from another connection
  In-Reply-To: <26896.1099590388@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox