how to synchronize database operations?

Поиск
Список
Период
Сортировка
От Markus Wagner
Тема how to synchronize database operations?
Дата
Msg-id 200208151636.02712.magnus@gmx.de
обсуждение исходный текст
Ответы Re: how to synchronize database operations?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Linn Kubler"
Дата:
Сообщение: Re: Problem with Now()?
Следующее
От: Preben Holm
Дата:
Сообщение: Re: Why choose PostreSQL and not MySQL or Oracle!!