pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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: Thu, 10 Jan 2019 12:45:41 +0900
Message-ID: <20190110034541.GI2157@paquier.xyz> (raw)
In-Reply-To: <CAD21AoDw6PYX4pTjukDGot+zdqBDqhwEt=0TKz1xej4e7nhpTA@mail.gmail.com>
References: <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>
	<CAD21AoDw6PYX4pTjukDGot+zdqBDqhwEt=0TKz1xej4e7nhpTA@mail.gmail.com>

On Thu, Jan 10, 2019 at 11:47:32AM +0900, Masahiko Sawada wrote:
> Yes, I was confused that in spite of the relation is a kind of
> database object we separate two cases, relation and database objects
> other than relation. So I thought that we can merge these flags to
> something like XACT_FLAGS_ACCESSEDTEMPOBJ tracking whether the
> transaction created, locked or dropped objects such as tables,
> functions and datatypes on a temoprary namespace.

Sure.  For HEAD I don't mind doing so and that makes sense.  On
back-branches though that's another story... 

> I've found a corner-case issue with this patch; this issue still
> happens when we create the extension on the temprary namespace,
> because it can be done without accessing the namespace if the
> temporary namespace is already created.
> 
> postgres(1:59232)=# create table pg_temp.e(c int);
> CREATE TABLE
> postgres(1:59232)=# begin;
> BEGIN
> postgres(1:59232)=# create extension pgcrypto schema pg_temp_3;
> CREATE EXTENSION
> postgres(1:59232)=# prepare transaction 'a';
> PREPARE TRANSACTION
> postgres(1:59232)=# create extension pgcrypto;
> (hang..)

There is a reason why I have split that part into a separate patch and
a separate thread: 
https://commitfest.postgresql.org/22/1969/

The thing is that this behavior is rather unstable, for example I bump
easily into that:
=# create extension dblink schema pg_temp_3;
ERROR:  42883: function dblink_connect_u(text) does not exist

> Also, since even the current_schame() and the current_schemas() could
> create the temporary namespace when executing fetch_search_path()
> while 'pg_temp' appears the head of seach_patch, for example, the
> following transaction cannot prepre. But it possible could be
> acceptable by users as this is very corner case and it could be
> regards as accessing the temporary namespace actually.

Yeah, but the temporary schema gets created, which is something that
we want to avoid, so 2PC must fail on that case as well or you would
run again into the same locking hazards if the same temp schema gets
reused in a different backend.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (22+ messages)  latest in thread

Message-ID: <20190110034541.GI2157@paquier.xyz>
Permalink:  ../20190110034541.GI2157@paquier.xyz/
Also on:    postgresql.org/message-id/20190110034541.GI2157@paquier.xyz

 · 

reply

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: <20190110034541.GI2157@paquier.xyz>
  References: <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> <CAD21AoDw6PYX4pTjukDGot+zdqBDqhwEt=0TKz1xej4e7nhpTA@mail.gmail.com> <20190110034541.GI2157@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