Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5bde165

Browse files
committed
Switch function current_schema[s]() to be parallel-unsafe
When invoked for the first time in a session, current_schema() andcurrent_schemas() can finish by creating a temporary schema. Currentlythose functions are parallel-safe, however if for a reason or anotherthey get launched across multiple parallel workers, they would fail whenattempting to create a temporary schema as temporary contexts are notsupported in this case.The original issue has been spotted by buildfarm members crake andlapwing, after commitc5660e0 has introduced the first regression testsbased on current_schema() in the tree. After that,396676b hasintroduced a workaround to avoid parallel plans but that was notcompletely right either.Catversion is bumped.Author: Michael PaquierReviewed-by: Daniel GustafssonDiscussion:https://postgr.es/m/20190118024618.GF1883@paquier.xyz
1 parent6ca015f commit5bde165

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201903251
56+
#defineCATALOG_VERSION_NO201903271
5757

5858
#endif

‎src/include/catalog/pg_proc.dat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,11 +2787,11 @@
27872787
prosrc => 'name_text' },
27882788

27892789
{ oid => '1402', descr => 'current schema name',
2790-
proname => 'current_schema', provolatile => 's',prorettype => 'name',
2791-
proargtypes => '', prosrc => 'current_schema' },
2790+
proname => 'current_schema', provolatile => 's',proparallel => 'u',
2791+
prorettype => 'name',proargtypes => '', prosrc => 'current_schema' },
27922792
{ oid => '1403', descr => 'current schema search list',
2793-
proname => 'current_schemas', provolatile => 's',prorettype => '_name',
2794-
proargtypes => 'bool', prosrc => 'current_schemas' },
2793+
proname => 'current_schemas', provolatile => 's',proparallel => 'u',
2794+
prorettype => '_name',proargtypes => 'bool', prosrc => 'current_schemas' },
27952795

27962796
{ oid => '1404', descr => 'substitute portion of string',
27972797
proname => 'overlay', prorettype => 'text',

‎src/test/regress/expected/temp.out

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,8 @@ prepare transaction 'twophase_tab';
360360
ERROR: cannot PREPARE a transaction that has operated on temporary objects
361361
-- Corner case: current_schema may create a temporary schema if namespace
362362
-- creation is pending, so check after that. First reset the connection
363-
-- to remove the temporary namespace, and make sure that non-parallel plans
364-
-- are used.
363+
-- to remove the temporary namespace.
365364
\c -
366-
SET max_parallel_workers = 0;
367-
SET max_parallel_workers_per_gather = 0;
368365
SET search_path TO 'pg_temp';
369366
BEGIN;
370367
SELECT current_schema() ~ 'pg_temp' AS is_temp_schema;

‎src/test/regress/sql/temp.sql

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,8 @@ prepare transaction 'twophase_tab';
274274

275275
-- Corner case: current_schema may create a temporary schema if namespace
276276
-- creation is pending, so check after that. First reset the connection
277-
-- to remove the temporary namespace, and make sure that non-parallel plans
278-
-- are used.
277+
-- to remove the temporary namespace.
279278
\c-
280-
SET max_parallel_workers=0;
281-
SET max_parallel_workers_per_gather=0;
282279
SET search_path TO'pg_temp';
283280
BEGIN;
284281
SELECT current_schema() ~'pg_temp'AS is_temp_schema;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp