| From: | "Magnus Naeslund(f)" <mag(at)fbab(dot)net> | 
|---|---|
| To: | <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Vacuum from within a function crashes backend | 
| Date: | 2002-09-28 15:02:00 | 
| Message-ID: | 14c001c266ff$ff953f60$f80c0a0a@mnd | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hello,
I did a vacuum from within a function, and it went sig11 on me.
Is it illegal to do that?
The function:
drop function xorder1_cleanup();
create function xorder1_cleanup() RETURNS integer AS '
declare
 x record;
 c integer;
begin
   c:=0;
   FOR x IN SELECT order_id,count(*) as cnt FROM xorder1_updates group by order_id LOOP
     if x.cnt > 1 then
       c:=c+x.cnt;   
       delete from xorder1_updates where order_id = x.order_id;
       insert into xorder1_updates(order_id) values (x.order_id);
     end if;
   END LOOP;
   execute ''vacuum full analyse xorder1_updates;'';
   return c;
end;
' LANGUAGE 'plpgsql';
Magnus
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Programmer/Networker [|] Magnus Naeslund
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2002-09-28 15:02:30 | Re: How to REINDEX in high volume environments? | 
| Previous Message | Justin Clift | 2002-09-28 14:43:12 | Re: How to REINDEX in high volume environments? |