Shouldn't current_schema() be at least PARALLEL RESTRICTED?

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Shouldn't current_schema() be at least PARALLEL RESTRICTED?
Date: 2019-01-18 02:46:18
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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:

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:

Here is the problem:
SET search_path TO 'pg_temp';
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?



Browse pgsql-hackers by date

  From Date Subject
Next Message Tsunakawa, Takayuki 2019-01-18 03:33:34 RE: Libpq support to connect to standby server as priority
Previous Message Mitar 2019-01-18 01:53:08 Re: Feature: temporary materialized views