Re: Odd behavior with PG_TRY

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Odd behavior with PG_TRY
Date: 2017-01-06 11:43:14
Message-ID: CAB7nPqS8mVqFd9mw84UbaofaiXrfd0pgRfeZrhbL8DMdHJayTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 5, 2017 at 7:10 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> Memory contexts used in catch block also doesn't seem to be marked as
> volatile, you might want to try by marking them as volatile. Also, it
> might worth trying it on some other system to see if you are by any
> chance hitting the problem similar to what Tom has faced.

If a variable is modified within PG_TRY and then referenced in
PG_CATCH it needs to be marked as volatile to be strictly in
conformance with POSIX. This also ensures that any compiler does not
do any stupid optimizations with those variables in the way they are
referenced and used.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2017-01-06 12:25:01 Re: postgres_fdw : altering foreign table not invalidating prepare statement execution plan.
Previous Message Ashutosh Bapat 2017-01-06 11:34:09 Re: Parallel Append implementation