From: Michael Paquier <michael@paquier.xyz>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexey Bashtanov <bashtanov@imap.cc>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Cc: mmitar@gmail.com
Subject: Re: Is temporary functions feature official/supported? Found some issues with it.
Date: Wed, 9 Jan 2019 16:30:11 +0900
Message-ID: <20190109073011.GB23045@paquier.xyz> (raw)
In-Reply-To: <CAD21AoDL8quouJr50dZVyuF03K+jKW_nP-53RWD7XNnHzzxUuA@mail.gmail.com>
References: <5d910e2e-0db8-ec06-dd5f-baec420513c3@imap.cc>
<22938.1546456949@sss.pgh.pa.us>
<52794060-3339-e699-a8d5-e3dd7c81fa95@imap.cc>
<10857.1546467488@sss.pgh.pa.us>
<20190104131351.GF2067@paquier.xyz>
<9176.1546613679@sss.pgh.pa.us>
<20190105000037.GA1626@paquier.xyz>
<20190107024211.GA22498@paquier.xyz>
<CAD21AoDL8quouJr50dZVyuF03K+jKW_nP-53RWD7XNnHzzxUuA@mail.gmail.com>
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
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, sawada.mshk@gmail.com, tgl@sss.pgh.pa.us, bashtanov@imap.cc, mmitar@gmail.com
Subject: Re: Is temporary functions feature official/supported? Found some issues with it.
In-Reply-To: <20190109073011.GB23045@paquier.xyz>
References: <5d910e2e-0db8-ec06-dd5f-baec420513c3@imap.cc> <22938.1546456949@sss.pgh.pa.us> <52794060-3339-e699-a8d5-e3dd7c81fa95@imap.cc> <10857.1546467488@sss.pgh.pa.us> <20190104131351.GF2067@paquier.xyz> <9176.1546613679@sss.pgh.pa.us> <20190105000037.GA1626@paquier.xyz> <20190107024211.GA22498@paquier.xyz> <CAD21AoDL8quouJr50dZVyuF03K+jKW_nP-53RWD7XNnHzzxUuA@mail.gmail.com> <20190109073011.GB23045@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox