Subject: postquel functions

From: [email-masked] (Ben Verghese)
Date: Thu, 4 Nov 93 14:57:46 -0800

I am trying to call a user defined postquel function from libpq and having
some problems. The function is defined as

define function acctupdt
(language = "postquel", returntype = setof int4)
arg is (int4, int4, int4, int4)
as " replace ACCT(bal = ACCT.bal + $4) where ACCT.aid = $3
replace TELLER(bal = TELLER.bal + $4) where TELLER.tid = $2
replace BRANCH(bal = BRANCH.bal + $4) where BRANCH.bid = $1
retrieve(x = 1)"

I can call it from the monitor and it works fine. However if I try to call it
from libpq from within a C program it gets the following intermittent errors
(I have attached a code fragment from the C program showing the call). Anyone
know why this is happening ?

	Returned balance is 0, in time (29,90605) for 1
	WARN:Nov  4 14:49:09:init_fcache: Cache lookup failed for procedure 0
	e 0

	Returned balance is 0, in time (1,-79913) for 2
	Returned balance is 0, in time (1,-260001) for 3
	Returned balance is 0, in time (1,289999) for 4
	WARN:Nov  4 14:49:12:init_fcache: Cache lookup failed for procedure 0
	e 0

	Returned balance is 0, in time (1,-450001) for 5
	Returned balance is 0, in time (1,-310001) for 6
	Returned balance is 0, in time (0,739999) for 10

(Note: The returned balance 0 is okay, I am concerned about the Warning)

code fragment (in a loop):

  c = buf1;
  c += sprintf(c, "retrieve (x = acctupdt(%d,%d,%d,%d))",
	       bid, tid, aid, delta);
  PQexec(buf1);

thanks,

	Ben Verghese

********************************************************************************
Ben Verghese				Ph: 	(415) 723-4388 (office)
Computer Systems Lab				(415) 725-3732 (lab)
Electrical Engineering Dept.		Email:	[email-masked]
Stanford University
********************************************************************************