Re: Consecutive queries - Mailing list pgsql-general

From Tom Lane
Subject Re: Consecutive queries
Date
Msg-id 20891.1049672504@sss.pgh.pa.us
Whole thread Raw
In response to Consecutive queries  ("Raymond O'Donnell" <rod@iol.ie>)
Responses Re: Consecutive queries  ("Raymond O'Donnell" <rod@iol.ie>)
List pgsql-general
"Raymond O'Donnell" <rod@iol.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


pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Consecutive queries
Next
From: Jan Wieck
Date:
Subject: Re: unable to dump database, toast errors