Re: Question about MemoryContexts and functions that returns

From: Thomas Hallgren <thomas(at)tada(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Question about MemoryContexts and functions that returns
Date: 2006-03-22 06:33:32
Message-ID: 4420EFBC.2030700@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Thomas Hallgren <thomas(at)tada(dot)se> writes:
>
>> Is there a difference in how the executor treat a C function and a
>> function using a call handler that can cause this behavior?
>>
>
> Can't think of one. You'd better take a closer look at your call
> handler.
>
> gdb'ing with a watchpoint on writes to CurrentMemoryContext might be
> helpful at seeing whether the context is changing unexpectedly.
>
>

Yes, that was helpful. My fault of course. I had a comment in place that
explained exactly what ought to happen. Then the code did the exact
opposite. An excerpt:

/* a class loader or other mechanism might have connected
already. This
* connection must be dropped since its parent context is wrong.
*/
if(self->isMultiCall && SRF_IS_FIRSTCALL())
Invocation_assertConnect();

The Invocation_assertConnect() performs an SPI_connect(). Sigh...
Comments are dangerous :-)

Thanks for your help.

Kind Regards,
Thomas Hallgren

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dhanaraj M - Sun Microsystems 2006-03-22 06:52:04 How to put back??
Previous Message Oleg Bartunov 2006-03-22 06:24:42 Re: 8.2 planning features