Re: vary read_only in SPI calls? or poke at the on-entry snapshot?

From: Chapman Flack <chap(at)anastigmatix(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: vary read_only in SPI calls? or poke at the on-entry snapshot?
Date: 2018-09-22 02:26:02
Message-ID: 5BA5A83A.7000609@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/20/18 00:44, Tom Lane wrote:
>> 1. fiddle the loader to always pass read_only => false to SPI calls,
>> regardless of the volatility of the function it is loading for.
>> 2. leave the loader alone, and adjust install_jar (an infrequent
>> operation) to do something heretical with its on-entry snapshot.
>
> I suspect #1 is less likely to have bad side-effects. But I've not
> done any careful analysis.

Just noticed too: a thing prepared with the SPI_prepare... functions
(which take no read_only or snapshot parameters) later gets executed by
one of the SPI_execute... functions, which do take such parameters.

I assume the analysis and planning take place with reference to some
snapshot---necessarily? right?---(though on a quick skim of the code
I'm not yet sure what snapshot that is or how chosen), but the
parameters accepted by SPI_execute... can lead to a different snapshot
being in effect then.

Is that by design? Does it imply certain caveats I should be careful
about? Does it trigger any amount of replanning?

-Chap

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2018-09-22 03:17:14 Re: Proposal for disk quota feature
Previous Message Andres Freund 2018-09-22 01:57:01 Re: [PATCH] Tab completion for ALTER DATABASE … SET TABLESPACE