how to synchronize database operations?

From: Markus Wagner <magnus(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: how to synchronize database operations?
Date: 2002-08-15 14:36:02
Message-ID: 200208151636.02712.magnus@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

when I (re)create my db from within C using libpq I do the following:
I open "template1" and execute "drop database ..." and "create database ...".
This worked fine for some time. However, I encountered some synchronization
problem:

When recreating, which includes the drop command, I get immediately before the
create command the error "template1 is accessed by other users". Then, when
doing the same thing again, there is no db to drop, and the create call
succeeds.

It seems that the create command comes too early for the postmaster. Simply
adding a delay of some seconds would not be that good.

How can I synchronize that? Just trying to open template1 again and again?

A code snippet would help very much.

Thank you,
Markus

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2002-08-15 14:39:04 Re: Problem with Now()?
Previous Message Preben Holm 2002-08-15 14:33:43 Re: Why choose PostreSQL and not MySQL or Oracle!!