[BUGS] Bug #608: cache lookup failed

2002-03-06 Thread pgsql-bugs

Laurent Faillie ([EMAIL PROTECTED]) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
cache lookup failed

Long Description
Hi all,

I have just upgraded my 1.7.3 database to 7.2, following documentation's instruction 
(pg_dumpall + psql < dumpfile).

All is working Ok but a call to an PL/SQL function which fails w/ the following code.

ERROR:  fmgr_info: function 16594: cache lookup failed

I have tryed to drop and recreate this function but it fails again.

I need some help because this problem blocks all my production as most of my 
application depend on it :-(

I'm working on an HP-UX 11.0 box and postgresql was compiled using GCC 
2.95.3

Thank for your help

- Laurent

Sample Code
CREATE TABLE disk_toppage_stats (
machine TEXT,
jourDATE,
pourcentSMALLINT DEFAULT 0,
level   SMALLINT DEFAULT0
);


CREATE FUNCTION upd_disk_toppage_stats() RETURNS text AS '
DECLARE
res RECORD;
res2 RECORD;
res_lmt RECORD;

nv_vert CONSTANT SMALLINT := 0;
nv_jaune CONSTANT SMALLINT := 1;
nv_rouge CONSTANT SMALLINT := 2;

-- Default value for levels
def_lmt_jaune   CONSTANT SMALLINT := 80;
def_lmt_rouge   CONSTANT SMALLINT := 90;

lmt_jaune   SMALLINT;
lmt_rouge   SMALLINT;
level   SMALLINT;
BEGIN

FOR res IN select * from disk_toppage_stats LOOP
--  RAISE NOTICE ''machine = %, jour = %'',res.machine,res.jour;

--
--  Update the maximum percentage for each machine.
--

EXECUTE ''UPDATE disk_toppage_stats SET pourcent=(select max(pourcent) 
FROM disk_space WHERE machine='' || quote_literal(res.machine) || '' AND jour='' || 
quote_literal(res.jour) || '') WHERE machine='' || quote_literal(res.machine);


-- RAISE NOTICE ''-- machine=% -'', res.machine;
level := nv_vert;

FOR res2 IN 
select * from disk_space 
where machine=res.machine
and jour=(select jour from disk_toppage_stats where 
machine=res.machine)
LOOP
-- RAISE NOTICE ''fs = %, prc = %'',res2.fs,res2.pourcent;

lmt_jaune := def_lmt_jaune;
lmt_rouge := def_lmt_rouge;

SELECT INTO res_lmt * FROM disk_limit
WHERE machine=res.machine AND fs=res2.fs;

IF FOUND THEN
-- RAISE NOTICE ''** TROUVE ! **'';
lmt_jaune := res_lmt.limite_jaune;
lmt_rouge := res_lmt.limite_rouge;
END IF;

IF level = nv_vert THEN
IF res2.pourcent >= lmt_jaune THEN
level := nv_jaune;
END IF;
END IF;

IF res2.pourcent >= lmt_rouge THEN
level := nv_rouge;
EXIT;
END IF;
END LOOP;

EXECUTE ''UPDATE disk_toppage_stats SET level='' || 
quote_literal(level) || '' WHERE machine='' || quote_literal(res.machine);
--RAISE NOTICE ''on est sortie avec un niveau %'',level;
END LOOP;

RETURN ''ok'';
END;

' LANGUAGE 'plpgsql';


No file was uploaded with this report


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [BUGS] Bug #608: cache lookup failed

2002-03-06 Thread Tom Lane

[EMAIL PROTECTED] writes:
> All is working Ok but a call to an PL/SQL function which fails w/ the following code.

> ERROR:  fmgr_info: function 16594: cache lookup failed

Most likely this means something happened to the call handler function
for plpgsql.  Look in pg_language to see the "lanplcallfoid" value for
plpgsql; is it 16594?  Do you have an entry in pg_proc for
"plpgsql_call_handler", and if so what does it look like?

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html