Re: [HACKERS] Odd behavior with PG_TRY - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: [HACKERS] Odd behavior with PG_TRY
Date
Msg-id CAA4eK1KdsPW5f3=teWr54gUPxgFbTnb_0uLxgF71GDfp=V_spA@mail.gmail.com
Whole thread Raw
In response to [HACKERS] Odd behavior with PG_TRY  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Responses Re: [HACKERS] Odd behavior with PG_TRY
List pgsql-hackers
On Mon, Jan 2, 2017 at 11:14 AM, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:
> In the attached patch (snippet below), I'm seeing something strange with
> args->in.r.atts[]. Prior to entering the PG_TRY block, I can inspect things
> in lldb just fine:
>
> (lldb) call args->in.r.atts[0].func
> (PLyDatumToObFunc) $49 = 0x000000010fc4dc70
> (plpython3.so`PLyString_FromDatum at plpy_typeio.c:621)
> (lldb) call &args->in.r.atts[0]
> (PLyDatumToOb *) $50 = 0x00007fd2b302f6d0
> (lldb) call args->in.r.atts[0]
> (PLyDatumToOb) $51 = {
>   func = 0x000000010fc4dc70 (plpython3.so`PLyString_FromDatum at
> plpy_typeio.c:621)
>   typfunc = {
>     fn_addr = 0x000000010f478b50 (postgres`textout at varlena.c:521)
>     fn_oid = 47
> ...
>
> But I'm getting a EXC_BAD_ACCESS (code=1, address=0xb302f6d0) on the last if
> in the snippet below. Looking at the variables again, I see:
>
> (lldb) call args->in.r.atts[i].func
> error: Couldn't apply expression side effects : Couldn't dematerialize a
> result variable: couldn't read its memory
> (lldb) call args->in.r.atts[i]
> error: Couldn't apply expression side effects : Couldn't dematerialize a
> result variable: couldn't read its memory
>

Looks strange, what is the value of 'i'?  Did you get the same result
if you try to print args->in.r.atts[0] inside PG_TRY?

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [HACKERS] rewrite HeapSatisfiesHOTAndKey
Next
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] proposal: session server side variables