Re: problem with TRUNCATE TABLE in plpgsql function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: problem with TRUNCATE TABLE in plpgsql function
Date: 2002-11-01 16:03:48
Message-ID: 26345.1036166628@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz> writes:
> I played with some own old plpgsql functions. I found "error" in plpgsql
> 7.3. When I use TRUNCATE TABLE in function I get
> TRUNCATE TABLE cannot be executed from a function.
> In 7.2.2. I can use this command. Why, now I can't use truncate table?

This is a deliberate change for safety reasons: if your function errors
out after performing TRUNCATE, you are in big trouble.

If TRUNCATE is ever rewritten to be rollback-safe, we will remove the
restriction.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Neil Conway 2002-11-01 18:27:42 Re: posgresql 7.3beta3 compile error in src/pl/plperl (perl extension)
Previous Message Igor Shevchenko 2002-11-01 15:02:38 posgresql 7.3beta3 compile error in src/pl/plperl (perl extension)