Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 270b7da

Browse files
committed
Fix EXPLAIN ANALYZE SELECT INTO not to choose a parallel plan.
We don't support any parallel write operations at present, so choosing a parallel plan causes us to error out. Also, add a new regression test that uses EXPLAIN ANALYZE SELECT INTO; if we'd had this previously, force_parallel_mode testing would have caught this issue. Mithun Cy and Robert Haas
1 parent 5864d6a commit 270b7da

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/backend/commands/explain.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ ExplainOneQuery(Query *query, IntoClause *into, ExplainState *es,
347347
INSTR_TIME_SET_CURRENT(planstart);
348348

349349
/* plan the query */
350-
plan = pg_plan_query(query, CURSOR_OPT_PARALLEL_OK, params);
350+
plan = pg_plan_query(query, into ? 0 : CURSOR_OPT_PARALLEL_OK, params);
351351

352352
INSTR_TIME_SET_CURRENT(planduration);
353353
INSTR_TIME_SUBTRACT(planduration, planstart);

src/test/regress/expected/select_into.out

+7
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ SELECT * FROM created_table;
7474
4567890123456789 | -4567890123456789
7575
(5 rows)
7676

77+
-- Try EXPLAIN ANALYZE SELECT INTO, but hide the output since it won't
78+
-- be stable.
79+
DO $$
80+
BEGIN
81+
EXECUTE 'EXPLAIN ANALYZE SELECT * INTO TABLE easi FROM int8_tbl';
82+
END$$;
7783
DROP TABLE created_table;
84+
DROP TABLE easi;
7885
--
7986
-- Disallowed uses of SELECT ... INTO. All should fail
8087
--

src/test/regress/sql/select_into.sql

+8
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,15 @@ SELECT make_table();
6666

6767
SELECT * FROM created_table;
6868

69+
-- Try EXPLAIN ANALYZE SELECT INTO, but hide the output since it won't
70+
-- be stable.
71+
DO $$
72+
BEGIN
73+
EXECUTE 'EXPLAIN ANALYZE SELECT * INTO TABLE easi FROM int8_tbl';
74+
END$$;
75+
6976
DROP TABLE created_table;
77+
DROP TABLE easi;
7078

7179
--
7280
-- Disallowed uses of SELECT ... INTO. All should fail

0 commit comments

Comments
 (0)