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

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alexey Bashtanov <bashtanov(at)imap(dot)cc>, pgsql-bugs <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-09 07:00:51
Message-ID: CAD21AoDL8quouJr50dZVyuF03K+jKW_nP-53RWD7XNnHzzxUuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jan 7, 2019 at 11:42 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Sat, Jan 05, 2019 at 09:00:37AM +0900, Michael Paquier wrote:
> > I think I can get that worked out with a back-patchable approach,
> > still it looks a bit sensitive because of the creation-pending logic
> > which relies on the assertion at the top of InitTempTableNamespace,
> > which is a case we may want to handle with an extra flag for the
> > caller of InitTempTableNamespace(), aka "fail if myTempNamespace is
> > valid instead of just returning back".
>
> Looking at this stuff, I have been able to come up with the attached,
> which introduces a new flag mode for MyXactFlags, which gets set in a
> couple of code paths so as PREPARE TRANSACTIOn complains:
> - When attempting a LOCK on a temporary relation.
> - When dropping objects part of a temporary namespace.
> - When trying to access the temporary schema of a session, where it
> may be initialized (or not if already present).
>

Thank you for the patch. I've looked at the patch and have one question.

/*
* XACT_FLAGS_ACCESSEDTEMPREL - set when a temporary relation is accessed. We
* don't allow PREPARE TRANSACTION in that case.
*/
#define XACT_FLAGS_ACCESSEDTEMPREL (1U << 0)
(snip)
+/*
+ * XACT_FLAGS_ACCESSEDTEMPNAMESPACE - set when a temporary namespace is
+ * accessed. We don't allow PREPARE TRANSACTION in that case.
+ */
+#define XACT_FLAGS_ACCESSEDTEMPNAMESPACE (1U << 2)

The cases where we set XACT_FLAGS_ACCESSEDTEMPNAMESPACE seems to
include the cases setting XACT_FLAGS_ACCESSEDTEMPREL. Is there any
path where we access a temporary relation without accessing temprary
namespace?

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-01-09 07:14:11 Re: BUG #15567: Wal receiver process restart failed when a damaged wal record arrived at standby.
Previous Message Michael Paquier 2019-01-09 04:50:17 Re: Is this a bug in auto vacuum worker?