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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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 13:13:51
Message-ID: 20190104131351.GF2067@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jan 02, 2019 at 05:18:08PM -0500, Tom Lane wrote:
> Hm. I can reproduce this if I start in a virgin database, but not
> otherwise. I think the problem is that the prepared transaction has
> created the pg_temp_NN schema for its session, and therefore there
> is an uncommitted pg_namespace entry for that schema name, and the
> second session is also trying to create that schema (because it has
> the same backend ID) so it blocks waiting to see if that index
> entry commits.

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. A separate flag looks necessary to
me so as we don't bump on "cannot PREPARE a transaction that has
operated on temporary tables" in this case. That would be
back-patchable, and if both XACT_FLAGS_ACCESSEDTEMPREL and the new
flag are set then we just blow up on the original error message when
committing.

Opinions?
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2019-01-04 14:09:48 Re: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable
Previous Message Alexey Bashtanov 2019-01-04 13:13:15 Re: Is temporary functions feature official/supported? Found some issues with it.