Re: Consecutive queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Raymond O'Donnell" <rod(at)iol(dot)ie>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Consecutive queries
Date: 2003-04-06 23:41:44
Message-ID: 20891.1049672504@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Raymond O'Donnell" <rod(at)iol(dot)ie> writes:
> Is there any way to ensure that one query has completed before a
> second one is executed? I have to execute an UPDATE and follow it
> immediately with a SELECT, but I find that the SELECT is picking up
> incorrect data because - I assume - the UPDATE hasn't completed yet.
> When I re-run the SELECT a few seconds later I gvet the correct data.

This behavior is, quite simply, not possible. Unless perhaps you are
issuing the two queries across different connections, so that the second
one actually starts to execute before the first one is done. If you
are (mis)using a client library that implements pooling of connections,
I can see how such a mistake might happen. But we're not going to be
able to help you if you don't show us your code.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2003-04-07 00:28:57 Re: unable to dump database, toast errors
Previous Message Andrew Sullivan 2003-04-06 22:39:52 Re: Consecutive queries