Re: Is temporary functions feature official/supported? Found someissues with it. - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: Is temporary functions feature official/supported? Found someissues with it.
Date
Msg-id 20190109073011.GB23045@paquier.xyz
Whole thread Raw
In response to Re: Is temporary functions feature official/supported? Found someissues with it.  (Masahiko Sawada <sawada.mshk@gmail.com>)
Responses Re: Is temporary functions feature official/supported? Found someissues with it.
List pgsql-bugs
On Wed, Jan 09, 2019 at 04:00:51PM +0900, Masahiko Sawada wrote:
>  /*
>   * 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 temporary
> namespace?

This case would set ACCESSEDTEMPREL but not ACCESSEDTEMPNAMESPACE:
create temp table twophase_tab (a int);
begin;
select a from twophase_tab;
prepare transaction 'twophase_tab';

I kept the original flag mainly for compatibility with the past
handling so as the error message remains constant and back-patchable
for application relying on the existing behavior.  I think that for
HEAD we could consider moving on with an approach where we have only
ACCESSEDTEMPNAMESPACE, still we may want to make a difference for
transactions which have actually tried to take any kind of locks on
the temporary relation.
--
Michael

Attachment

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #15567: Wal receiver process restart failed when a damagedwal record arrived at standby.
Next
From: Bartosz Polnik
Date:
Subject: Re: BUG #15577: Query returns different results when executedmultiple times