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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Sat, 28 Sep 2002 17:02:00 +0200
"Magnus Naeslund(f)" <mag@fbab.net>
Vacuum from within a function crashes backend
Magnus Naeslund(f) dijo: 

> Hello, 
> 
> I did a vacuum from within a function, and it went sig11 on me.
> Is it illegal to do that?

Huh...  what version is this?  In current sources, VACUUM cannot be run
inside a function (it will throw an ERROR).  In 7.2[.1] I see there is
no protection against this.

Maybe the fix for this should be backported to 7.2 also.

-- 
Alvaro Herrera (<alvherre[a]atentus.com>)
"Hay quien adquiere la mala costumbre de ser infeliz" (M. A. Evans)



Sat, 28 Sep 2002 11:09:24 -0400 (CLT)
Alvaro Herrera <alvherre@atentus.com>
Re: Vacuum from within a function crashes backend
Alvaro Herrera <alvherre@atentus.com> wrote:
> Magnus Naeslund(f) dijo:
> 
>> Hello,
>> 
>> I did a vacuum from within a function, and it went sig11 on me.
>> Is it illegal to do that?
> 
> Huh...  what version is this?  In current sources, VACUUM cannot be
> run inside a function (it will throw an ERROR).  In 7.2[.1] I see
> there is no protection against this.
> 
> Maybe the fix for this should be backported to 7.2 also.

Argh!
Sorry i forgot the version, it's as you say 7.2.1..
Then i'll just not do that :)

Magnus

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Programmer/Networker [|] Magnus Naeslund
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Sat, 28 Sep 2002 18:12:09 +0200
"Magnus Naeslund(f)" <mag@fbab.net>
Re: Vacuum from within a function crashes backend