Re: Assertions in PL/PgSQL

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assertions in PL/PgSQL
Date: 2013-09-14 20:18:04
Message-ID: 5234C47C.4030104@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-09-14 21:55, Jaime Casanova wrote:
> On Sat, Sep 14, 2013 at 1:52 PM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:
>> And by "compile time" here, I mean at the time when the PL/PgSQL function
> is
>> compiled, not the postgres server binary.
>>
>
> and "compile time" means when the function is created or replaced? or the
> first time is used?

Uhh.. I have to admit, I'm not sure. I think this would be when you
CREATE the function for the backend that created the function, and on
the first call in other backends.

> if the second. Why not have a plpgsql.enable_assert variable?
> A directive you can use per function
>
> then i can keep the ASSERT and activate them by replacing the function

The patch supports a "compiler option" to override the global option and
enable it per function:

create function foof()
returns void
as $$
#enable_assertions
begin
-- failure
assert 1 > 2;
end
$$ language plpgsql;

Does this address your wishes?

Regards,
Marko Tiikkaja

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2013-09-14 20:24:35 Re: Assertions in PL/PgSQL
Previous Message Dimitri Fontaine 2013-09-14 20:15:58 Where to load modules from?