Re: Is temporary functions feature official/supported? Found some issues with it.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Alexey Bashtanov <bashtanov(at)imap(dot)cc>, pgsql-bugs(at)postgresql(dot)org, mmitar(at)gmail(dot)com
Subject: Re: Is temporary functions feature official/supported? Found some issues with it.
Date: 2019-01-04 16:19:47
Message-ID: 19829.1546618787@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> On 2019-Jan-04, Michael Paquier wrote:
>> That should not be allowed to commit directly. I think that we should
>> just add a new value for MyXactFlags which tracks the transaction
>> where the temporary namespace has been created, and generate an error
>> if trying to use 2PC in this case.

> That implies that a 2PC transaction will fail if it's run in a session
> for which the temp namespace doesn't previously exist. I think it's a
> fairly ugly failure mode, and one that normal testing will not catch
> because it'll occur very rarely. An app that detects this problem at
> run time will have to create a random temp object, commit normally, then
> re-run the 2PC transaction from the start ... a lot of code to deal with
> something that shouldn't happen in the first place.

> I wonder if we can somehow create the temp schema in a way that makes it
> immediately visible to everyone, and not depend on the commit status of
> the creating transaction -- say mark the tuple with xmin=frozenXid or
> something like ugly that.

That's not sufficient to solve the problem, because there are really
two issues here. Even if the temp schema already exists, we cannot
allow a 2PC transaction to create/drop/lock objects in it, because
that will mess things up for the surrounding session, or the next
session to use the same temp schema: trying to clear out the schema
will either fail or block.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Hugh Ranalli 2019-01-04 16:29:42 Re: BUG #15548: Unaccent does not remove combining diacritical characters
Previous Message Alvaro Herrera 2019-01-04 15:43:37 Re: Is temporary functions feature official/supported? Found some issues with it.