Re: why does plperl cache functions using just a bool for is_trigger

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: Hannu Krosing <hannu(at)2ndquadrant(dot)com>
Cc: Jan Urbański <wulczer(at)wulczer(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: why does plperl cache functions using just a bool for is_trigger
Date: 2010-11-04 20:31:51
Message-ID: AANLkTikk9VF=guVjTXkCQARaZLxnHX0zyC=1Snrp71nt@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 4, 2010 at 14:29, Alex Hunsaker <badalex(at)gmail(dot)com> wrote:
> On Thu, Nov 4, 2010 at 13:43, Hannu Krosing <hannu(at)2ndquadrant(dot)com> wrote:
>> So your plan was to have some savepoint before each execute ?
>>
>> How would one rollback the latest transaction ?
>
> It is always rolled back.  Its how plperl works today:
> create or replace function foo() returns int as $$
> eval {
>    spi_exec_query('create table uniq (num int primary key');
>    spi_exec_query('insert into uniq (num) values (1), (1);', 1);
> };

To be clear, there is no reason to have both in an eval {}. There is
no magic savepoint there. if 'insert into' fails, the table will
still be created (assuming the transaction is not aborted later of
course).

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-11-04 21:00:23 Re: lazy snapshots?
Previous Message Alex Hunsaker 2010-11-04 20:29:49 Re: why does plperl cache functions using just a bool for is_trigger