diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-03-14 19:48:46 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-03-14 19:48:46 -0400 |
commit | 270b7daf5cb1e955f8771ec819eb810057d1779b (patch) | |
tree | 3ecc47e050deec707e0c738107cc39bbf7fce6e1 | |
parent | 5864d6a4b62ada2ad60a8c456b4ee62972a9c10d (diff) | |
download | postgresql-270b7daf5cb1e955f8771ec819eb810057d1779b.tar.gz postgresql-270b7daf5cb1e955f8771ec819eb810057d1779b.zip |
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
-rw-r--r-- | src/backend/commands/explain.c | 2 | ||||
-rw-r--r-- | src/test/regress/expected/select_into.out | 7 | ||||
-rw-r--r-- | src/test/regress/sql/select_into.sql | 8 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index ee13136b7fd..9cd31279379 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -347,7 +347,7 @@ ExplainOneQuery(Query *query, IntoClause *into, ExplainState *es, INSTR_TIME_SET_CURRENT(planstart); /* plan the query */ - plan = pg_plan_query(query, CURSOR_OPT_PARALLEL_OK, params); + plan = pg_plan_query(query, into ? 0 : CURSOR_OPT_PARALLEL_OK, params); INSTR_TIME_SET_CURRENT(planduration); INSTR_TIME_SUBTRACT(planduration, planstart); diff --git a/src/test/regress/expected/select_into.out b/src/test/regress/expected/select_into.out index 9d3f04758e9..b577d1b3ccb 100644 --- a/src/test/regress/expected/select_into.out +++ b/src/test/regress/expected/select_into.out @@ -74,7 +74,14 @@ SELECT * FROM created_table; 4567890123456789 | -4567890123456789 (5 rows) +-- Try EXPLAIN ANALYZE SELECT INTO, but hide the output since it won't +-- be stable. +DO $$ +BEGIN + EXECUTE 'EXPLAIN ANALYZE SELECT * INTO TABLE easi FROM int8_tbl'; +END$$; DROP TABLE created_table; +DROP TABLE easi; -- -- Disallowed uses of SELECT ... INTO. All should fail -- diff --git a/src/test/regress/sql/select_into.sql b/src/test/regress/sql/select_into.sql index 4d1cc86556b..e4460aea2fd 100644 --- a/src/test/regress/sql/select_into.sql +++ b/src/test/regress/sql/select_into.sql @@ -66,7 +66,15 @@ SELECT make_table(); SELECT * FROM created_table; +-- Try EXPLAIN ANALYZE SELECT INTO, but hide the output since it won't +-- be stable. +DO $$ +BEGIN + EXECUTE 'EXPLAIN ANALYZE SELECT * INTO TABLE easi FROM int8_tbl'; +END$$; + DROP TABLE created_table; +DROP TABLE easi; -- -- Disallowed uses of SELECT ... INTO. All should fail |