From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | "David E(dot) Wheeler" <david(dot)wheeler(at)iovation(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: PL/perl elog(ERROR) Does not Abort Transaction |
Date: | 2012-05-11 00:20:46 |
Message-ID: | 20120511002046.GG16881@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, May 10, 2012 at 04:21:24PM -0700, David E. Wheeler wrote:
> Hackers,
>
> Shouldn't a call to elog(NOTICE) invalidate the current tranaction?
I assume you mean elog(ERROR)?
> david=# begin;
> BEGIN
> Time: 0.178 ms
> david=# do language plperl $$ elog(ERROR, 'foo')$$;
> ERROR: foo at line 1.
> CONTEXT: PL/Perl anonymous code block
> david=# select true;
> bool
> ------
> t
> (1 row)
>
> Time: 0.203 ms
>
> The docs say:
>
> > ERROR raises an error condition; if this is not trapped by the surrounding Perl code, the error propagates out to the calling query, causing the current transaction or subtransaction to be aborted.
>
> So I'm surprised that the transaction is not aborted. Bug?
Well, git head show an error:
test=> begin;
BEGIN
test=> do language plperl $$ elog(ERROR, 'foo')$$;
ERROR: foo at line 1.
CONTEXT: PL/Perl anonymous code block
test=> select true;
ERROR: current transaction is aborted, commands ignored until end of
transaction block
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
From | Date | Subject | |
---|---|---|---|
Next Message | David E. Wheeler | 2012-05-11 00:27:26 | Re: PL/perl elog(ERROR) Does not Abort Transaction |
Previous Message | Bruce Momjian | 2012-05-10 23:28:20 | Re: synchronous_commit and remote_write |