function tree_level(varchar) (from OpenACS) no longer work under 7.2

Started by Jean-Paul ARGUDOabout 24 years ago3 messagesbugs
Jump to latest
#1Jean-Paul ARGUDO
jean-paul.argudo@idealx.com

Hi all,

Testing a port from Oracle to PG 7.1.3. onto PG 7.2 has error trying to use the
following function (frop OpenACS, to port connect by Oracle statments under PG):

create function tree_level(varchar) returns integer as '
declare
inkey alias for $1;
cnt integer default 0;
begin
for i in 1..length(inkey) LOOP
if substr(inkey,i,1) = ''/'' then
cnt := cnt + 1;
end if;
end LOOP;

return cnt;

end;' language 'plpgsql';

example:

dbks=# select tree_level(t01_tree_sortkey) from t01_20011231 limit 10;
ERROR: SearchSysCache: Bad cache id 27

I found the SearchSysCache() function in tools/cache in the PG srcs. Readding
the code, I tought about corruption problems on the database. I made a
vacuum --analyze dbks, hopping this would "repair" the DB.

But this still not works. So I'm a bit confused. What's wrong?

Thanks in advance and best regards.

--
Jean-Paul ARGUDO

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jean-Paul ARGUDO (#1)
Re: function tree_level(varchar) (from OpenACS) no longer work under 7.2

Jean-Paul ARGUDO <jean-paul.argudo@idealx.com> writes:

ERROR: SearchSysCache: Bad cache id 27

Seen it before...

This is not a bug, it is a broken installation. You are trying to
invoke a 7.1 plpgsql in a 7.2 backend.

regards, tom lane

#3Jean-Paul ARGUDO
jean-paul.argudo@idealx.com
In reply to: Tom Lane (#2)
Re: function tree_level(varchar) (from OpenACS) no longer work under 7.2

ERROR: SearchSysCache: Bad cache id 27

This is not a bug, it is a broken installation. You are trying to
invoke a 7.1 plpgsql in a 7.2 backend.

Right analysis Tom!

createlang with old plpgsql.so ...

had to drop functions / triggers using old plpgsql.so (thanks to a select on
pg_proc)

drop the language

create the language

rebuild functions and triggers: all ok now..

Thanks Tom.

--
Jean-Paul ARGUDO