pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Subject: Shouldn't current_schema() be at least PARALLEL RESTRICTED?
Date: Fri, 18 Jan 2019 11:46:18 +0900
Message-ID: <20190118024618.GF1883@paquier.xyz> (raw)

Hi all,

While working on the recent issues with 2PC and temporary objects I
have added a test case based on current_schema() for the first time in
history, and the buildfarm complained about it, as mentioned here:
https://www.postgresql.org/message-id/20190118005949.GD1883@paquier.xyz

The has been causing crake and lapwing to complain about
current_schema() failing to create a temporary schema, which can
happen when invoked for the first time of a session:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2019-01-18%2000%3A34%3A20
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lapwing&dt=2019-01-18%2001%3A20%3A01

Here is the problem:
SET search_path TO 'pg_temp';
BEGIN;
SELECT current_schema() ~ 'pg_temp' AS is_temp_schema;
- is_temp_schema
-----------------
- t
-(1 row)
-
+ERROR:  cannot create temporary tables during a parallel operation
PREPARE TRANSACTION 'twophase_search';
-ERROR:  cannot PREPARE a transaction that has operated on temporary namespace

current_schemas() also has this problem.

For now I have stabilized the test by making sure that non-parallel
plans get used, which makes the buildfarm happy, still that's just a
workaround in my opinion.   One of the reasons why current_schema()
can create temporary schemas is that there are string dependencies
with search_path and the way sessions use it, hence it seems to me
that it would be better to mark the function at least parallel
restricted on HEAD and avoid any unstable behavior?

Thoughts?
--
Michael

Attachments:

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

view thread (5+ messages)  latest in thread

Message-ID: <20190118024618.GF1883@paquier.xyz>
Permalink:  ../20190118024618.GF1883@paquier.xyz/
Also on:    postgresql.org/message-id/20190118024618.GF1883@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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-hackers@lists.postgresql.org
  Subject: Re: Shouldn't current_schema() be at least PARALLEL RESTRICTED?
  In-Reply-To: <20190118024618.GF1883@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