function tree_level(varchar) (from OpenACS) no longer work under 7.2
function tree_level(varchar) (from OpenACS) no longer work under 7.2
От:
Jean-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 ARGUDORe: function tree_level(varchar) (from OpenACS) no longer work under 7.2
От:
Jean-Paul ARGUDO <jean-paul.argudo@idealx.com>
Дата:
> > 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
Re: function tree_level(varchar) (from OpenACS) no longer work under 7.2
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Jean-Paul ARGUDO 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