Return-Path: postman 
Delivery-Date: Thu, 23 Sep 93 18:24:05 PDT
Return-Path: postman
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA21715; Thu, 23 Sep 93 18:22:06 -0700
Resent-From: postman (POSTGRES mailing list)
Resent-Message-Id: <9309240122.AA21715@postgres.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: postgres@st.nepean.uws.edu.au
Received: from lancelot.st.nepean.uws.EDU.AU by postgres.Berkeley.EDU (5.61/1.29)
	id AA21707; Thu, 23 Sep 93 18:21:54 -0700
Received: from guinevere.st.nepean.uws.edu.au (guinevere) by lancelot.st.nepean.uws.edu.au with SMTP id AA16604
  (5.65c/IDA-1.4.4 for <postgres@postgres.berkeley.edu>); Fri, 24 Sep 1993 11:24:34 +1000
Received: by guinevere.st.nepean.uws.edu.au id AA18590
  (5.65c/IDA-1.4.4 for postgres@postgres.berkeley.edu); Fri, 24 Sep 1993 11:23:12 +1000
From: PostGres <postgres@st.nepean.uws.edu.au>
Message-Id: <199309240123.AA18590@guinevere.st.nepean.uws.edu.au>
Subject: replace acting like an update
To: postgres@postgres.berkeley.edu (PostGres Mail Group)
Date: Fri, 24 Sep 1993 11:23:11 +1000 (EST)
X-Mailer: ELM [version 2.4 PL6]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 2064      
Resent-To: postgres-dist
Resent-Date: Thu, 23 Sep 93 18:22:04 PDT

Hi,

This is a weird problem that I have come across .. maybe it's
just my lack of understanding .. but we'll see.

I am compiling under Ultrix 4.3 and have two postmasters
running on different machines. Each has a seperate database
and I have the following code :

declarations and stuff above but ...

 readX = 1 | (1<<fd[0]);

 if (child=!fork())
 {
   PQsetdb("internet");
   local_server();    /* this sets PQhost to local machine */
   PQexec("begin");
   PQexec("replace campus_config(lockflag=\"t\")");
   success = 1;
   write(fd[1],&success,sizeof success);
   select(31,&readX,0,0,0);
   PQexec("end");
   wait();
 }
 else
 {
   select(31,&readX,0,0,0);
   read(fd[0],&success,sizeof success);
   PQsetdb("internet");
   network_server(); /* this sets PQhost to remote machine */
   PQexec("begin");
   PQexec("replace campus_config(lockflag=\"t\")");
   write(fd[1],&success,sizeof success);
   PQexec("end");
   exit(2);
 }
									    }
this code works fine if there are no locks currently held on
the network database. (ie works ok if there are locks on the local)
however if there are locks held on the network database, when they
are released and the replace occurs, it performs an append not
a replace. the only begin and ends are those that can be seen in the
above code segment. I used the monitor program with a similar
technique to generate the locks .. ie

begin\g
replace campus_config(lockflag="t")\g
then after to some time (to ensure the above code is waiting)
end\g

Any help in this matter would be most appreciated.
-- 
--------------------------------------------------------
| University Of Western Sydney                         |
| Postgres Database Aministration                      |
|                                                      |
| Administrator :  Glen Darby                          |
|                                                      |
|                                                      |
| Return Mail : postgres@st.nepean.uws.edu.au          |
========================================================
