Re: how to ensure a client waits for a previous transaction to finish? - Mailing list pgsql-general

From Vick Khera
Subject Re: how to ensure a client waits for a previous transaction to finish?
Date
Msg-id 2968dfd60912071325s7864029ewb15c00c6374123fb@mail.gmail.com
Whole thread Raw
In response to how to ensure a client waits for a previous transaction to finish?  (Dan Kortschak <dan.kortschak@adelaide.edu.au>)
List pgsql-general
On Mon, Dec 7, 2009 at 4:00 PM, Dan Kortschak
<dan.kortschak@adelaide.edu.au> wrote:
> During manual testing everything works, but automating it results in the
> query scripts starting before the population transactions having
> completed, so they give erroneous result.
>

Update your process to have the query scripts wait until the
population scripts are done.  Either that or have the populate script
LOCK TABLE the first table that the query is going to use, and it will
automatically block until your transaction is complete for populating.

But really, it sounds like you have a process coordination problem,
not a database problem.

Hmmm.... you could use the DB to synchronize by having the query
program LISTEN for an event and wait until that arrives, then have the
populating program NOTIFY that event once it is done.  Just select()
on the Pg socket on the query program and once it is ready to read,
check for any NOTIFY events that may have come.

pgsql-general by date:

Previous
From: Dan Kortschak
Date:
Subject: Re: how to ensure a client waits for a previous transaction to finish?
Next
From: John R Pierce
Date:
Subject: Re: how to ensure a client waits for a previous transaction to finish?