Subject: replace acting like an update

From: PostGres <[email-masked]>
Date: Fri, 24 Sep 1993 11:23:11 +1000 (EST)

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 : [email-masked]          |
========================================================