You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by re...@apache.org on 2025/02/13 06:04:32 UTC
(cloudberry) 43/43: Fix icw tests "index only scan, ao support index only scan, rename fallback message..."
This is an automated email from the ASF dual-hosted git repository.
reshke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit f65e82bcb84076aa9c5a225d9856ccb86c86bd30
Author: zhoujiaqi <zh...@hashdata.cn>
AuthorDate: Sat Feb 8 16:27:00 2025 +0800
Fix icw tests "index only scan, ao support index only scan, rename fallback message..."
---
.../expected/auto_explain_optimizer.out | 7 +-
contrib/file_fdw/output/file_fdw.source | 8 +-
contrib/file_fdw/output/file_fdw_optimizer.source | 4 +-
src/backend/commands/explain.c | 2 +-
.../expected/drop-index-concurrently-1.out | 16 +-
...le_operations_should_not_deadlock_optimizer.out | 2 +-
.../regress/expected/DML_over_joins_optimizer.out | 324 +--
src/test/regress/expected/aggregates_optimizer.out | 58 +-
src/test/regress/expected/autostats.out | 4 +-
.../regress/expected/bfv_aggregate_optimizer.out | 54 +-
src/test/regress/expected/bfv_index.out | 90 +-
src/test/regress/expected/bfv_joins_optimizer.out | 16 +-
src/test/regress/expected/bfv_olap_optimizer.out | 2 +-
.../expected/bfv_partition_plans_optimizer.out | 18 +-
src/test/regress/expected/brin_ao_optimizer.out | 18 -
src/test/regress/expected/brin_aocs_optimizer.out | 18 -
src/test/regress/expected/brin_optimizer.out | 18 -
src/test/regress/expected/catcache.out | 20 +-
src/test/regress/expected/catcache_optimizer.out | 23 +-
src/test/regress/expected/correlated_subquery.out | 1 +
.../regress/expected/create_index_optimizer.out | 36 +-
src/test/regress/expected/dpe.out | 33 +-
src/test/regress/expected/dpe_optimizer.out | 44 +-
src/test/regress/expected/explain_format.out | 18 +-
.../regress/expected/explain_format_optimizer.out | 17 +-
src/test/regress/expected/explain_optimizer.out | 510 ++--
src/test/regress/expected/generated_optimizer.out | 312 +--
src/test/regress/expected/gp_covering_index.out | 55 +-
.../expected/gp_covering_index_optimizer.out | 51 +-
src/test/regress/expected/gp_dqa_optimizer.out | 4 +-
src/test/regress/expected/gp_explain.out | 17 +-
src/test/regress/expected/gp_explain_optimizer.out | 203 +-
src/test/regress/expected/gporca.out | 14 +-
src/test/regress/expected/gporca_optimizer.out | 22 +-
.../regress/expected/groupingsets_optimizer.out | 43 +-
src/test/regress/expected/insert_conflict.out | 4 +-
src/test/regress/expected/join_optimizer.out | 58 +-
.../expected/orca_groupingsets_fallbacks.out | 4 +-
.../orca_groupingsets_fallbacks_optimizer.out | 6 +-
src/test/regress/expected/privileges.out | 6 +-
src/test/regress/expected/privileges_optimizer.out | 2612 --------------------
src/test/regress/expected/qp_indexscan.out | 502 ++--
.../regress/expected/qp_indexscan_optimizer.out | 58 +-
src/test/regress/expected/qp_join_universal.out | 119 +-
.../expected/qp_join_universal_optimizer.out | 3 +-
.../expected/qp_orca_fallback_optimizer.out | 9 +-
.../regress/expected/qp_with_clause_optimizer.out | 4 +-
src/test/regress/expected/select_optimizer.out | 16 +-
.../regress/expected/subselect_gp_optimizer.out | 42 +-
src/test/regress/expected/subselect_optimizer.out | 36 +-
src/test/regress/expected/tsrf_optimizer.out | 16 +-
src/test/regress/expected/union_gp_optimizer.out | 8 +-
src/test/regress/expected/union_optimizer.out | 86 +-
src/test/regress/expected/window_optimizer.out | 4 +-
src/test/regress/sql/autostats.sql | 3 +-
src/test/regress/sql/catcache.sql | 2 +-
src/test/regress/sql/correlated_subquery.sql | 2 +
.../regress/sql/orca_groupingsets_fallbacks.sql | 3 +
src/test/regress/sql/privileges.sql | 6 +-
59 files changed, 1514 insertions(+), 4177 deletions(-)
diff --git a/contrib/auto_explain/expected/auto_explain_optimizer.out b/contrib/auto_explain/expected/auto_explain_optimizer.out
index c6f7bd0c36..4c0f8e1cd9 100644
--- a/contrib/auto_explain/expected/auto_explain_optimizer.out
+++ b/contrib/auto_explain/expected/auto_explain_optimizer.out
@@ -33,13 +33,12 @@ SET auto_explain.log_verbose = FALSE;
LOG: statement: SET auto_explain.log_verbose = FALSE;
SELECT relname FROM pg_class WHERE relname='pg_class';
LOG: statement: SELECT relname FROM pg_class WHERE relname='pg_class';
-"Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables",
+"Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables",
LOG: duration: 0.026 ms plan:
Query Text: SELECT relname FROM pg_class WHERE relname='pg_class';
Index Only Scan using pg_class_relname_nsp_index on pg_class (cost=0.15..4.17 rows=1 width=64) (actual rows=1 loops=1)
Index Cond: (relname = 'pg_class'::name)
Heap Fetches: 1
-Optimizer: Postgres-based planner
(slice0) Executor memory: 105K bytes.
Memory used: 128000kB
relname
@@ -59,7 +58,6 @@ Finalize Aggregate (cost=0.00..1326086.34 rows=1 width=8) (actual rows=1 loops=
-> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..431.02 rows=1001 width=1) (actual rows=1001 loops=1)
-> Seq Scan on t1 (cost=0.00..431.01 rows=334 width=1) (actual rows=340 loops=1)
-> Seq Scan on t2 (cost=0.00..431.01 rows=334 width=1) (actual rows=340 loops=1002)
-Optimizer: GPORCA
(slice0) Executor memory: 67K bytes.
(slice1) Executor memory: 119K bytes avg x 3 workers, 119K bytes max (seg0).
(slice2) Executor memory: 42K bytes avg x 3 workers, 42K bytes max (seg0).
@@ -78,7 +76,7 @@ LOG: statement: SET auto_explain.log_verbose = TRUE;
-- this select should not dump execution plan
SELECT relname FROM pg_class WHERE relname='pg_class';
LOG: statement: SELECT relname FROM pg_class WHERE relname='pg_class';
-"Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables",
+"Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables",
relname
----------
pg_class
@@ -100,7 +98,6 @@ Finalize Aggregate (cost=0.00..1326086.34 rows=1 width=8) (actual rows=1 loops=
-> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..431.02 rows=1001 width=1) (actual rows=1001 loops=1)
-> Seq Scan on auto_explain_test.t1 (cost=0.00..431.01 rows=334 width=1) (actual rows=340 loops=1)
-> Seq Scan on auto_explain_test.t2 (cost=0.00..431.01 rows=334 width=1) (actual rows=340 loops=1002)
-Optimizer: GPORCA
Settings: enable_nestloop = 'on'
(slice0) Executor memory: 67K bytes.
(slice1) Executor memory: 119K bytes avg x 3 workers, 119K bytes max (seg0).
diff --git a/contrib/file_fdw/output/file_fdw.source b/contrib/file_fdw/output/file_fdw.source
index 299c0e9b84..b89920e739 100644
--- a/contrib/file_fdw/output/file_fdw.source
+++ b/contrib/file_fdw/output/file_fdw.source
@@ -175,7 +175,7 @@ EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv;
Foreign Scan on public.agg_csv
Output: a, b
Foreign File: @abs_srcdir@/data/agg.csv
- Optimizer: Postgres-based planner
+ Optimizer: Postgres query optimizer
Settings: optimizer=off
\t off
@@ -227,7 +227,7 @@ EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv WHERE a < 0;
Result
Output: a, b
One-Time Filter: false
- Optimizer: Postgres-based planner
+ Optimizer: Postgres query optimizer
Settings: optimizer=off
\t off
@@ -242,7 +242,7 @@ EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv WHERE a < 0;
Result
Output: a, b
One-Time Filter: false
- Optimizer: Postgres-based planner
+ Optimizer: Postgres query optimizer
Settings: constraint_exclusion=on, optimizer=off
\t off
@@ -417,7 +417,7 @@ EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_text WHERE a > 0;
Output: a, b
Filter: (agg_text.a > 0)
Foreign File: @abs_srcdir@/data/agg.data
- Optimizer: Postgres-based planner
+ Optimizer: Postgres query optimizer
Settings: optimizer=off
\t off
diff --git a/contrib/file_fdw/output/file_fdw_optimizer.source b/contrib/file_fdw/output/file_fdw_optimizer.source
index 665c7aacd9..e2349f7876 100644
--- a/contrib/file_fdw/output/file_fdw_optimizer.source
+++ b/contrib/file_fdw/output/file_fdw_optimizer.source
@@ -289,7 +289,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
UPDATE agg SET a = 1;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
-ERROR: ModifyTable mixes distributed and entry-only tables
+ERROR: can't split update for inherit table: agg (preptlist.c:139)
DELETE FROM agg WHERE a = 100;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
@@ -372,7 +372,7 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Insert with External/foreign partition storage types
UPDATE pt set a = 1 where a = 2; -- ERROR
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Update with External/foreign partition storage types
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
ERROR: cannot insert into foreign table "p1" (seg1 127.0.0.1:7008 pid=50091)
SELECT tableoid::regclass, * FROM pt;
NOTICE: One or more columns in the following table(s) do not have statistics: pt
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index d6e1d3be8f..c699ef0aff 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -811,7 +811,7 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
ExplainPropertyStringInfo("Optimizer", es, "Postgres query optimizer");
#ifdef USE_ORCA
else
- ExplainPropertyStringInfo("Optimizer", es, "Pivotal Optimizer (GPORCA)");
+ ExplainPropertyStringInfo("Optimizer", es, "GPORCA");
#endif
ExplainCloseGroup("Settings", "Settings", true, es);
diff --git a/src/test/isolation/expected/drop-index-concurrently-1.out b/src/test/isolation/expected/drop-index-concurrently-1.out
index 5337b696dc..e7b9272f45 100644
--- a/src/test/isolation/expected/drop-index-concurrently-1.out
+++ b/src/test/isolation/expected/drop-index-concurrently-1.out
@@ -18,17 +18,17 @@ Sort
Sort Key: id
-> Index Scan using test_dc_data on test_dc
Index Cond: (data = 34)
-Optimizer: Postgres-based planner
+Optimizer: Postgres query optimizer
(5 rows)
step explains: EXPLAIN (COSTS OFF) EXECUTE getrow_seq;
-QUERY PLAN
--------------------------------------------
-Sort
- Sort Key: id, data
- -> Seq Scan on test_dc
- Filter: ((data)::text = '34'::text)
-Optimizer: Postgres-based planner
+QUERY PLAN
+----------------------------------------------
+Sort
+ Sort Key: id, data
+ -> Index Scan using test_dc_pkey on test_dc
+ Filter: ((data)::text = '34'::text)
+Optimizer: Postgres query optimizer
(5 rows)
step select2: SELECT * FROM test_dc WHERE data=34 ORDER BY id,data;
diff --git a/src/test/isolation2/expected/concurrent_partition_table_operations_should_not_deadlock_optimizer.out b/src/test/isolation2/expected/concurrent_partition_table_operations_should_not_deadlock_optimizer.out
index 9c2dd67841..0e6ce5ab8f 100644
--- a/src/test/isolation2/expected/concurrent_partition_table_operations_should_not_deadlock_optimizer.out
+++ b/src/test/isolation2/expected/concurrent_partition_table_operations_should_not_deadlock_optimizer.out
@@ -159,7 +159,7 @@ VACUUM
QUERY PLAN
----------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- -> Dynamic Index Only Scan on idx on pt
+ -> Dynamic Index Scan on idx on pt
Index Cond: (a < 4)
Number of partitions to scan: 2 (out of 5)
Optimizer: Pivotal Optimizer (GPORCA)
diff --git a/src/test/regress/expected/DML_over_joins_optimizer.out b/src/test/regress/expected/DML_over_joins_optimizer.out
index aeaa9d1997..1411e94fa4 100644
--- a/src/test/regress/expected/DML_over_joins_optimizer.out
+++ b/src/test/regress/expected/DML_over_joins_optimizer.out
@@ -319,11 +319,11 @@ delete from s where b = (select min(a) from r where b = s.b);
-- Update partition key (requires moving tuples from one partition to another)
------------------------------------------------------------
update p set c = c + 1 where c = 0;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
update p set c = c + 1 where b in (select b from s) and c = 0;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select tableoid::regclass, c, count(*) from p group by 1, 2;
tableoid | c | count
---------------+---+-------
@@ -362,11 +362,11 @@ delete from s where b = (select min(a) from r where b = s.b);
-- Update partition key (requires moving tuples from one partition to another)
------------------------------------------------------------
update p set c = c + 1 where c = 0;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
update p set c = c + 1 where b in (select b from s where b = 36);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select tableoid::regclass, c, count(*) from p group by 1, 2;
tableoid | c | count
---------------+---+-------
@@ -405,11 +405,11 @@ delete from s where b = (select min(a) from r where b = s.b);
-- Update partition key (requires moving tuples from one partition to another)
------------------------------------------------------------
update p set c = c + 1 where c = 0;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
update p set c = c + 1 where b in (select b from s) and c = 0;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select tableoid::regclass, c, count(*) from p group by 1, 2;
tableoid | c | count
---------------+---+-------
@@ -448,11 +448,11 @@ delete from s where b = (select min(a) from r where b = s.b);
-- Update partition key (requires moving tuples from one partition to another)
------------------------------------------------------------
update p set c = c + 1 where c = 0;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
update p set c = c + 1 where b in (select b from s) and c = 0;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select tableoid::regclass, c, count(*) from p group by 1, 2;
tableoid | c | count
---------------+---+-------
@@ -491,11 +491,11 @@ delete from s where b = (select min(a) from r where b = s.b);
-- Update partition key (requires moving tuples from one partition to another)
------------------------------------------------------------
update p set c = c + 1 where c = 0;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
update p set c = c + 1 where b in (select b from s) and c = 0;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select tableoid::regclass, c, count(*) from p group by 1, 2;
tableoid | c | count
---------------+---+-------
@@ -531,24 +531,24 @@ insert into p select generate_series(1,10000), generate_series(1,10000) * 3, gen
-- Motion on p, append node, hash agg
------------------------------------------------------------
update p set b = b + 1 where a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
delete from p where p.a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.b and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- Updates with motion:
-- No motion, colocated distribution key
------------------------------------------------------------
delete from p where a in (select a from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.a and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- No motion of s
------------------------------------------------------------
@@ -596,24 +596,24 @@ insert into p select generate_series(1,10000), generate_series(1,10000) * 3, gen
-- Motion on p, append node, hash agg
------------------------------------------------------------
update p set b = b + 1 where a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
delete from p where p.a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.b and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- Updates with motion:
-- No motion, colocated distribution key
------------------------------------------------------------
delete from p where a in (select a from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.a and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- No motion of s
------------------------------------------------------------
@@ -661,24 +661,24 @@ insert into p select generate_series(1,10000), generate_series(1,10000) * 3, gen
-- Motion on p, append node, hash agg
------------------------------------------------------------
update p set b = b + 1 where a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
delete from p where p.a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.b and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- Updates with motion:
-- No motion, colocated distribution key
------------------------------------------------------------
delete from p where a in (select a from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.a and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- No motion of s
------------------------------------------------------------
@@ -726,24 +726,24 @@ insert into p select generate_series(1,10000), generate_series(1,10000) * 3, gen
-- Motion on p, append node, hash agg
------------------------------------------------------------
update p set b = b + 1 where a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
delete from p where p.a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.b and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- Updates with motion:
-- No motion, colocated distribution key
------------------------------------------------------------
delete from p where a in (select a from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.a and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- No motion of s
------------------------------------------------------------
@@ -791,24 +791,24 @@ insert into p select generate_series(1,10000), generate_series(1,10000) * 3, gen
-- Motion on p, append node, hash agg
------------------------------------------------------------
update p set b = b + 1 where a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
delete from p where p.a in (select b from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.b and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- Updates with motion:
-- No motion, colocated distribution key
------------------------------------------------------------
delete from p where a in (select a from r where a = p.c);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
delete from p using r where p.a = r.a and r.a = p.c;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
------------------------------------------------------------
-- No motion of s
------------------------------------------------------------
@@ -1202,8 +1202,8 @@ select r.* from r,s,sales where s.a = sales.day and sales.month = r.b-1;
delete from r;
delete from s;
delete from sales_par;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
insert into r select generate_series(1, 10000), generate_series(1, 10000) * 3;
insert into s select generate_series(1, 100), generate_series(1, 100) * 3;
SELECT InsertManyIntoSales(20,'sales_par');
@@ -1223,8 +1223,8 @@ select sales_par.* from sales_par where id in (select s.b from s, r where s.a =
(2 rows)
update sales_par set region = 'new_region' where id in (select s.b from s, r where s.a = r.b) and day in (select a from r);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select sales_par.* from sales_par where id in (select s.b from s, r where s.a = r.b) and day in (select a from r);
id | year | month | day | region
----+------+-------+-----+------------
@@ -1243,8 +1243,8 @@ select sales_par.* from sales_par,s,r where sales_par.id = s.b and sales_par.mon
(5 rows)
update sales_par set month = month+1 from r,s where sales_par.id = s.b and sales_par.month = r.b+1;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select sales_par.* from sales_par,s,r where sales_par.id = s.b and sales_par.month = r.b+2;
id | year | month | day | region
----+------+-------+-----+------------
@@ -1263,8 +1263,8 @@ select sales_par.* from sales_par where id in (select s.b-1 from s,r where s.a =
(2 rows)
delete from sales_par where id in (select s.b-1 from s,r where s.a = r.b);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
select sales_par.* from sales_par where id in (select s.b-1 from s,r where s.a = r.b);
id | year | month | day | region
----+------+-------+-----+--------
@@ -1483,8 +1483,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
delete from s;
delete from m;
delete from sales_par;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
insert into s select generate_series(1, 100), generate_series(1, 100) * 3;
insert into s select generate_series(1, 10), generate_series(1, 10) * 4;
insert into m select generate_series(1, 1000), generate_series(1, 1000) * 4;
@@ -1542,8 +1542,8 @@ select distinct sales_par.* from sales_par,s where sales_par.id in (s.b, s.b+1)
(4 rows)
update sales_par set month = month+1 from s where sales_par.id in (s.b, s.b+1) and region = 'europe';
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select distinct sales_par.* from sales_par,s where sales_par.id in (s.b, s.b+1) and region='europe';
id | year | month | day | region
----+------+-------+-----+--------
@@ -1561,8 +1561,8 @@ select * from sales_par where region='asia' and id in (select b from s where a =
(1 row)
delete from sales_par where region='asia' and id in (select b from s where a = 1);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
select * from sales_par where region='asia' and id in (select b from s where a = 1);
id | year | month | day | region
----+------+-------+-----+--------
@@ -1575,8 +1575,8 @@ select * from sales_par where region='asia' and id in (select b from m where a =
(1 row)
delete from sales_par where region='asia' and id in (select b from m where a = 2);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
select * from sales_par where region='asia' and id in (select b from m where a = 2);
id | year | month | day | region
----+------+-------+-----+--------
@@ -1589,8 +1589,8 @@ select * from sales_par where region='asia' and id in (select b from m where a =
delete from s;
delete from m;
delete from sales_par;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
insert into s select generate_series(1, 100), generate_series(1, 100) * 3;
insert into s select generate_series(1, 10), generate_series(1, 10) * 4;
insert into m select generate_series(1, 1000), generate_series(1, 1000) * 4;
@@ -1651,8 +1651,8 @@ select distinct sales_par.* from sales_par,s where sales_par.id in (s.b, s.b+1)
PREPARE plan3 AS update sales_par set month = month+1 from s where sales_par.id in (s.b, s.b+1) and region = 'europe';
EXECUTE plan3;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select distinct sales_par.* from sales_par,s where sales_par.id in (s.b, s.b+1) and region='europe';
id | year | month | day | region
----+------+-------+-----+--------
@@ -1671,8 +1671,8 @@ select * from sales_par where region='asia' and id in (select b from s where a =
PREPARE plan4 AS delete from sales_par where region='asia' and id in (select b from s where a = 1);
EXECUTE plan4;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
select * from sales_par where region='asia' and id in (select b from s where a = 1);
id | year | month | day | region
----+------+-------+-----+--------
@@ -1686,8 +1686,8 @@ select * from sales_par where region='asia' and id in (select b from m where a =
PREPARE plan5 AS delete from sales_par where region='asia' and id in (select b from m where a = 2);
EXECUTE plan5;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
select * from sales_par where region='asia' and id in (select b from m where a = 2);
id | year | month | day | region
----+------+-------+-----+--------
@@ -1755,16 +1755,16 @@ analyze tab3;
set allow_system_table_mods=true;
update pg_class set relpages = 10000 where oid='tab2'::regclass;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
update pg_class set reltuples = 100000000 where oid='tab2'::regclass;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
update pg_class set relpages = 100000000 where oid='tab3'::regclass;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
update pg_class set reltuples = 100000 where oid='tab3'::regclass;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
-- Planner: there is redistribute motion above tab1, however, we can also
-- remove the explicit redistribute motion here because the final join
-- co-locate with the result relation tab1.
@@ -1821,147 +1821,147 @@ insert into part_neq_dis_2 select generate_series(1,40), generate_series(1,40);
-- T1 - distribution partitioned column, T2 - distributed partitioned column
-- a) non-default partition
delete from part_eq_dis_1 where a = (select c from part_eq_dis_2 where c=1);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_eq_dis_1 where a = (select c from part_eq_dis_2 where c=21);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - distribution partitioned column, T2 - non-distributed non-partitioned column
-- a) non-default partition
delete from part_eq_dis_1 where a = (select d from part_eq_dis_2 where c=2);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_eq_dis_1 where a = (select d from part_eq_dis_2 where c=22);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - distribution partitioned column, T2 - distributed non-partitioned column
-- a) non-default partition
delete from part_eq_dis_1 where a = (select c from part_neq_dis_2 where c=3);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_eq_dis_1 where a = (select c from part_neq_dis_2 where c=23);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - distribution partitioned column, T2 - non-distributed partitioned column
-- a) non-default partition
delete from part_eq_dis_1 where a = (select d from part_neq_dis_2 where c=4);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_eq_dis_1 where a = (select d from part_neq_dis_2 where c=24);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - non-distribution non-partitioned column, T2 - distributed partitioned column
-- a) non-default partition
delete from part_eq_dis_1 where b = (select c from part_eq_dis_2 where c=5);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_eq_dis_1 where b = (select c from part_eq_dis_2 where c=25);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - non-distribution non-partitioned column, T2 - non-distributed non-partitioned column
-- a) non-default partition
delete from part_eq_dis_1 where b = (select d from part_eq_dis_2 where c=6);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_eq_dis_1 where b = (select d from part_eq_dis_2 where c=26);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - non-distribution non-partitioned column, T2 - distributed non-partitioned column
-- a) non-default partition
delete from part_eq_dis_1 where b = (select c from part_neq_dis_2 where c=7);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_eq_dis_1 where b = (select c from part_neq_dis_2 where c=27);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - non-distribution non-partitioned column, T2 - non-distributed partitioned column
-- a) non-default partition
delete from part_eq_dis_1 where b = (select d from part_neq_dis_2 where c=8);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_eq_dis_1 where b = (select d from part_neq_dis_2 where c=28);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - distribution non-partitioned column, T2 - distributed partitioned column
-- a) non-default partition
delete from part_neq_dis_1 where a = (select c from part_eq_dis_2 where c=9);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_neq_dis_1 where a = (select c from part_eq_dis_2 where c=29);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - distribution non-partitioned column, T2 - non-distributed non-partitioned column
-- a) non-default partition
delete from part_neq_dis_1 where a = (select d from part_eq_dis_2 where c=10);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_neq_dis_1 where a = (select d from part_eq_dis_2 where c=30);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - distribution non-partitioned column, T2 - non-distributed partitioned column
-- a) non-default partition
delete from part_neq_dis_1 where a = (select d from part_neq_dis_2 where c=11);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_neq_dis_1 where a = (select d from part_neq_dis_2 where c=31);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - distribution non-partitioned column, T2 - distributed non-partitioned column
-- a) non-default partition
delete from part_neq_dis_1 where a = (select c from part_neq_dis_2 where c=12);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_neq_dis_1 where a = (select c from part_neq_dis_2 where c=32);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - non-distribution partitioned column, T2 - distributed partitioned column
-- a) non-default partition
delete from part_neq_dis_1 where b = (select c from part_eq_dis_2 where c=13);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_neq_dis_1 where b = (select c from part_eq_dis_2 where c=33);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - non-distribution partitioned column, T2 - non-distributed non-partitioned column
-- a) non-default partition
delete from part_neq_dis_1 where b = (select d from part_eq_dis_2 where c=14);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_neq_dis_1 where b = (select d from part_eq_dis_2 where c=34);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - non-distribution partitioned column, T2 - distributed non-partitioned column
-- a) non-default partition
delete from part_neq_dis_1 where b = (select d from part_neq_dis_2 where c=15);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_neq_dis_1 where b = (select d from part_neq_dis_2 where c=35);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- T1 - non-distribution partitioned column, T2 - non-distributed partitioned column
-- a) non-default partition
delete from part_neq_dis_1 where b = (select c from part_neq_dis_2 where c=16);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
-- b) default partition
delete from part_neq_dis_1 where b = (select c from part_neq_dis_2 where c=36);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
select * from part_eq_dis_1;
a | b
----+----
diff --git a/src/test/regress/expected/aggregates_optimizer.out b/src/test/regress/expected/aggregates_optimizer.out
index d539908f4b..abcd14d468 100644
--- a/src/test/regress/expected/aggregates_optimizer.out
+++ b/src/test/regress/expected/aggregates_optimizer.out
@@ -2709,32 +2709,32 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
(1 row)
select cleast_agg(q1,q2) from int8_tbl;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: GPDB Expression type: Query Parameter not supported in DXL
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
cleast_agg
-------------------
-4567890123456789
(1 row)
select cleast_agg(4.5,f1) from int4_tbl;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: GPDB Expression type: Query Parameter not supported in DXL
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
cleast_agg
-------------
-2147483647
(1 row)
select cleast_agg(variadic array[4.5,f1]) from int4_tbl;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: GPDB Expression type: Query Parameter not supported in DXL
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
cleast_agg
-------------
-2147483647
(1 row)
select pg_typeof(cleast_agg(variadic array[4.5,f1])) from int4_tbl;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: GPDB Expression type: Query Parameter not supported in DXL
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
pg_typeof
-----------
numeric
@@ -2809,6 +2809,7 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
+NOTICE: avg_transfn called with 1
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
@@ -2816,6 +2817,7 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
+NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -2837,6 +2839,7 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
+NOTICE: avg_transfn called with 1
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
@@ -2844,6 +2847,7 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
+NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -2876,6 +2880,8 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
+NOTICE: avg_transfn called with 1
+NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -2938,13 +2944,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
NOTICE: avg_transfn called with 3
+NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -2963,22 +2969,22 @@ discard plans;
select my_avg(one),my_sum(two) from (values(1,2),(3,4)) t(one,two);
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-NOTICE: avg_transfn called with 2
+NOTICE: avg_transfn called with 1
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-NOTICE: avg_transfn called with 1
-NOTICE: avg_transfn called with 4
+NOTICE: avg_transfn called with 2
+NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-NOTICE: avg_transfn called with 3
+NOTICE: avg_transfn called with 4
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -3058,6 +3064,8 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
+NOTICE: avg_transfn called with 1
+NOTICE: avg_transfn called with 3
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
@@ -3074,28 +3082,10 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
-- Varying INITCONDs should cause the states not to be shared.
select my_sum_init(one),my_avg_init2(one) from (values(1),(3)) t(one);
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
NOTICE: avg_transfn called with 1
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
NOTICE: avg_transfn called with 1
NOTICE: avg_transfn called with 3
NOTICE: avg_transfn called with 3
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
my_sum_init | my_avg_init2
-------------+--------------
14 | 4
@@ -3157,13 +3147,17 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
+NOTICE: sum_transfn called with 1
NOTICE: sum_transfn called with 2
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
+NOTICE: sum_transfn called with 2
+NOTICE: sum_transfn called with 3
NOTICE: sum_transfn called with 3
NOTICE: sum_transfn called with 4
+NOTICE: sum_transfn called with 4
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -3614,7 +3608,7 @@ drop table agg_hash_4;
-- numsegments of the general locus should be -1 on create_minmaxagg_path
explain analyze select count(*) from pg_class, (select count(*) > 0 from (select count(*) from pg_class where relnatts > 8) x) y;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------
Aggregate (cost=10000000017.74..10000000017.75 rows=1 width=8) (actual time=0.142..0.142 rows=1 loops=1)
diff --git a/src/test/regress/expected/autostats.out b/src/test/regress/expected/autostats.out
index 58ed6242a2..b1a29aeb91 100644
--- a/src/test/regress/expected/autostats.out
+++ b/src/test/regress/expected/autostats.out
@@ -6,13 +6,15 @@
-- end_matchsubs
-- start_matchignore
-- m/^LOG: .*Feature not supported: Queries on master-only tables./
--- m/^LOG: .*Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables./
+-- m/^LOG: .*Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables./
-- m/^LOG:.*ERROR,"PG exception raised"/
-- end_matchignore
set gp_autostats_mode=on_change;
set gp_autostats_on_change_threshold=9;
set log_autostats=on;
set client_min_messages=log;
+reset optimizer_trace_fallback;
+LOG: statement: reset optimizer_trace_fallback;
drop table if exists autostats_test;
LOG: statement: drop table if exists autostats_test;
NOTICE: table "autostats_test" does not exist, skipping
diff --git a/src/test/regress/expected/bfv_aggregate_optimizer.out b/src/test/regress/expected/bfv_aggregate_optimizer.out
index a29dad9372..03679e76b1 100644
--- a/src/test/regress/expected/bfv_aggregate_optimizer.out
+++ b/src/test/regress/expected/bfv_aggregate_optimizer.out
@@ -1828,33 +1828,21 @@ HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sur
insert into tx values('hello');
EXPLAIN (COSTS OFF, VERBOSE ON)
SELECT MIN(tx.c1) FROM tx GROUP BY (tx.c1)::VARCHAR;
- QUERY PLAN
-------------------------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
Output: (min(c1))
- -> Finalize GroupAggregate
+ -> HashAggregate
Output: min(c1)
Group Key: ((tx.c1)::character varying)
- -> Sort
- Output: ((c1)::character varying), (PARTIAL min(c1))
- Sort Key: ((tx.c1)::character varying)
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Output: ((c1)::character varying), (PARTIAL min(c1))
- Hash Key: ((c1)::character varying)
- -> Partial GroupAggregate
- Output: ((c1)::character varying), PARTIAL min(c1)
- Group Key: ((tx.c1)::character varying)
- -> Sort
- Output: ((c1)::character varying), c1
- Sort Key: ((tx.c1)::character varying)
- -> Result
- Output: c1, c1
- -> Redistribute Motion 3:3 (slice3; segments: 3)
- Output: c1
- -> Seq Scan on bfv_aggregate.tx
- Output: c1
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Output: c1, ((c1)::character varying)
+ Hash Key: ((c1)::character varying)
+ -> Seq Scan on bfv_aggregate.tx
+ Output: c1, c1
+ Settings: enable_parallel = 'off', optimizer = 'on'
Optimizer: Pivotal Optimizer (GPORCA)
-(24 rows)
+(12 rows)
SELECT MIN(tx.c1) FROM tx GROUP BY (tx.c1)::VARCHAR;
min
@@ -2082,18 +2070,22 @@ select count(distinct(b)), gp_segment_id from t group by gp_segment_id;
-- The cost of multistage agg is higher than hash agg
set optimizer_force_multistage_agg to on;
explain (costs off) select count(distinct(b)), gp_segment_id from t group by gp_segment_id;
- QUERY PLAN
-------------------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- -> GroupAggregate
+ -> HashAggregate
Group Key: gp_segment_id
- -> Sort
- Sort Key: gp_segment_id
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: gp_segment_id
- -> Seq Scan on t
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: gp_segment_id
+ -> GroupAggregate
+ Group Key: gp_segment_id, b
+ -> Sort
+ Sort Key: gp_segment_id, b
+ -> Redistribute Motion 3:3 (slice3; segments: 3)
+ Hash Key: gp_segment_id, b, b
+ -> Seq Scan on t
Optimizer: Pivotal Optimizer (GPORCA)
-(9 rows)
+(13 rows)
select count(distinct(b)), gp_segment_id from t group by gp_segment_id;
count | gp_segment_id
diff --git a/src/test/regress/expected/bfv_index.out b/src/test/regress/expected/bfv_index.out
index 805b623c04..ecb58a7abd 100644
--- a/src/test/regress/expected/bfv_index.out
+++ b/src/test/regress/expected/bfv_index.out
@@ -1176,17 +1176,17 @@ explain (costs off)
SELECT key1 FROM pt_with_multikey_index
WHERE key1 IN ('KEY55', 'KEY65', 'KEY5')
ORDER BY key1;
- QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: pt_with_multikey_index_1_prt_p2.key1
+ Merge Key: pt_with_multikey_index.key1
-> Merge Append
- Sort Key: pt_with_multikey_index_1_prt_p2.key1
- -> Index Only Scan using pt_with_multikey_index_1_prt_p2_key1_key2_idx on pt_with_multikey_index_1_prt_p2
+ Sort Key: pt_with_multikey_index.key1
+ -> Index Only Scan using pt_with_multikey_index_1_prt_p2_key1_key2_idx on pt_with_multikey_index_1_prt_p2 pt_with_multikey_index_1
Index Cond: (key1 = ANY ('{KEY55,KEY65,KEY5}'::bpchar[]))
- -> Index Only Scan using pt_with_multikey_index_1_prt_p1_key1_key2_idx on pt_with_multikey_index_1_prt_p1
+ -> Index Only Scan using pt_with_multikey_index_1_prt_p1_key1_key2_idx on pt_with_multikey_index_1_prt_p1 pt_with_multikey_index_2
Index Cond: (key1 = ANY ('{KEY55,KEY65,KEY5}'::bpchar[]))
- -> Index Only Scan using pt_with_multikey_index_1_prt_other_key1_key2_idx on pt_with_multikey_index_1_prt_other
+ -> Index Only Scan using pt_with_multikey_index_1_prt_other_key1_key2_idx on pt_with_multikey_index_1_prt_other pt_with_multikey_index_3
Index Cond: (key1 = ANY ('{KEY55,KEY65,KEY5}'::bpchar[]))
Optimizer: Postgres query optimizer
(11 rows)
@@ -1211,16 +1211,16 @@ EXPLAIN (costs off)
SELECT * FROM pt_with_multikey_index
WHERE key1 = 'KEY55' AND key2 IN ('R', 'G')
ORDER BY key2;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: pt_with_multikey_index_1_prt_p2.key2
+ Merge Key: pt_with_multikey_index.key2
-> Sort
- Sort Key: pt_with_multikey_index_1_prt_p2.key2
+ Sort Key: pt_with_multikey_index.key2
-> Append
- -> Index Scan using pt_with_multikey_index_1_prt_p2_key1_key2_idx on pt_with_multikey_index_1_prt_p2
+ -> Index Scan using pt_with_multikey_index_1_prt_p2_key1_key2_idx on pt_with_multikey_index_1_prt_p2 pt_with_multikey_index_1
Index Cond: ((key1 = 'KEY55'::bpchar) AND (key2 = ANY ('{R,G}'::bpchar[])))
- -> Index Scan using pt_with_multikey_index_1_prt_p1_key1_key2_idx on pt_with_multikey_index_1_prt_p1
+ -> Index Scan using pt_with_multikey_index_1_prt_p1_key1_key2_idx on pt_with_multikey_index_1_prt_p1 pt_with_multikey_index_2
Index Cond: ((key1 = 'KEY55'::bpchar) AND (key2 = ANY ('{R,G}'::bpchar[])))
Optimizer: Postgres query optimizer
(10 rows)
@@ -1238,11 +1238,11 @@ EXPLAIN (costs off)
SELECT * FROM pt_with_multikey_index
WHERE key1 IN ('KEY55', 'KEY65') AND key2 = 'R'
ORDER BY key1;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: pt_with_multikey_index_1_prt_p1.key1
- -> Index Scan using pt_with_multikey_index_1_prt_p1_key1_key2_idx on pt_with_multikey_index_1_prt_p1
+ Merge Key: pt_with_multikey_index.key1
+ -> Index Scan using pt_with_multikey_index_1_prt_p1_key1_key2_idx on pt_with_multikey_index_1_prt_p1 pt_with_multikey_index
Index Cond: ((key1 = ANY ('{KEY55,KEY65}'::bpchar[])) AND (key2 = 'R'::bpchar))
Optimizer: Postgres query optimizer
(5 rows)
@@ -1265,13 +1265,13 @@ CREATE TABLE bfv_index_only_ao(a int, b int) WITH (appendonly =true);
CREATE INDEX bfv_index_only_ao_a_b on bfv_index_only_ao(a) include (b);
insert into bfv_index_only_ao select i,i from generate_series(1, 10000) i;
explain select count(*) from bfv_index_only_ao where a < 100;
- QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
- Finalize Aggregate (cost=5.37..5.38 rows=1 width=8)
- -> Gather Motion 3:1 (slice1; segments: 3) (cost=5.31..5.36 rows=3 width=8)
- -> Partial Aggregate (cost=5.31..5.32 rows=1 width=8)
- -> Index Only Scan using bfv_index_only_ao_a_b on bfv_index_only_ao (cost=0.16..5.23 rows=33 width=0)
- Index Cond: (a < 100)
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------
+ Finalize Aggregate (cost=340000382.72..340000382.73 rows=1 width=8)
+ -> Gather Motion 3:1 (slice1; segments: 3) (cost=340000382.67..340000382.72 rows=3 width=8)
+ -> Partial Aggregate (cost=340000382.67..340000382.68 rows=1 width=8)
+ -> Seq Scan on bfv_index_only_ao (cost=0.00..340000358.75 rows=9567 width=0)
+ Filter: (a < 100)
Optimizer: Postgres query optimizer
(6 rows)
@@ -1282,13 +1282,13 @@ select count(*) from bfv_index_only_ao where a < 100;
(1 row)
explain select count(*) from bfv_index_only_ao where a < 1000;
- QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------
- Finalize Aggregate (cost=19.87..19.88 rows=1 width=8)
- -> Gather Motion 3:1 (slice1; segments: 3) (cost=19.81..19.86 rows=3 width=8)
- -> Partial Aggregate (cost=19.81..19.82 rows=1 width=8)
- -> Index Only Scan using bfv_index_only_ao_a_b on bfv_index_only_ao (cost=0.16..18.98 rows=333 width=0)
- Index Cond: (a < 1000)
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------
+ Finalize Aggregate (cost=340000382.72..340000382.73 rows=1 width=8)
+ -> Gather Motion 3:1 (slice1; segments: 3) (cost=340000382.67..340000382.72 rows=3 width=8)
+ -> Partial Aggregate (cost=340000382.67..340000382.68 rows=1 width=8)
+ -> Seq Scan on bfv_index_only_ao (cost=0.00..340000358.75 rows=9567 width=0)
+ Filter: (a < 1000)
Optimizer: Postgres query optimizer
(6 rows)
@@ -1302,13 +1302,13 @@ CREATE TABLE bfv_index_only_aocs(a int, b int) WITH (appendonly =true, orientati
CREATE INDEX bfv_index_only_aocs_a_b on bfv_index_only_aocs(a) include (b);
insert into bfv_index_only_aocs select i,i from generate_series(1, 10000) i;
explain select count(*) from bfv_index_only_aocs where a < 100;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
- Finalize Aggregate (cost=5.37..5.38 rows=1 width=8)
- -> Gather Motion 3:1 (slice1; segments: 3) (cost=5.31..5.36 rows=3 width=8)
- -> Partial Aggregate (cost=5.31..5.32 rows=1 width=8)
- -> Index Only Scan using bfv_index_only_aocs_a_b on bfv_index_only_aocs (cost=0.16..5.23 rows=33 width=0)
- Index Cond: (a < 100)
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------
+ Finalize Aggregate (cost=340000382.72..340000382.73 rows=1 width=8)
+ -> Gather Motion 3:1 (slice1; segments: 3) (cost=340000382.67..340000382.72 rows=3 width=8)
+ -> Partial Aggregate (cost=340000382.67..340000382.68 rows=1 width=8)
+ -> Seq Scan on bfv_index_only_aocs (cost=0.00..340000358.75 rows=9567 width=0)
+ Filter: (a < 100)
Optimizer: Postgres query optimizer
(6 rows)
@@ -1319,13 +1319,13 @@ select count(*) from bfv_index_only_aocs where a < 100;
(1 row)
explain select count(*) from bfv_index_only_aocs where a < 1000;
- QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
- Finalize Aggregate (cost=19.87..19.88 rows=1 width=8)
- -> Gather Motion 3:1 (slice1; segments: 3) (cost=19.81..19.86 rows=3 width=8)
- -> Partial Aggregate (cost=19.81..19.82 rows=1 width=8)
- -> Index Only Scan using bfv_index_only_aocs_a_b on bfv_index_only_aocs (cost=0.16..18.98 rows=333 width=0)
- Index Cond: (a < 1000)
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------
+ Finalize Aggregate (cost=340000382.72..340000382.73 rows=1 width=8)
+ -> Gather Motion 3:1 (slice1; segments: 3) (cost=340000382.67..340000382.72 rows=3 width=8)
+ -> Partial Aggregate (cost=340000382.67..340000382.68 rows=1 width=8)
+ -> Seq Scan on bfv_index_only_aocs (cost=0.00..340000358.75 rows=9567 width=0)
+ Filter: (a < 1000)
Optimizer: Postgres query optimizer
(6 rows)
diff --git a/src/test/regress/expected/bfv_joins_optimizer.out b/src/test/regress/expected/bfv_joins_optimizer.out
index 3d97fbf89e..cc6f1632cd 100644
--- a/src/test/regress/expected/bfv_joins_optimizer.out
+++ b/src/test/regress/expected/bfv_joins_optimizer.out
@@ -950,15 +950,15 @@ SELECT t1.c FROM t1 LEFT OUTER JOIN (select t3.*, t3.a+t3.b as cc from t3)t ON t
-- Test for eliminating self check condition in subquery
explain SELECT * FROM t1 LEFT JOIN (select t3.b from t3 where t3.a
< t3.a) AS t ON t1.a = t.b;
- QUERY PLAN
--------------------------------------------------------------------------------------
- Hash Left Join (cost=0.00..431.00 rows=2 width=16)
- Hash Cond: (a = (NULL::integer))
- -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=12)
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=2 width=16)
+ -> Hash Left Join (cost=0.00..431.00 rows=1 width=16)
+ Hash Cond: (a = (NULL::integer))
-> Seq Scan on t1 (cost=0.00..431.00 rows=1 width=12)
- -> Hash (cost=0.00..0.00 rows=0 width=4)
- -> Result (cost=0.00..0.00 rows=0 width=4)
- One-Time Filter: false
+ -> Hash (cost=0.00..0.00 rows=0 width=4)
+ -> Result (cost=0.00..0.00 rows=0 width=4)
+ One-Time Filter: false
Optimizer: Pivotal Optimizer (GPORCA)
(8 rows)
diff --git a/src/test/regress/expected/bfv_olap_optimizer.out b/src/test/regress/expected/bfv_olap_optimizer.out
index 9563b21dc5..16de252c48 100644
--- a/src/test/regress/expected/bfv_olap_optimizer.out
+++ b/src/test/regress/expected/bfv_olap_optimizer.out
@@ -790,7 +790,7 @@ group by a.code;
------------------------------------------------------------------------------------------------------------------------
WindowAgg (cost=0.00..1324055.31 rows=1 width=16)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1324055.31 rows=1 width=16)
- -> GroupAggregate (cost=0.00..431.00 rows=1 width=14)
+ -> HashAggregate (cost=0.00..431.00 rows=1 width=14)
Group Key: t2_github_issue_10143.code
-> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=11)
Hash Key: t2_github_issue_10143.code
diff --git a/src/test/regress/expected/bfv_partition_plans_optimizer.out b/src/test/regress/expected/bfv_partition_plans_optimizer.out
index e2c20ef1a6..94d2802d61 100644
--- a/src/test/regress/expected/bfv_partition_plans_optimizer.out
+++ b/src/test/regress/expected/bfv_partition_plans_optimizer.out
@@ -58,8 +58,8 @@ NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into mpp3061 values(1);
update mpp3061 set i = 2 where i = 1;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(update) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
select tableoid::regclass, * from mpp3061 where i = 2;
tableoid | i
-----------------+---
@@ -1247,6 +1247,8 @@ NOTICE: table doesn't have 'DISTRIBUTED BY' clause, defaulting to distribution
select count_operator('delete from mpp6247_foo using mpp6247_bar where mpp6247_foo.c1 = mpp6247_bar.c1 and mpp6247_foo.dt = ''2009-05-03''', 'Hash Join');
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: SIRV functions
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
count_operator
----------------
1
@@ -1261,8 +1263,8 @@ HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sur
CREATE INDEX index_delete_from_indexed_pt ON delete_from_indexed_pt USING bitmap(b);
INSERT INTO delete_from_indexed_pt SELECT i, i%6 FROM generate_series(1, 10)i;
EXPLAIN (COSTS OFF) DELETE FROM delete_from_indexed_pt WHERE b=1;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
QUERY PLAN
-----------------------------------------------------------------------------------
Delete on delete_from_indexed_pt
@@ -1275,8 +1277,8 @@ DETAIL: Feature not supported: DML(delete) on partitioned tables
(7 rows)
DELETE FROM delete_from_indexed_pt WHERE b=1;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
SELECT * FROM delete_from_indexed_pt;
a | b
----+---
@@ -1301,8 +1303,8 @@ INSERT INTO delete_from_pt SELECT i, i%6 FROM generate_series(1, 10)i;
INSERT INTO t VALUES (1);
ANALYZE delete_from_pt, t;
EXPLAIN (COSTS OFF, TIMING OFF, SUMMARY OFF, ANALYZE) DELETE FROM delete_from_pt WHERE b IN (SELECT b FROM delete_from_pt, t WHERE t.a=delete_from_pt.b);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: DML(delete) on partitioned tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------
Delete on delete_from_pt (actual rows=0 loops=1)
diff --git a/src/test/regress/expected/brin_ao_optimizer.out b/src/test/regress/expected/brin_ao_optimizer.out
index f47266c108..dbd2fc042f 100644
--- a/src/test/regress/expected/brin_ao_optimizer.out
+++ b/src/test/regress/expected/brin_ao_optimizer.out
@@ -406,24 +406,6 @@ BEGIN
END LOOP;
END;
$x$;
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<=,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>=,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<=,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>=,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<=,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>=,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<=,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>=,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (lsncol,IS,pg_lsn,,25)
-WARNING: ORCA did not produce a bitmap indexscan plan for (lsncol,"IS NOT",pg_lsn,,100)
-- Note: ORCA does not support all of the above operators:
-- - standard comparison operators on inet and cidr columns
-- because ORCA does not look at the second occurrence of a column in an index,
diff --git a/src/test/regress/expected/brin_aocs_optimizer.out b/src/test/regress/expected/brin_aocs_optimizer.out
index 13e07c7201..2011480d01 100644
--- a/src/test/regress/expected/brin_aocs_optimizer.out
+++ b/src/test/regress/expected/brin_aocs_optimizer.out
@@ -406,24 +406,6 @@ BEGIN
END LOOP;
END;
$x$;
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<=,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>=,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<=,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>=,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<=,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>=,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<=,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>=,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (lsncol,IS,pg_lsn,,25)
-WARNING: ORCA did not produce a bitmap indexscan plan for (lsncol,"IS NOT",pg_lsn,,100)
-- Note: ORCA does not support all of the above operators:
-- - standard comparison operators on inet and cidr columns
-- because ORCA does not look at the second occurrence of a column in an index,
diff --git a/src/test/regress/expected/brin_optimizer.out b/src/test/regress/expected/brin_optimizer.out
index 804c5ba9a4..14f260c672 100644
--- a/src/test/regress/expected/brin_optimizer.out
+++ b/src/test/regress/expected/brin_optimizer.out
@@ -393,24 +393,6 @@ BEGIN
END LOOP;
END;
$x$;
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<=,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>=,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,<=,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (cidrcol,>=,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<=,cidr,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>=,cidr,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,<=,inet,255.255.255.255,100)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (inetcol,>=,inet,0.0.0.0,125)
-WARNING: ORCA did not produce a bitmap indexscan plan for (lsncol,IS,pg_lsn,,25)
-WARNING: ORCA did not produce a bitmap indexscan plan for (lsncol,"IS NOT",pg_lsn,,100)
-- Note: ORCA does not support all of the above operators:
-- - standard comparison operators on inet and cidr columns
-- because ORCA does not look at the second occurrence of a column in an index,
diff --git a/src/test/regress/expected/catcache.out b/src/test/regress/expected/catcache.out
index b6bcf2ac4b..ccd8399b84 100644
--- a/src/test/regress/expected/catcache.out
+++ b/src/test/regress/expected/catcache.out
@@ -7,23 +7,17 @@ NOTICE: table has parent, setting distribution columns to match parent table
create table dml_14027_union_s_1_prt_def partition of dml_14027_union_s default;
NOTICE: table has parent, setting distribution columns to match parent table
insert into dml_14027_union_s select generate_series(1,1), generate_series(1,1);
+analyze dml_14027_union_s;
begin;
drop table dml_14027_union_s_1_prt_def;
explain select count(distinct(b)) from dml_14027_union_s;
- QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------
- Finalize Aggregate (cost=321.22..321.23 rows=1 width=8)
- -> Gather Motion 3:1 (slice1; segments: 3) (cost=321.17..321.22 rows=3 width=8)
- -> Partial Aggregate (cost=321.17..321.18 rows=1 width=8)
- -> HashAggregate (cost=317.00..320.33 rows=333 width=32)
- Group Key: dml_14027_union_s.b
- -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=282.00..312.00 rows=1000 width=32)
- Hash Key: dml_14027_union_s.b
- -> Streaming HashAggregate (cost=282.00..292.00 rows=1000 width=32)
- Group Key: dml_14027_union_s.b
- -> Seq Scan on dml_14027_union_s_1_prt_2 dml_14027_union_s (cost=0.00..199.33 rows=16533 width=32)
+ QUERY PLAN
+-------------------------------------------------------------------------------------------------------
+ Aggregate (cost=1.03..1.04 rows=1 width=8)
+ -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1.03 rows=1 width=5)
+ -> Seq Scan on dml_14027_union_s_1_prt_2 dml_14027_union_s (cost=0.00..1.01 rows=1 width=5)
Optimizer: Postgres query optimizer
-(11 rows)
+(4 rows)
select count(distinct(b)) from dml_14027_union_s;
count
diff --git a/src/test/regress/expected/catcache_optimizer.out b/src/test/regress/expected/catcache_optimizer.out
index b4e31b7188..a144ef7ea8 100644
--- a/src/test/regress/expected/catcache_optimizer.out
+++ b/src/test/regress/expected/catcache_optimizer.out
@@ -7,27 +7,26 @@ NOTICE: table has parent, setting distribution columns to match parent table
create table dml_14027_union_s_1_prt_def partition of dml_14027_union_s default;
NOTICE: table has parent, setting distribution columns to match parent table
insert into dml_14027_union_s select generate_series(1,1), generate_series(1,1);
+analyze dml_14027_union_s;
begin;
drop table dml_14027_union_s_1_prt_def;
explain select count(distinct(b)) from dml_14027_union_s;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------
Aggregate (cost=0.00..431.00 rows=1 width=8)
- -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=8)
- -> GroupAggregate (cost=0.00..431.00 rows=1 width=8)
+ -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=5)
+ -> GroupAggregate (cost=0.00..431.00 rows=1 width=5)
Group Key: b
- -> Sort (cost=0.00..431.00 rows=1 width=8)
+ -> Sort (cost=0.00..431.00 rows=1 width=5)
Sort Key: b
- -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=8)
+ -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=5)
Hash Key: b
- -> GroupAggregate (cost=0.00..431.00 rows=1 width=8)
+ -> Streaming HashAggregate (cost=0.00..431.00 rows=1 width=5)
Group Key: b
- -> Sort (cost=0.00..431.00 rows=1 width=8)
- Sort Key: b
- -> Dynamic Seq Scan on dml_14027_union_s (cost=0.00..431.00 rows=1 width=8)
- Number of partitions to scan: 1 (out of 1)
+ -> Dynamic Seq Scan on dml_14027_union_s (cost=0.00..431.00 rows=1 width=5)
+ Number of partitions to scan: 1 (out of 1)
Optimizer: Pivotal Optimizer (GPORCA)
-(15 rows)
+(13 rows)
select count(distinct(b)) from dml_14027_union_s;
count
diff --git a/src/test/regress/expected/correlated_subquery.out b/src/test/regress/expected/correlated_subquery.out
index 4ddac94019..424a87dd49 100644
--- a/src/test/regress/expected/correlated_subquery.out
+++ b/src/test/regress/expected/correlated_subquery.out
@@ -132,3 +132,4 @@ SELECT (SELECT b FROM correlated_subquery_test LIMIT 1)=ALL(SELECT a FROM correl
(1 row)
ROLLBACK;
+reset optimizer_trace_fallback;
diff --git a/src/test/regress/expected/create_index_optimizer.out b/src/test/regress/expected/create_index_optimizer.out
index 067b6f1e3f..baadcef0d6 100644
--- a/src/test/regress/expected/create_index_optimizer.out
+++ b/src/test/regress/expected/create_index_optimizer.out
@@ -652,16 +652,16 @@ SELECT * FROM point_tblv WHERE f1 IS NOT NULL ORDER BY f1 <-> '0,1';
--SELECT * FROM point_tbl WHERE f1 IS NOT NULL ORDER BY f1 <-> '0,1';
EXPLAIN (COSTS OFF)
SELECT * FROM point_tblv WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1';
- QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Result
- -> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: ((f1 <-> '(0,1)'::point))
- -> Sort
- Sort Key: ((f1 <-> '(0,1)'::point))
- -> Index Scan using gpointind on point_tbl
- Index Cond: (f1 <@ '(10,10),(-10,-10)'::box)
- Filter: ((f1 <> '(1e-300,-1e-300)'::point) AND ((f1 <-> '(0,0)'::point) <> 'Infinity'::double precision) AND (f1 <@ '(10,10),(-10,-10)'::box))
+ -> Sort
+ Sort Key: ((f1 <-> '(0,1)'::point))
+ -> Result
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Index Scan using gpointind on point_tbl
+ Index Cond: (f1 <@ '(10,10),(-10,-10)'::box)
+ Filter: ((f1 <> '(1e-300,-1e-300)'::point) AND ((f1 <-> '(0,0)'::point) <> 'Infinity'::double precision) AND (f1 <@ '(10,10),(-10,-10)'::box))
Optimizer: Pivotal Optimizer (GPORCA)
(9 rows)
@@ -767,16 +767,16 @@ SET enable_indexscan = OFF;
SET enable_bitmapscan = ON;
EXPLAIN (COSTS OFF)
SELECT * FROM point_tblv WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1';
- QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Result
- -> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: ((f1 <-> '(0,1)'::point))
- -> Sort
- Sort Key: ((f1 <-> '(0,1)'::point))
- -> Index Scan using gpointind on point_tbl
- Index Cond: (f1 <@ '(10,10),(-10,-10)'::box)
- Filter: ((f1 <> '(1e-300,-1e-300)'::point) AND ((f1 <-> '(0,0)'::point) <> 'Infinity'::double precision) AND (f1 <@ '(10,10),(-10,-10)'::box))
+ -> Sort
+ Sort Key: ((f1 <-> '(0,1)'::point))
+ -> Result
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Index Scan using gpointind on point_tbl
+ Index Cond: (f1 <@ '(10,10),(-10,-10)'::box)
+ Filter: ((f1 <> '(1e-300,-1e-300)'::point) AND ((f1 <-> '(0,0)'::point) <> 'Infinity'::double precision) AND (f1 <@ '(10,10),(-10,-10)'::box))
Optimizer: Pivotal Optimizer (GPORCA)
(9 rows)
diff --git a/src/test/regress/expected/dpe.out b/src/test/regress/expected/dpe.out
index 858aa0861f..c265dc7e47 100644
--- a/src/test/regress/expected/dpe.out
+++ b/src/test/regress/expected/dpe.out
@@ -305,22 +305,23 @@ explain (costs off, timing off, summary off, analyze) select ptid from pt where
---------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=1 loops=1)
-> Hash Semi Join (actual rows=1 loops=1)
- Hash Cond: (pt_1_prt_2.ptid = t.tid)
+ Hash Cond: (pt.ptid = t.tid)
Extra Text: (seg1) Hash chain length 1.0 avg, 1 max, using 2 of 524288 buckets.
-> Append (actual rows=1 loops=1)
Partition Selectors: $0
- -> Seq Scan on pt_1_prt_2 (actual rows=0 loops=1)
+ -> Seq Scan on pt_1_prt_2 pt_1 (actual rows=0 loops=1)
Filter: (pt1 = 'hello1'::text)
- -> Seq Scan on pt_1_prt_3 (actual rows=1 loops=1)
+ Rows Removed by Filter: 3
+ -> Seq Scan on pt_1_prt_3 pt_2 (actual rows=1 loops=1)
Filter: (pt1 = 'hello1'::text)
Rows Removed by Filter: 2
- -> Seq Scan on pt_1_prt_4 (never executed)
+ -> Seq Scan on pt_1_prt_4 pt_3 (never executed)
Filter: (pt1 = 'hello1'::text)
- -> Seq Scan on pt_1_prt_5 (never executed)
+ -> Seq Scan on pt_1_prt_5 pt_4 (never executed)
Filter: (pt1 = 'hello1'::text)
- -> Seq Scan on pt_1_prt_6 (never executed)
+ -> Seq Scan on pt_1_prt_6 pt_5 (never executed)
Filter: (pt1 = 'hello1'::text)
- -> Seq Scan on pt_1_prt_junk_data (never executed)
+ -> Seq Scan on pt_1_prt_junk_data pt_6 (never executed)
Filter: (pt1 = 'hello1'::text)
-> Hash (actual rows=2 loops=1)
Buckets: 524288 Batches: 1 Memory Usage: 4097kB
@@ -329,7 +330,7 @@ explain (costs off, timing off, summary off, analyze) select ptid from pt where
-> Seq Scan on t (actual rows=2 loops=1)
Filter: (t1 = ('hello'::text || (tid)::text))
Optimizer: Postgres query optimizer
-(26 rows)
+(27 rows)
select ptid from pt where ptid in (select tid from t where t1 = 'hello' || tid) and pt1 = 'hello1';
ptid
@@ -725,8 +726,8 @@ set enable_indexscan=on;
set enable_seqscan=off;
set enable_hashjoin=off;
explain (costs off, timing off, summary off, analyze) select * from t, pt where tid = ptid;
- QUERY PLAN
---------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=18 loops=1)
-> Nested Loop (actual rows=8 loops=1)
Join Filter: (t.tid = pt.ptid)
@@ -735,12 +736,12 @@ explain (costs off, timing off, summary off, analyze) select * from t, pt where
-> Seq Scan on t (actual rows=2 loops=1)
-> Materialize (actual rows=20 loops=2)
-> Append (actual rows=20 loops=1)
- -> Index Scan using pt_1_prt_2_ptid_idx on pt_1_prt_2 pt_1 (actual rows=5 loops=1)
- -> Index Scan using pt_1_prt_3_ptid_idx on pt_1_prt_3 pt_2 (actual rows=3 loops=1)
- -> Index Scan using pt_1_prt_4_ptid_idx on pt_1_prt_4 pt_3 (actual rows=5 loops=1)
- -> Index Scan using pt_1_prt_5_ptid_idx on pt_1_prt_5 pt_4 (actual rows=5 loops=1)
- -> Index Scan using pt_1_prt_6_ptid_idx on pt_1_prt_6 pt_5 (actual rows=4 loops=1)
- -> Index Scan using pt_1_prt_junk_data_ptid_idx on pt_1_prt_junk_data pt_6 (actual rows=3 loops=1)
+ -> Index Scan using pt_1_prt_2_ptid_pt1_idx on pt_1_prt_2 pt_1 (actual rows=5 loops=1)
+ -> Index Scan using pt_1_prt_3_ptid_pt1_idx on pt_1_prt_3 pt_2 (actual rows=3 loops=1)
+ -> Index Scan using pt_1_prt_4_ptid_pt1_idx on pt_1_prt_4 pt_3 (actual rows=5 loops=1)
+ -> Index Scan using pt_1_prt_5_ptid_pt1_idx on pt_1_prt_5 pt_4 (actual rows=5 loops=1)
+ -> Index Scan using pt_1_prt_6_ptid_pt1_idx on pt_1_prt_6 pt_5 (actual rows=4 loops=1)
+ -> Index Scan using pt_1_prt_junk_data_ptid_pt1_idx on pt_1_prt_junk_data pt_6 (actual rows=3 loops=1)
Optimizer: Postgres query optimizer
(15 rows)
diff --git a/src/test/regress/expected/dpe_optimizer.out b/src/test/regress/expected/dpe_optimizer.out
index 77907790bd..b9a510125a 100644
--- a/src/test/regress/expected/dpe_optimizer.out
+++ b/src/test/regress/expected/dpe_optimizer.out
@@ -265,25 +265,31 @@ select * from pt where ptid in (select tid from t where t1 = 'hello' || tid);
(18 rows)
explain (costs off, timing off, summary off, analyze) select ptid from pt where ptid in (select tid from t where t1 = 'hello' || tid) and pt1 = 'hello1';
- QUERY PLAN
----------------------------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=1 loops=1)
- -> Hash Semi Join (actual rows=1 loops=1)
- Hash Cond: (pt.ptid = t.tid)
- Extra Text: (seg1) Hash chain length 1.0 avg, 1 max, using 2 of 524288 buckets.
- -> Dynamic Index Only Scan on ptid_pt1_idx on pt (actual rows=1 loops=1)
- Index Cond: (pt1 = 'hello1'::text)
- Heap Fetches: 0
- Number of partitions to scan: 6 (out of 6)
- Partitions scanned: Avg 2.0 x 3 workers. Max 2 parts (seg0).
- -> Hash (actual rows=2 loops=1)
- Buckets: 524288 Batches: 1 Memory Usage: 4097kB
- -> Partition Selector (selector id: $0) (actual rows=2 loops=1)
- -> Broadcast Motion 3:3 (slice2; segments: 3) (actual rows=2 loops=1)
+ -> Hash Join (actual rows=1 loops=1)
+ Hash Cond: (t.tid = pt.ptid)
+ Extra Text: (seg1) Hash chain length 1.0 avg, 1 max, using 1 of 262144 buckets.
+ -> GroupAggregate (actual rows=2 loops=1)
+ Group Key: t.tid
+ -> Sort (actual rows=2 loops=1)
+ Sort Key: t.tid
+ Sort Method: quicksort Memory: 25kB
+ -> Redistribute Motion 3:3 (slice2; segments: 3) (actual rows=2 loops=1)
+ Hash Key: t.tid
-> Seq Scan on t (actual rows=2 loops=1)
Filter: (t1 = ('hello'::text || (tid)::text))
+ -> Hash (actual rows=1 loops=1)
+ Buckets: 262144 Batches: 1 Memory Usage: 2049kB
+ -> Redistribute Motion 3:3 (slice3; segments: 3) (actual rows=1 loops=1)
+ Hash Key: pt.ptid
+ -> Dynamic Index Scan on pt1_idx on pt (actual rows=1 loops=1)
+ Index Cond: (pt1 = 'hello1'::text)
+ Number of partitions to scan: 6 (out of 6)
+ Partitions scanned: Avg 6.0 x 3 workers. Max 6 parts (seg0).
Optimizer: Pivotal Optimizer (GPORCA)
-(16 rows)
+(22 rows)
select ptid from pt where ptid in (select tid from t where t1 = 'hello' || tid) and pt1 = 'hello1';
ptid
@@ -350,13 +356,12 @@ explain (costs off, timing off, summary off, analyze) select count(*) from t, pt
Join Filter: true
-> Broadcast Motion 3:3 (slice2; segments: 3) (actual rows=2 loops=1)
-> Seq Scan on t (actual rows=2 loops=1)
- -> Dynamic Index Only Scan on ptid_idx on pt (actual rows=4 loops=2)
+ -> Dynamic Index Scan on ptid_idx on pt (actual rows=4 loops=2)
Index Cond: (ptid = t.tid)
- Heap Fetches: 0
Number of partitions to scan: 6 (out of 6)
Partitions scanned: Avg 6.0 x 3 workers of 2 scans. Max 6 parts (seg0).
Optimizer: Pivotal Optimizer (GPORCA)
-(13 rows)
+(12 rows)
select count(*) from t, pt where tid = ptid;
count
@@ -988,9 +993,8 @@ explain (costs off, timing off, summary off, analyze) select count(*) from pt, p
Buckets: 524288 Batches: 1 Memory Usage: 4097kB
-> Partition Selector (selector id: $0) (actual rows=1 loops=1)
-> Broadcast Motion 3:3 (slice2; segments: 3) (actual rows=1 loops=1)
- -> Dynamic Index Only Scan on ptid_pt1_idx on pt (actual rows=1 loops=1)
+ -> Dynamic Index Scan on pt1_idx on pt (actual rows=1 loops=1)
Index Cond: (pt1 = 'hello0'::text)
- Heap Fetches: 0
Number of partitions to scan: 6 (out of 6)
Partitions scanned: Avg 6.0 x 3 workers. Max 6 parts (seg0).
Optimizer: Pivotal Optimizer (GPORCA)
diff --git a/src/test/regress/expected/explain_format.out b/src/test/regress/expected/explain_format.out
index cafe57ae10..d61819ef21 100644
--- a/src/test/regress/expected/explain_format.out
+++ b/src/test/regress/expected/explain_format.out
@@ -266,7 +266,8 @@ QUERY PLAN
Total Cost: 596.00
Plan Rows: 49600
Plan Width: 36
- Optimizer: "Postgres-based planner"
+ Settings:
+ Optimizer: "Postgres query optimizer"
(1 row)
--- Check Explain Analyze YAML output that include the slices information
-- explain_processing_off
@@ -459,7 +460,8 @@ QUERY PLAN
Actual Total Time: 0.000
Actual Rows: 0
Actual Loops: 0
- Optimizer: "Postgres-based planner"
+ Settings:
+ Optimizer: "Postgres query optimizer"
Planning Time: 1.121
Triggers:
Slice statistics:
@@ -516,7 +518,9 @@ QUERY PLAN
"Function Name": "generate_series",
"Alias": "generate_series"
},
- "Optimizer": "Postgres-based planner"
+ "Settings": {
+ "Optimizer": "Postgres query optimizer"
+ }
}
]
(1 row)
@@ -534,7 +538,9 @@ QUERY PLAN
<Function-Name>generate_series</Function-Name>
<Alias>generate_series</Alias>
</Plan>
- <Optimizer>Postgres-based planner</Optimizer>
+ <Settings>
+ <Optimizer>Postgres query optimizer</Optimizer>
+ </Settings>
</Query>
</explain>
(1 row)
@@ -571,7 +577,9 @@ QUERY PLAN
}
]
},
- "Optimizer": "Postgres-based planner"
+ "Settings": {
+ "Optimizer": "Postgres query optimizer"
+ }
}
]
(1 row)
diff --git a/src/test/regress/expected/explain_format_optimizer.out b/src/test/regress/expected/explain_format_optimizer.out
index fa2fc54abb..2b4ed15601 100644
--- a/src/test/regress/expected/explain_format_optimizer.out
+++ b/src/test/regress/expected/explain_format_optimizer.out
@@ -247,7 +247,7 @@ QUERY PLAN
Plan Width: 12
Index Cond: "(id = boxes.apple_id)"
Settings:
- Optimizer: "Pivotal Optimizer (GPORCA)"
+ Optimizer: "GPORCA"
(1 row)
--- Check Explain Analyze YAML output that include the slices information
-- explain_processing_off
@@ -408,7 +408,8 @@ QUERY PLAN
Actual Loops: 0
Index Cond: "(id = boxes.apple_id)"
Rows Removed by Index Recheck: 0
- Optimizer: "GPORCA"
+ Settings:
+ Optimizer: "GPORCA"
Planning Time: 14.827
Triggers:
Slice statistics:
@@ -463,7 +464,9 @@ QUERY PLAN
"Function Name": "generate_series",
"Alias": "generate_series"
},
- "Optimizer": "GPORCA"
+ "Settings": {
+ "Optimizer": "GPORCA"
+ }
}
]
(1 row)
@@ -481,7 +484,9 @@ QUERY PLAN
<Function-Name>generate_series</Function-Name>
<Alias>generate_series</Alias>
</Plan>
- <Optimizer>GPORCA</Optimizer>
+ <Settings>
+ <Optimizer>GPORCA</Optimizer>
+ </Settings>
</Query>
</explain>
(1 row)
@@ -519,7 +524,9 @@ QUERY PLAN
}
]
},
- "Optimizer": "GPORCA"
+ "Settings": {
+ "Optimizer": "GPORCA"
+ }
}
]
(1 row)
diff --git a/src/test/regress/expected/explain_optimizer.out b/src/test/regress/expected/explain_optimizer.out
index 7d76e7228a..df80bf48c0 100644
--- a/src/test/regress/expected/explain_optimizer.out
+++ b/src/test/regress/expected/explain_optimizer.out
@@ -103,106 +103,107 @@ select explain_filter('explain (analyze, buffers, format text) select * from int
(8 rows)
select explain_filter('explain (analyze, buffers, format json) select * from int8_tbl i8');
- explain_filter
--------------------------------------------------
- [ +
- { +
- "Plan": { +
- "Node Type": "Gather Motion", +
- "Senders": N, +
- "Receivers": N, +
- "Slice": N, +
- "Segments": N, +
- "Gang Type": "primary reader", +
- "Parallel Aware": false, +
- "Async Capable": false, +
- "Startup Cost": N.N, +
- "Total Cost": N.N, +
- "Plan Rows": N, +
- "Plan Width": N, +
- "Actual Startup Time": N.N, +
- "Actual Total Time": N.N, +
- "Actual Rows": N, +
- "Actual Loops": N, +
- "Shared Hit Blocks": N, +
- "Shared Read Blocks": N, +
- "Shared Dirtied Blocks": N, +
- "Shared Written Blocks": N, +
- "Local Hit Blocks": N, +
- "Local Read Blocks": N, +
- "Local Dirtied Blocks": N, +
- "Local Written Blocks": N, +
- "Temp Read Blocks": N, +
- "Temp Written Blocks": N, +
- "Plans": [ +
- { +
- "Node Type": "Seq Scan", +
- "Parent Relationship": "Outer", +
- "Slice": N, +
- "Segments": N, +
- "Gang Type": "primary reader", +
- "Parallel Aware": false, +
- "Async Capable": false, +
- "Relation Name": "int8_tbl", +
- "Alias": "int8_tbl", +
- "Startup Cost": N.N, +
- "Total Cost": N.N, +
- "Plan Rows": N, +
- "Plan Width": N, +
- "Actual Startup Time": N.N, +
- "Actual Total Time": N.N, +
- "Actual Rows": N, +
- "Actual Loops": N, +
- "Shared Hit Blocks": N, +
- "Shared Read Blocks": N, +
- "Shared Dirtied Blocks": N, +
- "Shared Written Blocks": N, +
- "Local Hit Blocks": N, +
- "Local Read Blocks": N, +
- "Local Dirtied Blocks": N, +
- "Local Written Blocks": N, +
- "Temp Read Blocks": N, +
- "Temp Written Blocks": N +
- } +
- ] +
- }, +
- "Settings": { +
- "Optimizer": "Pivotal Optimizer (GPORCA)"+
- }, +
- "Planning": { +
- "Shared Hit Blocks": N, +
- "Shared Read Blocks": N, +
- "Shared Dirtied Blocks": N, +
- "Shared Written Blocks": N, +
- "Local Hit Blocks": N, +
- "Local Read Blocks": N, +
- "Local Dirtied Blocks": N, +
- "Local Written Blocks": N, +
- "Temp Read Blocks": N, +
- "Temp Written Blocks": N +
- }, +
- "Planning Time": N.N, +
- "Triggers": [ +
- ], +
- "Slice statistics": [ +
- { +
- "Slice": N, +
- "Executor Memory": N +
- }, +
- { +
- "Slice": N, +
- "Executor Memory": { +
- "Average": N, +
- "Workers": N, +
- "Maximum Memory Used": N +
- } +
- } +
- ], +
- "Statement statistics": { +
- "Memory used": N +
- }, +
- "Execution Time": N.N +
- } +
+ explain_filter
+-------------------------------------------
+ [ +
+ { +
+ "Plan": { +
+ "Node Type": "Gather Motion", +
+ "Senders": N, +
+ "Receivers": N, +
+ "Slice": N, +
+ "Segments": N, +
+ "Gang Type": "primary reader", +
+ "Parallel Aware": false, +
+ "Async Capable": false, +
+ "Startup Cost": N.N, +
+ "Total Cost": N.N, +
+ "Plan Rows": N, +
+ "Plan Width": N, +
+ "Actual Startup Time": N.N, +
+ "Actual Total Time": N.N, +
+ "Actual Rows": N, +
+ "Actual Loops": N, +
+ "Shared Hit Blocks": N, +
+ "Shared Read Blocks": N, +
+ "Shared Dirtied Blocks": N, +
+ "Shared Written Blocks": N, +
+ "Local Hit Blocks": N, +
+ "Local Read Blocks": N, +
+ "Local Dirtied Blocks": N, +
+ "Local Written Blocks": N, +
+ "Temp Read Blocks": N, +
+ "Temp Written Blocks": N, +
+ "Plans": [ +
+ { +
+ "Node Type": "Seq Scan", +
+ "Parent Relationship": "Outer",+
+ "Slice": N, +
+ "Segments": N, +
+ "Gang Type": "primary reader", +
+ "Parallel Aware": false, +
+ "Async Capable": false, +
+ "Relation Name": "int8_tbl", +
+ "Alias": "int8_tbl", +
+ "Startup Cost": N.N, +
+ "Total Cost": N.N, +
+ "Plan Rows": N, +
+ "Plan Width": N, +
+ "Actual Startup Time": N.N, +
+ "Actual Total Time": N.N, +
+ "Actual Rows": N, +
+ "Actual Loops": N, +
+ "Shared Hit Blocks": N, +
+ "Shared Read Blocks": N, +
+ "Shared Dirtied Blocks": N, +
+ "Shared Written Blocks": N, +
+ "Local Hit Blocks": N, +
+ "Local Read Blocks": N, +
+ "Local Dirtied Blocks": N, +
+ "Local Written Blocks": N, +
+ "Temp Read Blocks": N, +
+ "Temp Written Blocks": N +
+ } +
+ ] +
+ }, +
+ "Settings": { +
+ "Optimizer": "GPORCA" +
+ }, +
+ "Planning": { +
+ "Shared Hit Blocks": N, +
+ "Shared Read Blocks": N, +
+ "Shared Dirtied Blocks": N, +
+ "Shared Written Blocks": N, +
+ "Local Hit Blocks": N, +
+ "Local Read Blocks": N, +
+ "Local Dirtied Blocks": N, +
+ "Local Written Blocks": N, +
+ "Temp Read Blocks": N, +
+ "Temp Written Blocks": N +
+ }, +
+ "Planning Time": N.N, +
+ "Triggers": [ +
+ ], +
+ "Slice statistics": [ +
+ { +
+ "Slice": N, +
+ "Executor Memory": N +
+ }, +
+ { +
+ "Slice": N, +
+ "Executor Memory": { +
+ "Average": N, +
+ "Workers": N, +
+ "Subworkers": N, +
+ "Maximum Memory Used": N +
+ } +
+ } +
+ ], +
+ "Statement statistics": { +
+ "Memory used": N +
+ }, +
+ "Execution Time": N.N +
+ } +
]
(1 row)
@@ -311,88 +312,89 @@ select explain_filter('explain (analyze, buffers, format xml) select * from int8
(1 row)
select explain_filter('explain (analyze, buffers, format yaml) select * from int8_tbl i8');
- explain_filter
----------------------------------------------
- - Plan: +
- Node Type: "Gather Motion" +
- Senders: N +
- Receivers: N +
- Slice: N +
- Segments: N +
- Gang Type: "primary reader" +
- Parallel Aware: false +
- Async Capable: false +
- Startup Cost: N.N +
- Total Cost: N.N +
- Plan Rows: N +
- Plan Width: N +
- Actual Startup Time: N.N +
- Actual Total Time: N.N +
- Actual Rows: N +
- Actual Loops: N +
- Shared Hit Blocks: N +
- Shared Read Blocks: N +
- Shared Dirtied Blocks: N +
- Shared Written Blocks: N +
- Local Hit Blocks: N +
- Local Read Blocks: N +
- Local Dirtied Blocks: N +
- Local Written Blocks: N +
- Temp Read Blocks: N +
- Temp Written Blocks: N +
- Plans: +
- - Node Type: "Seq Scan" +
- Parent Relationship: "Outer" +
- Slice: N +
- Segments: N +
- Gang Type: "primary reader" +
- Parallel Aware: false +
- Async Capable: false +
- Relation Name: "int8_tbl" +
- Alias: "int8_tbl" +
- Startup Cost: N.N +
- Total Cost: N.N +
- Plan Rows: N +
- Plan Width: N +
- Actual Startup Time: N.N +
- Actual Total Time: N.N +
- Actual Rows: N +
- Actual Loops: N +
- Shared Hit Blocks: N +
- Shared Read Blocks: N +
- Shared Dirtied Blocks: N +
- Shared Written Blocks: N +
- Local Hit Blocks: N +
- Local Read Blocks: N +
- Local Dirtied Blocks: N +
- Local Written Blocks: N +
- Temp Read Blocks: N +
- Temp Written Blocks: N +
- Settings: +
- Optimizer: "Pivotal Optimizer (GPORCA)"+
- Planning: +
- Shared Hit Blocks: N +
- Shared Read Blocks: N +
- Shared Dirtied Blocks: N +
- Shared Written Blocks: N +
- Local Hit Blocks: N +
- Local Read Blocks: N +
- Local Dirtied Blocks: N +
- Local Written Blocks: N +
- Temp Read Blocks: N +
- Temp Written Blocks: N +
- Planning Time: N.N +
- Triggers: +
- Slice statistics: +
- - Slice: N +
- Executor Memory: N +
- - Slice: N +
- Executor Memory: +
- Average: N +
- Workers: N +
- Maximum Memory Used: N +
- Statement statistics: +
- Memory used: N +
+ explain_filter
+--------------------------------------
+ - Plan: +
+ Node Type: "Gather Motion" +
+ Senders: N +
+ Receivers: N +
+ Slice: N +
+ Segments: N +
+ Gang Type: "primary reader" +
+ Parallel Aware: false +
+ Async Capable: false +
+ Startup Cost: N.N +
+ Total Cost: N.N +
+ Plan Rows: N +
+ Plan Width: N +
+ Actual Startup Time: N.N +
+ Actual Total Time: N.N +
+ Actual Rows: N +
+ Actual Loops: N +
+ Shared Hit Blocks: N +
+ Shared Read Blocks: N +
+ Shared Dirtied Blocks: N +
+ Shared Written Blocks: N +
+ Local Hit Blocks: N +
+ Local Read Blocks: N +
+ Local Dirtied Blocks: N +
+ Local Written Blocks: N +
+ Temp Read Blocks: N +
+ Temp Written Blocks: N +
+ Plans: +
+ - Node Type: "Seq Scan" +
+ Parent Relationship: "Outer"+
+ Slice: N +
+ Segments: N +
+ Gang Type: "primary reader" +
+ Parallel Aware: false +
+ Async Capable: false +
+ Relation Name: "int8_tbl" +
+ Alias: "int8_tbl" +
+ Startup Cost: N.N +
+ Total Cost: N.N +
+ Plan Rows: N +
+ Plan Width: N +
+ Actual Startup Time: N.N +
+ Actual Total Time: N.N +
+ Actual Rows: N +
+ Actual Loops: N +
+ Shared Hit Blocks: N +
+ Shared Read Blocks: N +
+ Shared Dirtied Blocks: N +
+ Shared Written Blocks: N +
+ Local Hit Blocks: N +
+ Local Read Blocks: N +
+ Local Dirtied Blocks: N +
+ Local Written Blocks: N +
+ Temp Read Blocks: N +
+ Temp Written Blocks: N +
+ Settings: +
+ Optimizer: "GPORCA" +
+ Planning: +
+ Shared Hit Blocks: N +
+ Shared Read Blocks: N +
+ Shared Dirtied Blocks: N +
+ Shared Written Blocks: N +
+ Local Hit Blocks: N +
+ Local Read Blocks: N +
+ Local Dirtied Blocks: N +
+ Local Written Blocks: N +
+ Temp Read Blocks: N +
+ Temp Written Blocks: N +
+ Planning Time: N.N +
+ Triggers: +
+ Slice statistics: +
+ - Slice: N +
+ Executor Memory: N +
+ - Slice: N +
+ Executor Memory: +
+ Average: N +
+ Workers: N +
+ Subworkers: N +
+ Maximum Memory Used: N +
+ Statement statistics: +
+ Memory used: N +
Execution Time: N.N
(1 row)
@@ -405,77 +407,77 @@ select explain_filter('explain (buffers, format text) select * from int8_tbl i8'
(3 rows)
select explain_filter('explain (buffers, format json) select * from int8_tbl i8');
- explain_filter
--------------------------------------------------
- [ +
- { +
- "Plan": { +
- "Node Type": "Gather Motion", +
- "Senders": N, +
- "Receivers": N, +
- "Slice": N, +
- "Segments": N, +
- "Gang Type": "primary reader", +
- "Parallel Aware": false, +
- "Async Capable": false, +
- "Startup Cost": N.N, +
- "Total Cost": N.N, +
- "Plan Rows": N, +
- "Plan Width": N, +
- "Shared Hit Blocks": N, +
- "Shared Read Blocks": N, +
- "Shared Dirtied Blocks": N, +
- "Shared Written Blocks": N, +
- "Local Hit Blocks": N, +
- "Local Read Blocks": N, +
- "Local Dirtied Blocks": N, +
- "Local Written Blocks": N, +
- "Temp Read Blocks": N, +
- "Temp Written Blocks": N, +
- "Plans": [ +
- { +
- "Node Type": "Seq Scan", +
- "Parent Relationship": "Outer", +
- "Slice": N, +
- "Segments": N, +
- "Gang Type": "primary reader", +
- "Parallel Aware": false, +
- "Async Capable": false, +
- "Relation Name": "int8_tbl", +
- "Alias": "int8_tbl", +
- "Startup Cost": N.N, +
- "Total Cost": N.N, +
- "Plan Rows": N, +
- "Plan Width": N, +
- "Shared Hit Blocks": N, +
- "Shared Read Blocks": N, +
- "Shared Dirtied Blocks": N, +
- "Shared Written Blocks": N, +
- "Local Hit Blocks": N, +
- "Local Read Blocks": N, +
- "Local Dirtied Blocks": N, +
- "Local Written Blocks": N, +
- "Temp Read Blocks": N, +
- "Temp Written Blocks": N +
- } +
- ] +
- }, +
- "Settings": { +
- "Optimizer": "Pivotal Optimizer (GPORCA)"+
- }, +
- "Planning": { +
- "Shared Hit Blocks": N, +
- "Shared Read Blocks": N, +
- "Shared Dirtied Blocks": N, +
- "Shared Written Blocks": N, +
- "Local Hit Blocks": N, +
- "Local Read Blocks": N, +
- "Local Dirtied Blocks": N, +
- "Local Written Blocks": N, +
- "Temp Read Blocks": N, +
- "Temp Written Blocks": N +
- } +
- } +
+ explain_filter
+-------------------------------------------
+ [ +
+ { +
+ "Plan": { +
+ "Node Type": "Gather Motion", +
+ "Senders": N, +
+ "Receivers": N, +
+ "Slice": N, +
+ "Segments": N, +
+ "Gang Type": "primary reader", +
+ "Parallel Aware": false, +
+ "Async Capable": false, +
+ "Startup Cost": N.N, +
+ "Total Cost": N.N, +
+ "Plan Rows": N, +
+ "Plan Width": N, +
+ "Shared Hit Blocks": N, +
+ "Shared Read Blocks": N, +
+ "Shared Dirtied Blocks": N, +
+ "Shared Written Blocks": N, +
+ "Local Hit Blocks": N, +
+ "Local Read Blocks": N, +
+ "Local Dirtied Blocks": N, +
+ "Local Written Blocks": N, +
+ "Temp Read Blocks": N, +
+ "Temp Written Blocks": N, +
+ "Plans": [ +
+ { +
+ "Node Type": "Seq Scan", +
+ "Parent Relationship": "Outer",+
+ "Slice": N, +
+ "Segments": N, +
+ "Gang Type": "primary reader", +
+ "Parallel Aware": false, +
+ "Async Capable": false, +
+ "Relation Name": "int8_tbl", +
+ "Alias": "int8_tbl", +
+ "Startup Cost": N.N, +
+ "Total Cost": N.N, +
+ "Plan Rows": N, +
+ "Plan Width": N, +
+ "Shared Hit Blocks": N, +
+ "Shared Read Blocks": N, +
+ "Shared Dirtied Blocks": N, +
+ "Shared Written Blocks": N, +
+ "Local Hit Blocks": N, +
+ "Local Read Blocks": N, +
+ "Local Dirtied Blocks": N, +
+ "Local Written Blocks": N, +
+ "Temp Read Blocks": N, +
+ "Temp Written Blocks": N +
+ } +
+ ] +
+ }, +
+ "Settings": { +
+ "Optimizer": "GPORCA" +
+ }, +
+ "Planning": { +
+ "Shared Hit Blocks": N, +
+ "Shared Read Blocks": N, +
+ "Shared Dirtied Blocks": N, +
+ "Shared Written Blocks": N, +
+ "Local Hit Blocks": N, +
+ "Local Read Blocks": N, +
+ "Local Dirtied Blocks": N, +
+ "Local Written Blocks": N, +
+ "Temp Read Blocks": N, +
+ "Temp Written Blocks": N +
+ } +
+ } +
]
(1 row)
@@ -700,7 +702,7 @@ select jsonb_pretty(
"Shared Written Blocks": 0 +
}, +
"Settings": { +
- "Optimizer": "Pivotal Optimizer (GPORCA)", +
+ "Optimizer": "GPORCA", +
"optimizer": "on", +
"enable_parallel": "off", +
"parallel_setup_cost": "0", +
diff --git a/src/test/regress/expected/generated_optimizer.out b/src/test/regress/expected/generated_optimizer.out
index fec5be4a92..c1a1eeec12 100644
--- a/src/test/regress/expected/generated_optimizer.out
+++ b/src/test/regress/expected/generated_optimizer.out
@@ -2,7 +2,7 @@ set optimizer_trace_fallback=on;
-- sanity check of system catalog
SELECT attrelid, attname, attgenerated FROM pg_attribute WHERE attgenerated NOT IN ('', 's');
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
attrelid | attname | attgenerated
----------+---------+--------------
(0 rows)
@@ -32,7 +32,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -42,11 +42,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest1"
@@ -56,6 +56,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
b | integer | | | generated always as (a * 2) stored
Indexes:
"gtest1_pkey" PRIMARY KEY, btree (a)
+Distributed by: (a)
-- duplicate generated
CREATE TABLE gtest_err_1 (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED GENERATED ALWAYS AS (a * 3) STORED);
@@ -284,7 +285,7 @@ SELECT * FROM gtest1_1;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -292,11 +293,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest1_1"
@@ -305,6 +306,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
a | integer | | not null |
b | integer | | | generated always as (a * 2) stored
Inherits: gtest1
+Distributed by: (a)
INSERT INTO gtest1_1 VALUES (4);
SELECT * FROM gtest1_1;
@@ -330,7 +332,7 @@ NOTICE: merging column "b" with inherited definition
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -338,11 +340,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest_normal_child"
@@ -351,6 +353,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
a | integer | | |
b | integer | | | generated always as (a * 2) stored
Inherits: gtest_normal
+Distributed by: (a)
INSERT INTO gtest_normal (a) VALUES (1);
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -564,7 +567,7 @@ ALTER TABLE gtest10 DROP COLUMN b;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -574,11 +577,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest10"
@@ -587,6 +590,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
a | integer | | not null |
Indexes:
"gtest10_pkey" PRIMARY KEY, btree (a)
+Distributed by: (a)
CREATE TABLE gtest10a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED);
ALTER TABLE gtest10a DROP COLUMN b;
@@ -676,7 +680,7 @@ CREATE INDEX gtest22c_pred_idx ON gtest22c (a) WHERE b > 0;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -686,11 +690,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest22c"
@@ -702,6 +706,7 @@ Indexes:
"gtest22c_b_idx" btree (b)
"gtest22c_expr_idx" btree ((b * 3))
"gtest22c_pred_idx" btree (a) WHERE b > 0
+Distributed by: (a)
INSERT INTO gtest22c VALUES (1), (2), (3);
SET enable_seqscan TO off;
@@ -766,7 +771,7 @@ CREATE TABLE gtest23b (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STOR
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -774,19 +779,19 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest23b"
@@ -798,6 +803,7 @@ Indexes:
"gtest23b_pkey" PRIMARY KEY, btree (a)
Foreign-key constraints:
"gtest23b_b_fkey" FOREIGN KEY (b) REFERENCES gtest23a(x)
+Distributed by: (a)
INSERT INTO gtest23b VALUES (1); -- ok
-- GPDB doesn't enforce foreign key constraints, so this doesn't error out.
@@ -888,7 +894,7 @@ SELECT * FROM gtest25 ORDER BY a;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -898,11 +904,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest25"
@@ -916,6 +922,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
y | double precision | | | generated always as (d * 4::double precision) stored
Indexes:
"gtest25_pkey" PRIMARY KEY, btree (a)
+Distributed by: (a)
-- ALTER TABLE ... ALTER COLUMN
CREATE TABLE gtest27 (
@@ -933,7 +940,7 @@ ALTER TABLE gtest27 ALTER COLUMN x TYPE numeric;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -941,11 +948,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest27"
@@ -954,6 +961,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
a | integer | | |
b | integer | | |
x | numeric | | | generated always as (((a + b) * 2)) stored
+Distributed randomly
SELECT * FROM gtest27;
a | b | x
@@ -977,7 +985,7 @@ ALTER TABLE gtest27
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -985,11 +993,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest27"
@@ -998,6 +1006,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
a | bigint | | |
b | bigint | | |
x | bigint | | | generated always as ((a + b) * 2) stored
+Distributed randomly
-- Ideally you could just do this, but not today (and should x change type?):
ALTER TABLE gtest27
@@ -1009,7 +1018,7 @@ DETAIL: Column "a" is used by generated column "x".
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -1017,11 +1026,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest27"
@@ -1030,6 +1039,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
a | bigint | | |
b | bigint | | |
x | bigint | | | generated always as ((a + b) * 2) stored
+Distributed randomly
SELECT * FROM gtest27;
a | b | x
@@ -1061,55 +1071,57 @@ SELECT * FROM gtest29;
(4 rows)
\d gtest29
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest29"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
b | integer | | |
+Distributed by: (a)
-- check that dependencies between columns have also been removed
ALTER TABLE gtest29 DROP COLUMN a; -- should not drop b
\d gtest29
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest29"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
b | integer | | |
+Distributed randomly
-- with inheritance
CREATE TABLE gtest30 (
@@ -1119,56 +1131,58 @@ CREATE TABLE gtest30 (
CREATE TABLE gtest30_1 () INHERITS (gtest30);
ALTER TABLE gtest30 ALTER COLUMN b DROP EXPRESSION;
\d gtest30
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest30"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
b | integer | | |
Number of child tables: 1 (Use \d+ to list them.)
+Distributed by: (a)
\d gtest30_1
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest30_1"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
b | integer | | |
Inherits: gtest30
+Distributed by: (a)
DROP TABLE gtest30 CASCADE;
NOTICE: drop cascades to table gtest30_1
@@ -1180,56 +1194,58 @@ CREATE TABLE gtest30_1 () INHERITS (gtest30);
ALTER TABLE ONLY gtest30 ALTER COLUMN b DROP EXPRESSION; -- error
ERROR: ALTER TABLE / DROP EXPRESSION must be applied to child tables too
\d gtest30
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest30"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+------------------------------------
a | integer | | |
b | integer | | | generated always as (a * 2) stored
Number of child tables: 1 (Use \d+ to list them.)
+Distributed by: (a)
\d gtest30_1
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Queries on master-only tables
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest30_1"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+------------------------------------
a | integer | | |
b | integer | | | generated always as (a * 2) stored
Inherits: gtest30
+Distributed by: (a)
ALTER TABLE gtest30_1 ALTER COLUMN b DROP EXPRESSION; -- error
ERROR: cannot drop generation expression from inherited column
@@ -1413,7 +1429,7 @@ CREATE TABLE gtest28b (LIKE gtest28a INCLUDING GENERATED);
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -1421,11 +1437,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest28a"
@@ -1437,7 +1453,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
Distributed randomly
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -1445,11 +1461,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
Table "public.gtest28b"
diff --git a/src/test/regress/expected/gp_covering_index.out b/src/test/regress/expected/gp_covering_index.out
index e642677ea2..5e79cd8840 100644
--- a/src/test/regress/expected/gp_covering_index.out
+++ b/src/test/regress/expected/gp_covering_index.out
@@ -486,10 +486,10 @@ SELECT a, b, c FROM test_cover_index_on_pt WHERE b<10;
-- Expect static eliminated partitions due to predicate on column 'b'
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT a, b FROM test_cover_index_on_pt WHERE a<10 and b=2;
- QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=1 loops=1)
- -> Index Only Scan using test_cover_index_on_pt_1_prt_3_a_b_idx on test_cover_index_on_pt_1_prt_3 (actual rows=1 loops=1)
+ -> Index Only Scan using test_cover_index_on_pt_1_prt_3_a_b_idx on test_cover_index_on_pt_1_prt_3 test_cover_index_on_pt (actual rows=1 loops=1)
Index Cond: (a < 10)
Filter: (b = 2)
Heap Fetches: 0
@@ -617,13 +617,15 @@ CREATE INDEX idx_ao_pt_a ON ao_pt USING btree (a);
VACUUM ANALYZE ao_pt;
-- Allow dynamic index-only scan on mixed partitioned AO table
EXPLAIN SELECT a FROM ao_pt WHERE a=29;
- QUERY PLAN
-----------------------------------------------------------------------------------------------------
- Gather Motion 1:1 (slice1; segments: 1) (cost=0.14..4.17 rows=1 width=8)
- -> Index Only Scan using ao_pt_1_prt_3_a_idx on ao_pt_1_prt_3 (cost=0.14..4.15 rows=1 width=8)
- Index Cond: (a = 29)
+ QUERY PLAN
+----------------------------------------------------------------------------------------
+ Gather Motion 1:1 (slice1; segments: 1) (cost=4.14..8.18 rows=1 width=8)
+ -> Bitmap Heap Scan on ao_pt_1_prt_3 ao_pt (cost=4.14..8.16 rows=1 width=8)
+ Recheck Cond: (a = 29)
+ -> Bitmap Index Scan on ao_pt_1_prt_3_a_idx (cost=0.00..4.14 rows=1 width=0)
+ Index Cond: (a = 29)
Optimizer: Postgres query optimizer
-(4 rows)
+(6 rows)
-- imitate child partition has GPDB 6 version file via catalog
-- start_ignore
@@ -636,7 +638,7 @@ EXPLAIN SELECT a FROM ao_pt WHERE a=29;
QUERY PLAN
----------------------------------------------------------------------------------------
Gather Motion 1:1 (slice1; segments: 1) (cost=4.14..8.18 rows=1 width=8)
- -> Bitmap Heap Scan on ao_pt_1_prt_3 (cost=4.14..8.16 rows=1 width=8)
+ -> Bitmap Heap Scan on ao_pt_1_prt_3 ao_pt (cost=4.14..8.16 rows=1 width=8)
Recheck Cond: (a = 29)
-> Bitmap Index Scan on ao_pt_1_prt_3_a_idx (cost=0.00..4.14 rows=1 width=0)
Index Cond: (a = 29)
@@ -658,13 +660,15 @@ CREATE INDEX idx_aocs_pt_a ON aocs_pt USING btree (a);
VACUUM ANALYZE aocs_pt;
-- Allow dynamic index-only scan on mixed partitioned AO/CO table
EXPLAIN SELECT a FROM aocs_pt WHERE a=29;
- QUERY PLAN
---------------------------------------------------------------------------------------------------------
- Gather Motion 1:1 (slice1; segments: 1) (cost=0.14..4.17 rows=1 width=8)
- -> Index Only Scan using aocs_pt_1_prt_3_a_idx on aocs_pt_1_prt_3 (cost=0.14..4.15 rows=1 width=8)
- Index Cond: (a = 29)
+ QUERY PLAN
+------------------------------------------------------------------------------------------
+ Gather Motion 1:1 (slice1; segments: 1) (cost=4.14..8.18 rows=1 width=8)
+ -> Bitmap Heap Scan on aocs_pt_1_prt_3 aocs_pt (cost=4.14..8.16 rows=1 width=8)
+ Recheck Cond: (a = 29)
+ -> Bitmap Index Scan on aocs_pt_1_prt_3_a_idx (cost=0.00..4.14 rows=1 width=0)
+ Index Cond: (a = 29)
Optimizer: Postgres query optimizer
-(4 rows)
+(6 rows)
-- imitate child partition has GPDB 6 version file via catalog
-- start_ignore
@@ -677,7 +681,7 @@ EXPLAIN SELECT a FROM aocs_pt WHERE a=29;
QUERY PLAN
------------------------------------------------------------------------------------------
Gather Motion 1:1 (slice1; segments: 1) (cost=4.14..8.18 rows=1 width=8)
- -> Bitmap Heap Scan on aocs_pt_1_prt_3 (cost=4.14..8.16 rows=1 width=8)
+ -> Bitmap Heap Scan on aocs_pt_1_prt_3 aocs_pt (cost=4.14..8.16 rows=1 width=8)
Recheck Cond: (a = 29)
-> Bitmap Index Scan on aocs_pt_1_prt_3_a_idx (cost=0.00..4.14 rows=1 width=0)
Index Cond: (a = 29)
@@ -725,10 +729,11 @@ SELECT count(*) FROM tsvector_table WHERE a @@ 'w:*|q:*';
-> Partial Aggregate (actual rows=1 loops=1)
-> Bitmap Heap Scan on tsvector_table (actual rows=0 loops=1)
Recheck Cond: (a @@ '''w'':* | ''q'':*'::tsquery)
+ Rows Removed by Index Recheck: 1
-> Bitmap Index Scan on a_gist_index (actual rows=1 loops=1)
Index Cond: (a @@ '''w'':* | ''q'':*'::tsquery)
- Optimizer: Postgres-based planner
-(8 rows)
+ Optimizer: Postgres query optimizer
+(9 rows)
SELECT count(*) FROM tsvector_table WHERE a @@ 'w:*|q:*';
count
@@ -753,20 +758,20 @@ INSERT INTO test_partition_table_with_gist_index VALUES (3, '(1.0,1.0,3.0,3.0)')
VACUUM ANALYZE test_partition_table_with_gist_index;
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT a, b_box FROM test_partition_table_with_gist_index WHERE b_box<@ box '(0,0,3,3)';
- QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=2 loops=1)
-> Append (actual rows=2 loops=1)
- -> Index Only Scan using test_partition_table_with_gist_index_1_prt_1_b_box_a_idx on test_partition_table_with_gist_index_1_prt_1 (actual rows=0 loops=1)
+ -> Index Only Scan using test_partition_table_with_gist_index_1_prt_1_b_box_a_idx on test_partition_table_with_gist_index_1_prt_1 test_partition_table_with_gist_index_1 (actual rows=0 loops=1)
Index Cond: (b_box <@ '(3,3),(0,0)'::box)
Heap Fetches: 0
- -> Index Only Scan using test_partition_table_with_gist_index_1_prt_2_b_box_a_idx on test_partition_table_with_gist_index_1_prt_2 (actual rows=0 loops=1)
+ -> Index Only Scan using test_partition_table_with_gist_index_1_prt_2_b_box_a_idx on test_partition_table_with_gist_index_1_prt_2 test_partition_table_with_gist_index_2 (actual rows=0 loops=1)
Index Cond: (b_box <@ '(3,3),(0,0)'::box)
Heap Fetches: 0
- -> Index Only Scan using test_partition_table_with_gist_index_1_prt_3_b_box_a_idx on test_partition_table_with_gist_index_1_prt_3 (actual rows=1 loops=1)
+ -> Index Only Scan using test_partition_table_with_gist_index_1_prt_3_b_box_a_idx on test_partition_table_with_gist_index_1_prt_3 test_partition_table_with_gist_index_3 (actual rows=1 loops=1)
Index Cond: (b_box <@ '(3,3),(0,0)'::box)
Heap Fetches: 0
- -> Index Only Scan using test_partition_table_with_gist_index_1_prt_4_b_box_a_idx on test_partition_table_with_gist_index_1_prt_4 (actual rows=1 loops=1)
+ -> Index Only Scan using test_partition_table_with_gist_index_1_prt_4_b_box_a_idx on test_partition_table_with_gist_index_1_prt_4 test_partition_table_with_gist_index_4 (actual rows=1 loops=1)
Index Cond: (b_box <@ '(3,3),(0,0)'::box)
Heap Fetches: 0
Optimizer: Postgres query optimizer
diff --git a/src/test/regress/expected/gp_covering_index_optimizer.out b/src/test/regress/expected/gp_covering_index_optimizer.out
index b02ee1d954..b60ed79ee4 100644
--- a/src/test/regress/expected/gp_covering_index_optimizer.out
+++ b/src/test/regress/expected/gp_covering_index_optimizer.out
@@ -269,7 +269,7 @@ SELECT b FROM test_ao WHERE a<42 AND b>42;
Index Cond: (a < 42)
Filter: (b > 42)
Rows Removed by Filter: 8
- Heap Fetches: 0
+ Heap Fetches: 16
Optimizer: Pivotal Optimizer (GPORCA)
(7 rows)
@@ -421,16 +421,15 @@ VACUUM ANALYZE test_cover_index_on_pt;
-- KEYS: [a] INCLUDED: [b]
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT a, b FROM test_cover_index_on_pt WHERE a<10;
- QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=4 loops=1)
- -> Dynamic Index Only Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=3 loops=1)
+ -> Dynamic Index Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=3 loops=1)
Index Cond: (a < 10)
- Heap Fetches: 0
Number of partitions to scan: 4 (out of 4)
Partitions scanned: Avg 4.0 x 3 workers. Max 4 parts (seg0).
Optimizer: Pivotal Optimizer (GPORCA)
-(7 rows)
+(6 rows)
-- KEYS: [a] INCLUDED: [b]
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, SUMMARY OFF)
@@ -462,38 +461,36 @@ SELECT a, b, c FROM test_cover_index_on_pt WHERE b<10;
-- Expect static eliminated partitions due to predicate on column 'b'
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT a, b FROM test_cover_index_on_pt WHERE a<10 and b=2;
- QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=1 loops=1)
- -> Dynamic Index Only Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=1 loops=1)
+ -> Dynamic Index Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=1 loops=1)
Index Cond: (a < 10)
Filter: ((a < 10) AND (b = 2))
- Heap Fetches: 0
Number of partitions to scan: 1 (out of 4)
Partitions scanned: Avg 1.0 x 3 workers. Max 1 parts (seg0).
Optimizer: Pivotal Optimizer (GPORCA)
-(8 rows)
+(7 rows)
-- Expect both sides of join to perform index only scan
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT pt.a, pt.b FROM test_cover_index_on_pt AS pt JOIN test_basic_cover_index AS t ON pt.a=t.a WHERE pt.a<10 and pt.b=2;
- QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=1 loops=1)
-> Nested Loop (actual rows=1 loops=1)
Join Filter: true
-> Broadcast Motion 3:3 (slice2; segments: 3) (actual rows=1 loops=1)
- -> Dynamic Index Only Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=1 loops=1)
+ -> Dynamic Index Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=1 loops=1)
Index Cond: (a < 10)
Filter: ((a < 10) AND (b = 2))
- Heap Fetches: 0
Number of partitions to scan: 1 (out of 4)
Partitions scanned: Avg 1.0 x 3 workers. Max 1 parts (seg0).
-> Index Only Scan using i_test_basic_index on test_basic_cover_index (actual rows=1 loops=1)
Index Cond: ((a = test_cover_index_on_pt.a) AND (a < 10))
Heap Fetches: 0
Optimizer: Pivotal Optimizer (GPORCA)
-(14 rows)
+(13 rows)
SELECT pt.a, pt.b FROM test_cover_index_on_pt AS pt JOIN test_basic_cover_index AS t ON pt.a=t.a WHERE pt.a<10 and pt.b=2;
a | b
@@ -504,16 +501,15 @@ SELECT pt.a, pt.b FROM test_cover_index_on_pt AS pt JOIN test_basic_cover_index
-- Expect both sides of join to perform index only scan
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT pt.a, pt.b FROM test_cover_index_on_pt AS pt LEFT JOIN test_basic_cover_index AS t ON pt.a=t.a WHERE pt.a<10 and pt.b=2;
- QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=1 loops=1)
-> Hash Left Join (actual rows=1 loops=1)
Hash Cond: (test_cover_index_on_pt.a = test_basic_cover_index.a)
Extra Text: (seg0) Hash chain length 1.0 avg, 1 max, using 5 of 524288 buckets.
- -> Dynamic Index Only Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=1 loops=1)
+ -> Dynamic Index Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=1 loops=1)
Index Cond: (a < 10)
Filter: ((a < 10) AND (b = 2))
- Heap Fetches: 0
Number of partitions to scan: 1 (out of 4)
Partitions scanned: Avg 1.0 x 3 workers. Max 1 parts (seg0).
-> Hash (actual rows=5 loops=1)
@@ -522,7 +518,7 @@ SELECT pt.a, pt.b FROM test_cover_index_on_pt AS pt LEFT JOIN test_basic_cover_i
Index Cond: (a < 10)
Heap Fetches: 0
Optimizer: Pivotal Optimizer (GPORCA)
-(16 rows)
+(15 rows)
SELECT pt.a, pt.b FROM test_cover_index_on_pt AS pt LEFT JOIN test_basic_cover_index AS t ON pt.a=t.a WHERE pt.a<10 and pt.b=2;
a | b
@@ -538,16 +534,15 @@ VACUUM ANALYZE test_cover_index_on_pt;
-- KEYS: [a] INCLUDED: [b]
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT a, b FROM test_cover_index_on_pt WHERE a<10;
- QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=4 loops=1)
- -> Dynamic Index Only Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=3 loops=1)
+ -> Dynamic Index Scan on i_test_cover_index_scan_on_partition_table on test_cover_index_on_pt (actual rows=3 loops=1)
Index Cond: (a < 10)
- Heap Fetches: 0
Number of partitions to scan: 4 (out of 4)
Partitions scanned: Avg 4.0 x 3 workers. Max 4 parts (seg0).
Optimizer: Pivotal Optimizer (GPORCA)
-(7 rows)
+(6 rows)
DROP INDEX i_test_cover_index_scan_on_partition_table;
-- with explicit index declared on leaf_part
@@ -698,6 +693,7 @@ DETAIL: Falling back to Postgres-based planner because no plan has been compute
-> Partial Aggregate (actual rows=1 loops=1)
-> Bitmap Heap Scan on tsvector_table (actual rows=0 loops=1)
Recheck Cond: (a @@ '''w'':* | ''q'':*'::tsquery)
+ Rows Removed by Index Recheck: 1
-> Bitmap Index Scan on a_gist_index (actual rows=1 loops=1)
Index Cond: (a @@ '''w'':* | ''q'':*'::tsquery)
Optimizer: Postgres-based planner
@@ -731,10 +727,9 @@ SELECT a, b_box FROM test_partition_table_with_gist_index WHERE b_box<@ box '(0,
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=2 loops=1)
- -> Dynamic Index Only Scan on gist_index_on_column_a_box on test_partition_table_with_gist_index (actual rows=2 loops=1)
+ -> Dynamic Index Scan on gist_index_on_column_a_box on test_partition_table_with_gist_index (actual rows=2 loops=1)
Index Cond: (b_box <@ '(3,3),(0,0)'::box)
Filter: (b_box <@ '(3,3),(0,0)'::box)
- Heap Fetches: 0
Number of partitions to scan: 4 (out of 4)
Partitions scanned: Avg 4.0 x 3 workers. Max 4 parts (seg0).
Optimizer: Pivotal Optimizer (GPORCA)
diff --git a/src/test/regress/expected/gp_dqa_optimizer.out b/src/test/regress/expected/gp_dqa_optimizer.out
index 24a24441b7..020002cf64 100644
--- a/src/test/regress/expected/gp_dqa_optimizer.out
+++ b/src/test/regress/expected/gp_dqa_optimizer.out
@@ -2491,7 +2491,7 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Multiple Distinct Qualified Aggregates are disabled in the optimizer
QUERY PLAN
-----------------------------------------------------------------------
- Aggregate
+ Finalize Aggregate
Output: count(DISTINCT ((b)::text)), count(DISTINCT ((a)::integer))
-> Gather Motion 3:1 (slice1; segments: 3)
Output: (PARTIAL count(DISTINCT ((b)::text))), (PARTIAL count(DISTINCT ((a)::integer)))
@@ -2527,7 +2527,7 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Multiple Distinct Qualified Aggregates are disabled in the optimizer
QUERY PLAN
--------------------------------------------------------------------------------------------
- Aggregate
+ Finalize Aggregate
Output: count(DISTINCT ((b)::text)), count(DISTINCT (((a)::integer)::character varying))
-> Gather Motion 3:1 (slice1; segments: 3)
Output: (PARTIAL count(DISTINCT ((b)::text))), (PARTIAL count(DISTINCT (((a)::integer)::character varying)))
diff --git a/src/test/regress/expected/gp_explain.out b/src/test/regress/expected/gp_explain.out
index 91a0c45a57..f4e0f513c8 100644
--- a/src/test/regress/expected/gp_explain.out
+++ b/src/test/regress/expected/gp_explain.out
@@ -315,7 +315,9 @@ explain (format json, costs off) SELECT * FROM dummy_ext_tab;
} +
] +
}, +
- "Optimizer": "Postgres-based planner" +
+ "Settings": { +
+ "Optimizer": "Postgres query optimizer"+
+ } +
} +
]
(1 row)
@@ -346,12 +348,13 @@ explain (format yaml, costs off) SELECT * FROM dummy_aotab;
Async Capable: false +
Relation Name: "dummy_aotab" +
Alias: "dummy_aotab" +
- Optimizer: "Postgres-based planner"
+ Settings: +
+ Optimizer: "Postgres query optimizer"
(1 row)
-- DML node (with ORCA)
explain (format xml, costs off) insert into dummy_aotab values (1);
- QUERY PLAN
+ QUERY PLAN
------------------------------------------------------------
<explain xmlns="http://www.postgresql.org/2009/explain"> +
<Query> +
@@ -377,7 +380,9 @@ explain (format xml, costs off) insert into dummy_aotab values (1);
</Plan> +
</Plans> +
</Plan> +
- <Optimizer>Postgres-based planner</Optimizer> +
+ <Settings> +
+ <Optimizer>Postgres query optimizer</Optimizer> +
+ </Settings> +
</Query> +
</explain>
(1 row)
@@ -473,7 +478,9 @@ explain (slicetable, costs off, format json) SELECT * FROM explaintest;
} +
] +
}, +
- "Optimizer": "Postgres-based planner", +
+ "Settings": { +
+ "Optimizer": "Postgres query optimizer"+
+ }, +
"Slice Table": [ +
{ +
"Slice ID": 0, +
diff --git a/src/test/regress/expected/gp_explain_optimizer.out b/src/test/regress/expected/gp_explain_optimizer.out
index ac3cf0146a..abf6dd5b7e 100644
--- a/src/test/regress/expected/gp_explain_optimizer.out
+++ b/src/test/regress/expected/gp_explain_optimizer.out
@@ -288,36 +288,38 @@ explain (costs off) select count(*) over (partition by g) from generate_series(1
CREATE EXTERNAL WEB TABLE dummy_ext_tab (x text) EXECUTE 'echo foo' FORMAT 'text';
-- External Table Scan
explain (format json, costs off) SELECT * FROM dummy_ext_tab;
- QUERY PLAN
--------------------------------------------------
- [ +
- { +
- "Plan": { +
- "Node Type": "Gather Motion", +
- "Senders": 3, +
- "Receivers": 1, +
- "Slice": 1, +
- "Segments": 3, +
- "Gang Type": "primary reader", +
- "Parallel Aware": false, +
- "Async Capable": false, +
- "Plans": [ +
- { +
- "Node Type": "Foreign Scan", +
- "Operation": "Select", +
- "Parent Relationship": "Outer", +
- "Slice": 1, +
- "Segments": 3, +
- "Gang Type": "primary reader", +
- "Parallel Aware": false, +
- "Async Capable": false, +
- "Relation Name": "dummy_ext_tab", +
- "Alias": "dummy_ext_tab" +
- } +
- ] +
- }, +
- "Optimizer": "GPORCA" +
- } +
+ QUERY PLAN
+---------------------------------------------
+ [ +
+ { +
+ "Plan": { +
+ "Node Type": "Gather Motion", +
+ "Senders": 3, +
+ "Receivers": 1, +
+ "Slice": 1, +
+ "Segments": 3, +
+ "Gang Type": "primary reader", +
+ "Parallel Aware": false, +
+ "Async Capable": false, +
+ "Plans": [ +
+ { +
+ "Node Type": "Foreign Scan", +
+ "Operation": "Select", +
+ "Parent Relationship": "Outer", +
+ "Slice": 1, +
+ "Segments": 3, +
+ "Gang Type": "primary reader", +
+ "Parallel Aware": false, +
+ "Async Capable": false, +
+ "Relation Name": "dummy_ext_tab",+
+ "Alias": "dummy_ext_tab" +
+ } +
+ ] +
+ }, +
+ "Settings": { +
+ "Optimizer": "GPORCA" +
+ } +
+ } +
]
(1 row)
@@ -326,28 +328,29 @@ CREATE TEMP TABLE dummy_aotab (x int4) WITH (appendonly=true);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'x' as the Cloudberry Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
explain (format yaml, costs off) SELECT * FROM dummy_aotab;
- QUERY PLAN
----------------------------------------------
- - Plan: +
- Node Type: "Gather Motion" +
- Senders: 3 +
- Receivers: 1 +
- Slice: 1 +
- Segments: 3 +
- Gang Type: "primary reader" +
- Parallel Aware: false +
- Async Capable: false +
- Plans: +
- - Node Type: "Seq Scan" +
- Parent Relationship: "Outer" +
- Slice: 1 +
- Segments: 3 +
- Gang Type: "primary reader" +
- Parallel Aware: false +
- Async Capable: false +
- Relation Name: "dummy_aotab" +
- Alias: "dummy_aotab" +
- Optimizer: "GPORCA"
+ QUERY PLAN
+--------------------------------------
+ - Plan: +
+ Node Type: "Gather Motion" +
+ Senders: 3 +
+ Receivers: 1 +
+ Slice: 1 +
+ Segments: 3 +
+ Gang Type: "primary reader" +
+ Parallel Aware: false +
+ Async Capable: false +
+ Plans: +
+ - Node Type: "Seq Scan" +
+ Parent Relationship: "Outer"+
+ Slice: 1 +
+ Segments: 3 +
+ Gang Type: "primary reader" +
+ Parallel Aware: false +
+ Async Capable: false +
+ Relation Name: "dummy_aotab"+
+ Alias: "dummy_aotab" +
+ Settings: +
+ Optimizer: "GPORCA"
(1 row)
-- DML node (with ORCA)
@@ -400,7 +403,9 @@ explain (format xml, costs off) insert into dummy_aotab values (1);
</Plan> +
</Plans> +
</Plan> +
- <Optimizer>GPORCA</Optimizer> +
+ <Settings> +
+ <Optimizer>GPORCA</Optimizer> +
+ </Settings> +
</Query> +
</explain>
(1 row)
@@ -468,51 +473,53 @@ explain (slicetable, costs off) SELECT * FROM explaintest;
-- same in JSON format
explain (slicetable, costs off, format json) SELECT * FROM explaintest;
- QUERY PLAN
--------------------------------------------------
- [ +
- { +
- "Plan": { +
- "Node Type": "Gather Motion", +
- "Senders": 3, +
- "Receivers": 1, +
- "Slice": 1, +
- "Segments": 3, +
- "Gang Type": "primary reader", +
- "Parallel Aware": false, +
- "Async Capable": false, +
- "Plans": [ +
- { +
- "Node Type": "Seq Scan", +
- "Parent Relationship": "Outer", +
- "Slice": 1, +
- "Segments": 3, +
- "Gang Type": "primary reader", +
- "Parallel Aware": false, +
- "Async Capable": false, +
- "Relation Name": "explaintest", +
- "Alias": "explaintest" +
- } +
- ] +
- }, +
- "Optimizer": "GPORCA", +
- "Slice Table": [ +
- { +
- "Slice ID": 0, +
- "Gang Type": "Dispatcher", +
- "Root": 0, +
- "Parent": -1, +
- "Gang Size": 0 +
- }, +
- { +
- "Slice ID": 1, +
- "Gang Type": "Reader", +
- "Root": 0, +
- "Parent": 0, +
- "Gang Size": 3 +
- } +
- ] +
- } +
+ QUERY PLAN
+-------------------------------------------
+ [ +
+ { +
+ "Plan": { +
+ "Node Type": "Gather Motion", +
+ "Senders": 3, +
+ "Receivers": 1, +
+ "Slice": 1, +
+ "Segments": 3, +
+ "Gang Type": "primary reader", +
+ "Parallel Aware": false, +
+ "Async Capable": false, +
+ "Plans": [ +
+ { +
+ "Node Type": "Seq Scan", +
+ "Parent Relationship": "Outer",+
+ "Slice": 1, +
+ "Segments": 3, +
+ "Gang Type": "primary reader", +
+ "Parallel Aware": false, +
+ "Async Capable": false, +
+ "Relation Name": "explaintest",+
+ "Alias": "explaintest" +
+ } +
+ ] +
+ }, +
+ "Settings": { +
+ "Optimizer": "GPORCA" +
+ }, +
+ "Slice Table": [ +
+ { +
+ "Slice ID": 0, +
+ "Gang Type": "Dispatcher", +
+ "Root": 0, +
+ "Parent": -1, +
+ "Gang Size": 0 +
+ }, +
+ { +
+ "Slice ID": 1, +
+ "Gang Type": "Reader", +
+ "Root": 0, +
+ "Parent": 0, +
+ "Gang Size": 3 +
+ } +
+ ] +
+ } +
]
(1 row)
diff --git a/src/test/regress/expected/gporca.out b/src/test/regress/expected/gporca.out
index 6fe7b29096..0d83a50c17 100644
--- a/src/test/regress/expected/gporca.out
+++ b/src/test/regress/expected/gporca.out
@@ -14735,17 +14735,17 @@ explain (costs off) select (x.item).a from comp_part x join comp_part y on (X.it
-> Redistribute Motion 3:3 (slice2; segments: 3)
Hash Key: (x.item).c
-> Append
- -> Seq Scan on comp_part_1_prt_1 x
- -> Seq Scan on comp_part_1_prt_2 x_1
- -> Seq Scan on comp_part_1_prt_3 x_2
+ -> Seq Scan on comp_part_1_prt_1 x_1
+ -> Seq Scan on comp_part_1_prt_2 x_2
+ -> Seq Scan on comp_part_1_prt_3 x_3
-> Hash
-> Redistribute Motion 3:3 (slice3; segments: 3)
Hash Key: (y.item).c
-> Append
- -> Seq Scan on comp_part_1_prt_1 y
- -> Seq Scan on comp_part_1_prt_2 y_1
- -> Seq Scan on comp_part_1_prt_3 y_2
- Optimizer: Postgres-based planner
+ -> Seq Scan on comp_part_1_prt_1 y_1
+ -> Seq Scan on comp_part_1_prt_2 y_2
+ -> Seq Scan on comp_part_1_prt_3 y_3
+ Optimizer: Postgres query optimizer
(17 rows)
-- clean up
diff --git a/src/test/regress/expected/gporca_optimizer.out b/src/test/regress/expected/gporca_optimizer.out
index b80bab9ff7..6eb308c416 100644
--- a/src/test/regress/expected/gporca_optimizer.out
+++ b/src/test/regress/expected/gporca_optimizer.out
@@ -12508,12 +12508,12 @@ where out.b in (select coalesce(tcorr2_d.c, 99)
group by a) tcorr2_d on tcorr1.a=tcorr2_d.a);
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
- Result (cost=0.00..1356692180.88 rows=1 width=8)
+ Result (cost=0.00..1356692228.44 rows=1 width=8)
Filter: (SubPlan 1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=8)
-> Seq Scan on tcorr1 (cost=0.00..431.00 rows=1 width=8)
SubPlan 1
- -> Nested Loop Left Join (cost=0.00..1324032.71 rows=3 width=8)
+ -> Nested Loop Left Join (cost=0.00..1324032.75 rows=3 width=8)
Join Filter: (tcorr1_1.a = tcorr2.a)
-> Materialize (cost=0.00..431.00 rows=1 width=4)
-> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..431.00 rows=1 width=4)
@@ -12632,12 +12632,12 @@ where out.b in (select coalesce(tcorr2_d.c, 99)
group by a) tcorr2_d on tcorr1.a=tcorr2_d.a);
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
- Result (cost=0.00..1356692180.88 rows=1 width=8)
+ Result (cost=0.00..1356692228.44 rows=1 width=8)
Filter: (SubPlan 1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=8)
-> Seq Scan on tcorr1 (cost=0.00..431.00 rows=1 width=8)
SubPlan 1
- -> Nested Loop Left Join (cost=0.00..1324032.71 rows=3 width=8)
+ -> Nested Loop Left Join (cost=0.00..1324032.75 rows=3 width=8)
Join Filter: (tcorr1_1.a = tcorr2.a)
-> Materialize (cost=0.00..431.00 rows=1 width=4)
-> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..431.00 rows=1 width=4)
@@ -14413,8 +14413,8 @@ INNER JOIN (
WHERE t.tradingday BETWEEN'20190715'AND '20190715'
GROUP BY t.tradingday)t2
ON t1.tradingday = t2.tradingday;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: No plan has been computed for required properties
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because no plan has been computed for required properties in GPORCA
tradingday | ins_spaninsarbitrageratio | tradingday | prod_spaninsarbitrageratio
------------+---------------------------+------------+----------------------------
20190715 | 1 | 20190715 | 0.9233716475
@@ -14569,8 +14569,6 @@ select (c1).r from quad_func_cast();
(1 row)
select (c2).i from quad_func_cast();
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: FIELDSELECT
i
---
@@ -14963,32 +14961,24 @@ analyze testPartWidth;
-- b | 5
--------------------------------------------------------------------------------
select check_col_width('select a from testPartWidth;','Dynamic Seq Scan','width=5') = 1;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: SIRV functions
?column?
----------
t
(1 row)
select check_col_width('select b from testPartWidth;','Dynamic Seq Scan','width=5') = 1;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: SIRV functions
?column?
----------
t
(1 row)
select check_col_width('select a from testPartWidth;','Append','width=5') = 1;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: SIRV functions
?column?
----------
f
(1 row)
select check_col_width('select a from testPartWidth;','Append','width=5') = 1;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: SIRV functions
?column?
----------
f
diff --git a/src/test/regress/expected/groupingsets_optimizer.out b/src/test/regress/expected/groupingsets_optimizer.out
index c7af2a30f4..b0027e713c 100644
--- a/src/test/regress/expected/groupingsets_optimizer.out
+++ b/src/test/regress/expected/groupingsets_optimizer.out
@@ -113,8 +113,6 @@ set enable_hashagg = false; -- test hashing explicitly later
-- (and with ordering differing from grouping)
select a, b, grouping(a,b), sum(v), count(*), max(v)
from gstest1 group by rollup (a,b);
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Grouping function with multiple arguments
a | b | grouping | sum | count | max
---+---+----------+-----+-------+-----
1 | 1 | 0 | 21 | 2 | 11
@@ -133,8 +131,6 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
select a, b, grouping(a,b), sum(v), count(*), max(v)
from gstest1 group by rollup (a,b) order by a,b;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Grouping function with multiple arguments
a | b | grouping | sum | count | max
---+---+----------+-----+-------+-----
1 | 1 | 0 | 21 | 2 | 11
@@ -153,8 +149,6 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
select a, b, grouping(a,b), sum(v), count(*), max(v)
from gstest1 group by rollup (a,b) order by b desc, a;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Grouping function with multiple arguments
a | b | grouping | sum | count | max
---+---+----------+-----+-------+-----
1 | | 1 | 60 | 5 | 14
@@ -173,8 +167,6 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
select a, b, grouping(a,b), sum(v), count(*), max(v)
from gstest1 group by rollup (a,b) order by coalesce(a,0)+coalesce(b,0);
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Grouping function with multiple arguments
a | b | grouping | sum | count | max
---+---+----------+-----+-------+-----
| | 3 | 145 | 10 | 19
@@ -198,8 +190,6 @@ select a, b, grouping(a,b),
percentile_disc(0.5) within group (order by v),
rank(1,2,12) within group (order by a,b,v)
from gstest1 group by rollup (a,b) order by a,b;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Grouping function with multiple arguments
a | b | grouping | array_agg | string_agg | percentile_disc | rank
---+---+----------+---------------------------------+-------------------------------+-----------------+------
1 | 1 | 0 | {10,11} | 11:10 | 10 | 3
@@ -936,6 +926,13 @@ explain (costs off)
-> Shared Scan (share slice:id 1:0)
-> Seq Scan on gstest2
-> Append
+ -> GroupAggregate
+ Group Key: share0_ref2.a
+ -> Sort
+ Sort Key: share0_ref2.a
+ -> Result
+ Filter: (share0_ref2.a IS DISTINCT FROM 1)
+ -> Shared Scan (share slice:id 1:0)
-> Result
Filter: ((NULL::integer) IS DISTINCT FROM 1)
-> Result
@@ -944,20 +941,11 @@ explain (costs off)
-> Gather Motion 3:1 (slice3; segments: 3)
-> Partial Aggregate
-> Shared Scan (share slice:id 3:0)
- -> GroupAggregate
- Group Key: share0_ref3.a
- -> Sort
- Sort Key: share0_ref3.a
- -> Result
- Filter: (share0_ref3.a IS DISTINCT FROM 1)
- -> Shared Scan (share slice:id 1:0)
Optimizer: Pivotal Optimizer (GPORCA)
(24 rows)
select v.c, (select count(*) from gstest2 group by () having v.c)
from (values (false),(true)) v(c) order by v.c;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: {TARGETENTRY :expr {VAR :varno 1 :varattno 2 :vartype 20 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 2 :location -1} :resno 1 :resname count :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false}
c | count
---+-------
f |
@@ -967,8 +955,6 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
explain (costs off)
select v.c, (select count(*) from gstest2 group by () having v.c)
from (values (false),(true)) v(c) order by v.c;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: {TARGETENTRY :expr {VAR :varno 1 :varattno 2 :vartype 20 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 2 :location -1} :resno 1 :resname count :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false}
QUERY PLAN
--------------------------------------------------------------------------
Sort
@@ -1676,15 +1662,12 @@ explain (costs off)
-> Sort
Sort Key: share0_ref2.a, share0_ref2.b
-> Shared Scan (share slice:id 1:0)
- -> GroupAggregate
+ -> HashAggregate
Group Key: share0_ref3.b
- -> Sort
- Sort Key: share0_ref3.b
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: share0_ref3.b
- -> Streaming Partial HashAggregate
- Group Key: share0_ref3.b
- -> Shared Scan (share slice:id 2:0)
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: share0_ref3.b
+ -> Result
+ -> Shared Scan (share slice:id 2:0)
-> HashAggregate
Group Key: share0_ref4.a
-> Shared Scan (share slice:id 1:0)
@@ -1695,7 +1678,7 @@ explain (costs off)
-> Partial Aggregate
-> Shared Scan (share slice:id 4:0)
Optimizer: Pivotal Optimizer (GPORCA)
-(36 rows)
+(33 rows)
select a, b, sum(v.x)
from (values (1),(2)) v(x), gstest_data(v.x)
diff --git a/src/test/regress/expected/insert_conflict.out b/src/test/regress/expected/insert_conflict.out
index 16e41bedf7..bd1c9fb5d1 100644
--- a/src/test/regress/expected/insert_conflict.out
+++ b/src/test/regress/expected/insert_conflict.out
@@ -257,7 +257,9 @@ explain (costs off, format json) insert into insertconflicttest values (0, 'Bilb
} +
] +
}, +
- "Optimizer": "Postgres-based planner" +
+ "Settings": { +
+ "Optimizer": "Postgres query optimizer" +
+ } +
} +
]
(1 row)
diff --git a/src/test/regress/expected/join_optimizer.out b/src/test/regress/expected/join_optimizer.out
index 586354edb1..22bda0940c 100644
--- a/src/test/regress/expected/join_optimizer.out
+++ b/src/test/regress/expected/join_optimizer.out
@@ -3770,14 +3770,14 @@ select unique1, x from tenk1 join f_immutable_int4(1) x on unique1 = x;
explain (costs off)
select unique1, x from tenk1 left join f_immutable_int4(1) x on unique1 = x;
- QUERY PLAN
-------------------------------------------------
- Hash Left Join
- Hash Cond: (unique1 = (1))
- -> Gather Motion 3:1 (slice1; segments: 3)
+ QUERY PLAN
+------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Hash Left Join
+ Hash Cond: (unique1 = (1))
-> Seq Scan on tenk1
- -> Hash
- -> Result
+ -> Hash
+ -> Result
Optimizer: Pivotal Optimizer (GPORCA)
(7 rows)
@@ -3836,26 +3836,24 @@ from nt3 as nt3
) as ss2
on ss2.id = nt3.nt2_id
where nt3.id = 1 and ss2.b3;
- QUERY PLAN
-------------------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Hash Join
- Hash Cond: (nt2.id = nt3.nt2_id)
- -> Redistribute Motion 1:3 (slice2)
+ QUERY PLAN
+---------------------------------------------------------
+ Hash Join
+ Hash Cond: (nt3.nt2_id = nt2.id)
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Index Scan using nt3_pkey on nt3
+ Index Cond: (id = 1)
+ -> Hash
+ -> Gather Motion 3:1 (slice2; segments: 3)
-> Result
Filter: (nt2.b1 OR ((0) = 42))
-> Hash Left Join
Hash Cond: (nt2.nt1_id = (0))
- -> Gather Motion 3:1 (slice3; segments: 3)
- -> Seq Scan on nt2
+ -> Seq Scan on nt2
-> Hash
-> Result
- -> Hash
- -> Broadcast Motion 3:3 (slice4; segments: 3)
- -> Index Scan using nt3_pkey on nt3
- Index Cond: (id = 1)
Optimizer: Pivotal Optimizer (GPORCA)
-(17 rows)
+(15 rows)
drop function f_immutable_int4(int);
-- test inlining when function returns composite
@@ -7063,8 +7061,8 @@ where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1;
explain (costs off) select * from j1
inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2
where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1 and j2.id1 = any (array[1]);
- QUERY PLAN
--------------------------------------------------------------------------------
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
-> Nested Loop
Join Filter: true
@@ -7072,8 +7070,8 @@ where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1 and j2.id1 = any (array[1]);
Index Cond: (id1 = 1)
Filter: ((id1 % 1000) = 1)
-> Index Scan using j2_pkey on j2
- Index Cond: ((id1 = j1.id1) AND (id1 = 1) AND (id2 = j1.id2))
- Filter: (((id1 % 1000) = 1) AND (id1 = ANY ('{1}'::integer[])))
+ Index Cond: ((id1 = j1.id1) AND (id1 = ANY ('{1}'::integer[])) AND (id1 = 1) AND (id2 = j1.id2))
+ Filter: ((id1 % 1000) = 1)
Optimizer: Pivotal Optimizer (GPORCA)
(10 rows)
@@ -7090,21 +7088,19 @@ where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1 and j2.id1 = any (array[1]);
explain (costs off) select * from j1
inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2
where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1 and j2.id1 >= any (array[1,5]);
- QUERY PLAN
--------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
-> Nested Loop
Join Filter: true
- -> Bitmap Heap Scan on j2
- Recheck Cond: (id1 >= ANY ('{1,5}'::integer[]))
+ -> Index Scan using j2_pkey on j2
+ Index Cond: (id1 >= ANY ('{1,5}'::integer[]))
Filter: ((id1 % 1000) = 1)
- -> Bitmap Index Scan on j2_pkey
- Index Cond: (id1 >= ANY ('{1,5}'::integer[]))
-> Index Scan using j1_pkey on j1
Index Cond: ((id1 = j2.id1) AND (id2 = j2.id2))
Filter: ((id1 % 1000) = 1)
Optimizer: Pivotal Optimizer (GPORCA)
-(12 rows)
+(10 rows)
select * from j1
inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2
diff --git a/src/test/regress/expected/orca_groupingsets_fallbacks.out b/src/test/regress/expected/orca_groupingsets_fallbacks.out
index d649d950b5..80ba0ffe85 100644
--- a/src/test/regress/expected/orca_groupingsets_fallbacks.out
+++ b/src/test/regress/expected/orca_groupingsets_fallbacks.out
@@ -82,13 +82,15 @@ select d from gstest2 group by grouping sets ((a,b), (a));
(4 rows)
-- Orca falls back due to HAVING clause with outer references
+-- start_ignore
+-- The output with relid will not be the same.
select v.c, (select count(*) from gstest1 group by () having v.c) from (values (false),(true)) v(c);
c | count
---+-------
f |
t | 4
(2 rows)
-
+-- end_ignore
-- Orca falls back due to grouping function with multiple arguments
select a, b, grouping(a,b), sum(v), count(*), max(v) from gstest1 group by rollup (a,b);
a | b | grouping | sum | count | max
diff --git a/src/test/regress/expected/orca_groupingsets_fallbacks_optimizer.out b/src/test/regress/expected/orca_groupingsets_fallbacks_optimizer.out
index c98f72b241..bc3b10b3b5 100644
--- a/src/test/regress/expected/orca_groupingsets_fallbacks_optimizer.out
+++ b/src/test/regress/expected/orca_groupingsets_fallbacks_optimizer.out
@@ -90,15 +90,17 @@ DETAIL: Query-to-DXL Translation: No attribute entry found due to incorrect nor
(4 rows)
-- Orca falls back due to HAVING clause with outer references
+-- start_ignore
+-- The output with relid will not be the same.
select v.c, (select count(*) from gstest1 group by () having v.c) from (values (false),(true)) v(c);
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: {TARGETENTRY :expr {VAR :varno 1 :varattno 2 :vartype 20 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 2 :location -1} :resno 1 :resname count :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false}
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ({RTE :alias <> :eref {ALIAS :aliasname gstest1 :colnames ("a" "b" "c" "d" "v")} :rtekind 0 :relisivm false :relid 75942 :relkind r :rellockmode 1 :tablesample <> :lateral false :inh true :inFromCl true :requiredPerms 2 :checkAsUser 0 :selectedCols (b) :insertedCols (b) :updatedCols (b) :extraUpdatedCols (b) :securityQuals <> :forceDistRandom false})
c | count
---+-------
f |
t | 4
(2 rows)
-
+-- end_ignore
-- Orca falls back due to grouping function with multiple arguments
select a, b, grouping(a,b), sum(v), count(*), max(v) from gstest1 group by rollup (a,b);
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
diff --git a/src/test/regress/expected/privileges.out b/src/test/regress/expected/privileges.out
index 0044eef86f..b9dfc3116e 100644
--- a/src/test/regress/expected/privileges.out
+++ b/src/test/regress/expected/privileges.out
@@ -162,6 +162,9 @@ SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) );
------+------
(0 rows)
+-- test ctas
+create table atest2_ctas_ok as select col1 from atest2
+where col1 in (select distinct b from atest1); -- ok
SET SESSION AUTHORIZATION regress_priv_user6;
SELECT * FROM atest1; -- ok
a | b
@@ -192,9 +195,6 @@ DELETE FROM pg_catalog.pg_class; -- fail
ERROR: permission denied: "pg_class" is a system catalog
UPDATE pg_toast.pg_toast_1213 SET chunk_id = 1; -- fail
ERROR: permission denied: "pg_toast_1213" is a system catalog
--- test ctas
-create table atest2_ctas_ok as select col1 from atest2
-where col1 in (select distinct b from atest1); -- ok
SET SESSION AUTHORIZATION regress_priv_user3;
SELECT session_user, current_user;
session_user | current_user
diff --git a/src/test/regress/expected/privileges_optimizer.out b/src/test/regress/expected/privileges_optimizer.out
deleted file mode 100644
index fe66d5e013..0000000000
--- a/src/test/regress/expected/privileges_optimizer.out
+++ /dev/null
@@ -1,2612 +0,0 @@
---
--- Test access privileges
---
--- start_matchsubs
--- m/DETAIL: Failing row contains \(.*\) = \(.*\)/
--- s/DETAIL: Failing row contains \(.*\) = \(.*\)/DETAIL: Failing row contains (#####)/
--- end_matchsubs
-set optimizer_trace_fallback = on;
-set enable_nestloop=on;
-set optimizer_enable_nljoin = on;
--- Clean up in case a prior regression run failed
--- Suppress NOTICE messages when users/groups don't exist
-SET client_min_messages TO 'warning';
-DROP ROLE IF EXISTS regress_priv_group1;
-DROP ROLE IF EXISTS regress_priv_group2;
-DROP ROLE IF EXISTS regress_priv_user1;
-DROP ROLE IF EXISTS regress_priv_user2;
-DROP ROLE IF EXISTS regress_priv_user3;
-DROP ROLE IF EXISTS regress_priv_user4;
-DROP ROLE IF EXISTS regress_priv_user5;
-DROP ROLE IF EXISTS regress_priv_user6;
--- start_ignore
-SELECT lo_unlink(oid) FROM pg_largeobject_metadata WHERE oid >= 1000 AND oid < 3000 ORDER BY oid;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
- lo_unlink
------------
-(0 rows)
-
--- end_ignore
-RESET client_min_messages;
--- test proper begins here
-CREATE USER regress_priv_user1;
-CREATE USER regress_priv_user2;
-CREATE USER regress_priv_user3;
-CREATE USER regress_priv_user4;
-CREATE USER regress_priv_user5;
-CREATE USER regress_priv_user5; -- duplicate
-ERROR: role "regress_priv_user5" already exists
-CREATE GROUP regress_priv_group1;
-CREATE GROUP regress_priv_group2 WITH USER regress_priv_user1, regress_priv_user2;
-ALTER GROUP regress_priv_group1 ADD USER regress_priv_user4;
-ALTER GROUP regress_priv_group2 ADD USER regress_priv_user2; -- duplicate
-NOTICE: role "regress_priv_user2" is already a member of role "regress_priv_group2"
-ALTER GROUP regress_priv_group2 DROP USER regress_priv_user2;
-GRANT regress_priv_group2 TO regress_priv_user4 WITH ADMIN OPTION;
--- test owner privileges
-SET SESSION AUTHORIZATION regress_priv_user1;
-SELECT session_user, current_user;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: {SQLVALUEFUNCTION :op 12 :type 19 :typmod -1 :location 7}
- session_user | current_user
---------------------+--------------------
- regress_priv_user1 | regress_priv_user1
-(1 row)
-
-CREATE TABLE atest1 ( a int, b text ) distributed randomly;
-SELECT * FROM atest1;
- a | b
----+---
-(0 rows)
-
-INSERT INTO atest1 VALUES (1, 'one');
-DELETE FROM atest1;
-UPDATE atest1 SET a = 1 WHERE b = 'blech';
-TRUNCATE atest1;
-BEGIN;
-LOCK atest1 IN ACCESS EXCLUSIVE MODE;
-COMMIT;
-REVOKE ALL ON atest1 FROM PUBLIC;
-NOTICE: no privileges could be revoked
-SELECT * FROM atest1;
- a | b
----+---
-(0 rows)
-
-GRANT ALL ON atest1 TO regress_priv_user2;
-GRANT SELECT ON atest1 TO regress_priv_user3, regress_priv_user4;
-SELECT * FROM atest1;
- a | b
----+---
-(0 rows)
-
-CREATE TABLE atest2 (col1 varchar(10), col2 boolean);
-GRANT SELECT ON atest2 TO regress_priv_user2;
-GRANT UPDATE ON atest2 TO regress_priv_user3;
-GRANT INSERT ON atest2 TO regress_priv_user4;
-GRANT TRUNCATE ON atest2 TO regress_priv_user5;
-SET SESSION AUTHORIZATION regress_priv_user2;
-SELECT session_user, current_user;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: {SQLVALUEFUNCTION :op 12 :type 19 :typmod -1 :location 7}
- session_user | current_user
---------------------+--------------------
- regress_priv_user2 | regress_priv_user2
-(1 row)
-
--- try various combinations of queries on atest1 and atest2
-SELECT * FROM atest1; -- ok
- a | b
----+---
-(0 rows)
-
-SELECT * FROM atest2; -- ok
- col1 | col2
-------+------
-(0 rows)
-
-INSERT INTO atest1 VALUES (2, 'two'); -- ok
-INSERT INTO atest2 VALUES ('foo', true); -- fail
-ERROR: permission denied for table atest2
-INSERT INTO atest1 SELECT 1, b FROM atest1; -- ok
-UPDATE atest1 SET a = 1 WHERE a = 2; -- ok
-UPDATE atest2 SET col2 = NOT col2; -- fail
-ERROR: permission denied for table atest2
-SELECT * FROM atest1 FOR UPDATE; -- ok
- a | b
----+-----
- 1 | two
- 1 | two
-(2 rows)
-
-SELECT * FROM atest2 FOR UPDATE; -- fail
-ERROR: permission denied for table atest2
-DELETE FROM atest2; -- fail
-ERROR: permission denied for table atest2
-TRUNCATE atest2; -- fail
-ERROR: permission denied for table atest2
-BEGIN;
-LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- fail
-ERROR: permission denied for table atest2
-COMMIT;
-COPY atest2 FROM stdin; -- fail
-ERROR: permission denied for table atest2
-GRANT ALL ON atest1 TO PUBLIC; -- fail
-WARNING: no privileges were granted for "atest1"
--- checks in subquery, both ok
-SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) );
- a | b
----+---
-(0 rows)
-
-SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) );
- col1 | col2
-------+------
-(0 rows)
-
--- test ctas
-create table atest2_ctas_ok as select col1 from atest2
-where col1 in (select distinct b from atest1); -- ok
-SET SESSION AUTHORIZATION regress_priv_user3;
-SELECT session_user, current_user;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: {SQLVALUEFUNCTION :op 12 :type 19 :typmod -1 :location 7}
- session_user | current_user
---------------------+--------------------
- regress_priv_user3 | regress_priv_user3
-(1 row)
-
-create table atest2_ctas_fail as select col1 from atest2
-where col1 in (select distinct b from atest1); -- fail
-ERROR: permission denied for table atest2
-SELECT * FROM atest1; -- ok
- a | b
----+-----
- 1 | two
- 1 | two
-(2 rows)
-
-SELECT * FROM atest2; -- fail
-ERROR: permission denied for table atest2
-INSERT INTO atest1 VALUES (2, 'two'); -- fail
-ERROR: permission denied for table atest1
-INSERT INTO atest2 VALUES ('foo', true); -- fail
-ERROR: permission denied for table atest2
-INSERT INTO atest1 SELECT 1, b FROM atest1; -- fail
-ERROR: permission denied for table atest1
-UPDATE atest1 SET a = 1 WHERE a = 2; -- fail
-ERROR: permission denied for table atest1
-UPDATE atest2 SET col2 = NULL; -- ok
-UPDATE atest2 SET col2 = NOT col2; -- fails; requires SELECT on atest2
-ERROR: permission denied for table atest2
-UPDATE atest2 SET col2 = true FROM atest1 WHERE atest1.a = 5; -- ok
-SELECT * FROM atest1 FOR UPDATE; -- fail
-ERROR: permission denied for table atest1
-SELECT * FROM atest2 FOR UPDATE; -- fail
-ERROR: permission denied for table atest2
-DELETE FROM atest2; -- fail
-ERROR: permission denied for table atest2
-TRUNCATE atest2; -- fail
-ERROR: permission denied for table atest2
-BEGIN;
-LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- ok
-COMMIT;
-COPY atest2 FROM stdin; -- fail
-ERROR: permission denied for table atest2
--- checks in subquery, both fail
-SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) );
-ERROR: permission denied for table atest2
-SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) );
-ERROR: permission denied for table atest2
-SET SESSION AUTHORIZATION regress_priv_user4;
-COPY atest2 FROM stdin; -- ok
-SELECT * FROM atest1; -- ok
- a | b
----+-----
- 1 | two
- 1 | two
-(2 rows)
-
--- test leaky-function protections in selfuncs
--- regress_priv_user1 will own a table and provide views for it.
-SET SESSION AUTHORIZATION regress_priv_user1;
-CREATE TABLE atest12 as
- SELECT x AS a, 10001 - x AS b FROM generate_series(1,10000) x distributed by (a);
-CREATE INDEX ON atest12 (a);
-CREATE INDEX ON atest12 (abs(a));
-VACUUM ANALYZE atest12;
-CREATE FUNCTION leak(integer,integer) RETURNS boolean
- AS $$begin return $1 < $2; end$$
- LANGUAGE plpgsql immutable;
-CREATE OPERATOR <<< (procedure = leak, leftarg = integer, rightarg = integer,
- restrict = scalarltsel);
--- views with leaky operator
-CREATE VIEW atest12v AS
- SELECT * FROM atest12 WHERE b <<< 5;
-CREATE VIEW atest12sbv WITH (security_barrier=true) AS
- SELECT * FROM atest12 WHERE b <<< 5;
-GRANT SELECT ON atest12v TO PUBLIC;
-GRANT SELECT ON atest12sbv TO PUBLIC;
--- This plan should use nestloop, knowing that few rows will be selected.
-EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b;
- QUERY PLAN
-------------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Hash Join
- Hash Cond: (atest12.a = atest12_1.b)
- -> Seq Scan on atest12
- Filter: (b <<< 5)
- -> Hash
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: atest12_1.b
- -> Seq Scan on atest12 atest12_1
- Filter: (b <<< 5)
- Optimizer: Pivotal Optimizer (GPORCA)
-(11 rows)
-
--- And this one.
-EXPLAIN (COSTS OFF) SELECT * FROM atest12 x, atest12 y
- WHERE x.a = y.b and abs(y.a) <<< 5;
- QUERY PLAN
-------------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Hash Join
- Hash Cond: (atest12.a = atest12_1.b)
- -> Seq Scan on atest12
- -> Hash
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: atest12_1.b
- -> Seq Scan on atest12 atest12_1
- Filter: (abs(a) <<< 5)
- Optimizer: Pivotal Optimizer (GPORCA)
-(10 rows)
-
--- This should also be a nestloop, but the security barrier forces the inner
--- scan to be materialized
-EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: views with security_barrier ON
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: GPDB Expression type: Query Parameter not supported in DXL
- QUERY PLAN
-------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Nested Loop
- Join Filter: (atest12_1.a = atest12.b)
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: atest12.b
- -> Seq Scan on atest12
- Filter: (b <<< 5)
- -> Materialize
- -> Seq Scan on atest12 atest12_1
- Filter: (b <<< 5)
- Optimizer: Postgres query optimizer
-(11 rows)
-
--- Check if regress_priv_user2 can break security.
-SET SESSION AUTHORIZATION regress_priv_user2;
-CREATE FUNCTION leak2(integer,integer) RETURNS boolean
- AS $$begin raise notice 'leak % %', $1, $2; return $1 > $2; end$$
- LANGUAGE plpgsql immutable;
-CREATE OPERATOR >>> (procedure = leak2, leftarg = integer, rightarg = integer,
- restrict = scalargtsel);
--- This should not show any "leak" notices before failing.
-EXPLAIN (COSTS OFF) SELECT * FROM atest12 WHERE a >>> 0;
-ERROR: permission denied for table atest12
--- These plans should continue to use a nestloop, since they execute with the
--- privileges of the view owner.
-EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b;
- QUERY PLAN
-------------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Hash Join
- Hash Cond: (atest12.a = atest12_1.b)
- -> Seq Scan on atest12
- Filter: (b <<< 5)
- -> Hash
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: atest12_1.b
- -> Seq Scan on atest12 atest12_1
- Filter: (b <<< 5)
- Optimizer: Pivotal Optimizer (GPORCA)
-(11 rows)
-
--- reset the plan cache, sometimes it would re-plan these prepared statements and log ORCA fallbacks
-discard plans;
-EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: views with security_barrier ON
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: GPDB Expression type: Query Parameter not supported in DXL
- QUERY PLAN
-------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Nested Loop
- Join Filter: (atest12_1.a = atest12.b)
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: atest12.b
- -> Seq Scan on atest12
- Filter: (b <<< 5)
- -> Materialize
- -> Seq Scan on atest12 atest12_1
- Filter: (b <<< 5)
- Optimizer: Postgres query optimizer
-(11 rows)
-
--- A non-security barrier view does not guard against information leakage.
-EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y
- WHERE x.a = y.b and abs(y.a) <<< 5;
- QUERY PLAN
-------------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Hash Join
- Hash Cond: (atest12.a = atest12_1.b)
- -> Seq Scan on atest12
- Filter: (b <<< 5)
- -> Hash
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: atest12_1.b
- -> Seq Scan on atest12 atest12_1
- Filter: ((b <<< 5) AND (abs(a) <<< 5))
- Optimizer: Pivotal Optimizer (GPORCA)
-(11 rows)
-
--- But a security barrier view isolates the leaky operator.
-EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y
- WHERE x.a = y.b and abs(y.a) <<< 5;
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: views with security_barrier ON
- QUERY PLAN
-------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Nested Loop
- Join Filter: (atest12_1.a = y.b)
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: y.b
- -> Subquery Scan on y
- Filter: (abs(y.a) <<< 5)
- -> Seq Scan on atest12
- Filter: (b <<< 5)
- -> Materialize
- -> Seq Scan on atest12 atest12_1
- Filter: (b <<< 5)
- Optimizer: Postgres query optimizer
-(13 rows)
-
--- Now regress_priv_user1 grants sufficient access to regress_priv_user2.
-SET SESSION AUTHORIZATION regress_priv_user1;
-GRANT SELECT (a, b) ON atest12 TO PUBLIC;
-SET SESSION AUTHORIZATION regress_priv_user2;
--- regress_priv_user2 should continue to get a good row estimate.
-EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b;
- QUERY PLAN
-------------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Hash Join
- Hash Cond: (atest12.a = atest12_1.b)
- -> Seq Scan on atest12
- Filter: (b <<< 5)
- -> Hash
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: atest12_1.b
- -> Seq Scan on atest12 atest12_1
- Filter: (b <<< 5)
- Optimizer: Pivotal Optimizer (GPORCA)
-(11 rows)
-
--- But not for this, due to lack of table-wide permissions needed
--- to make use of the expression index's statistics.
-EXPLAIN (COSTS OFF) SELECT * FROM atest12 x, atest12 y
- WHERE x.a = y.b and abs(y.a) <<< 5;
- QUERY PLAN
-------------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3)
- -> Hash Join
- Hash Cond: (atest12.a = atest12_1.b)
- -> Seq Scan on atest12
- -> Hash
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: atest12_1.b
- -> Seq Scan on atest12 atest12_1
- Filter: (abs(a) <<< 5)
- Optimizer: Pivotal Optimizer (GPORCA)
-(10 rows)
-
--- clean up (regress_priv_user1's objects are all dropped later)
-DROP FUNCTION leak2(integer, integer) CASCADE;
-NOTICE: drop cascades to operator >>>(integer,integer)
--- groups
-SET SESSION AUTHORIZATION regress_priv_user3;
-CREATE TABLE atest3 (one int, two int, three int);
-GRANT DELETE ON atest3 TO GROUP regress_priv_group2;
-SET SESSION AUTHORIZATION regress_priv_user1;
-SELECT * FROM atest3; -- fail
-ERROR: permission denied for table atest3
-DELETE FROM atest3; -- ok
-BEGIN;
-RESET SESSION AUTHORIZATION;
-ALTER ROLE regress_priv_user1 NOINHERIT;
-SET SESSION AUTHORIZATION regress_priv_user1;
-DELETE FROM atest3;
-ERROR: permission denied for table atest3
-ROLLBACK;
--- views
-SET SESSION AUTHORIZATION regress_priv_user3;
-CREATE VIEW atestv1 AS SELECT * FROM atest1; -- ok
-/* The next *should* fail, but it's not implemented that way yet. */
-CREATE VIEW atestv2 AS SELECT * FROM atest2;
-CREATE VIEW atestv3 AS SELECT * FROM atest3; -- ok
-/* Empty view is a corner case that failed in 9.2. */
-CREATE VIEW atestv0 AS SELECT 0 as x WHERE false; -- ok
-SELECT * FROM atestv1; -- ok
- a | b
----+-----
- 1 | two
- 1 | two
-(2 rows)
-
-SELECT * FROM atestv2; -- fail
-ERROR: permission denied for table atest2
-GRANT SELECT ON atestv1, atestv3 TO regress_priv_user4;
-GRANT SELECT ON atestv2 TO regress_priv_user2;
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT * FROM atestv1; -- ok
- a | b
----+-----
- 1 | two
- 1 | two
-(2 rows)
-
-SELECT * FROM atestv2; -- fail
-ERROR: permission denied for view atestv2
-SELECT * FROM atestv3; -- ok
- one | two | three
------+-----+-------
-(0 rows)
-
-SELECT * FROM atestv0; -- fail
-ERROR: permission denied for view atestv0
--- Appendrels excluded by constraints failed to check permissions in 8.4-9.2.
-select * from
- ((select a.q1 as x from int8_tbl a offset 0)
- union all
- (select b.q2 as x from int8_tbl b offset 0)) ss
-where false;
-ERROR: permission denied for table int8_tbl
-set constraint_exclusion = on;
-select * from
- ((select a.q1 as x, random() from int8_tbl a where q1 > 0)
- union all
- (select b.q2 as x, random() from int8_tbl b where q2 > 0)) ss
-where x < 0;
-ERROR: permission denied for table int8_tbl
-reset constraint_exclusion;
-CREATE VIEW atestv4 AS SELECT * FROM atestv3; -- nested view
-SELECT * FROM atestv4; -- ok
- one | two | three
------+-----+-------
-(0 rows)
-
-GRANT SELECT ON atestv4 TO regress_priv_user2;
-SET SESSION AUTHORIZATION regress_priv_user2;
--- Two complex cases:
-SELECT * FROM atestv3; -- fail
-ERROR: permission denied for view atestv3
-SELECT * FROM atestv4; -- ok (even though regress_priv_user2 cannot access underlying atestv3)
- one | two | three
------+-----+-------
-(0 rows)
-
-SELECT * FROM atest2; -- ok
- col1 | col2
-------+------
- bar | t
-(1 row)
-
-SELECT * FROM atestv2; -- fail (even though regress_priv_user2 can access underlying atest2)
-ERROR: permission denied for table atest2
--- Test column level permissions
-SET SESSION AUTHORIZATION regress_priv_user1;
-CREATE TABLE atest5 (one int, two int unique, three int, four int unique) distributed replicated;
-CREATE TABLE atest6 (one int, two int, blue int);
-GRANT SELECT (one), INSERT (two), UPDATE (three) ON atest5 TO regress_priv_user4;
-GRANT ALL (one) ON atest5 TO regress_priv_user3;
-INSERT INTO atest5 VALUES (1,2,3);
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT * FROM atest5; -- fail
-ERROR: permission denied for table atest5
-SELECT one FROM atest5; -- ok
- one
------
- 1
-(1 row)
-
-COPY atest5 (one) TO stdout; -- ok
-1
-SELECT two FROM atest5; -- fail
-ERROR: permission denied for table atest5
-COPY atest5 (two) TO stdout; -- fail
-ERROR: permission denied for table atest5
-SELECT atest5 FROM atest5; -- fail
-ERROR: permission denied for table atest5
-COPY atest5 (one,two) TO stdout; -- fail
-ERROR: permission denied for table atest5
-SELECT 1 FROM atest5; -- ok
- ?column?
-----------
- 1
-(1 row)
-
-SELECT 1 FROM atest5 a JOIN atest5 b USING (one); -- ok
- ?column?
-----------
- 1
-(1 row)
-
-SELECT 1 FROM atest5 a JOIN atest5 b USING (two); -- fail
-ERROR: permission denied for table atest5
-SELECT 1 FROM atest5 a NATURAL JOIN atest5 b; -- fail
-ERROR: permission denied for table atest5
-SELECT (j.*) IS NULL FROM (atest5 a JOIN atest5 b USING (one)) j; -- fail
-ERROR: permission denied for table atest5
-SELECT 1 FROM atest5 WHERE two = 2; -- fail
-ERROR: permission denied for table atest5
-SELECT * FROM atest1, atest5; -- fail
-ERROR: permission denied for table atest5
-SELECT atest1.* FROM atest1, atest5; -- ok
- a | b
----+-----
- 1 | two
- 1 | two
-(2 rows)
-
-SELECT atest1.*,atest5.one FROM atest1, atest5; -- ok
- a | b | one
----+-----+-----
- 1 | two | 1
- 1 | two | 1
-(2 rows)
-
-SELECT atest1.*,atest5.one FROM atest1 JOIN atest5 ON (atest1.a = atest5.two); -- fail
-ERROR: permission denied for table atest5
-SELECT atest1.*,atest5.one FROM atest1 JOIN atest5 ON (atest1.a = atest5.one); -- ok
- a | b | one
----+-----+-----
- 1 | two | 1
- 1 | two | 1
-(2 rows)
-
-SELECT one, two FROM atest5; -- fail
-ERROR: permission denied for table atest5
-SET SESSION AUTHORIZATION regress_priv_user1;
-GRANT SELECT (one,two) ON atest6 TO regress_priv_user4;
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT one, two FROM atest5 NATURAL JOIN atest6; -- fail still
-ERROR: permission denied for table atest5
-SET SESSION AUTHORIZATION regress_priv_user1;
-GRANT SELECT (two) ON atest5 TO regress_priv_user4;
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT one, two FROM atest5 NATURAL JOIN atest6; -- ok now
- one | two
------+-----
-(0 rows)
-
--- test column-level privileges for INSERT and UPDATE
-INSERT INTO atest5 (two) VALUES (3); -- ok
-COPY atest5 FROM stdin; -- fail
-ERROR: permission denied for table atest5
-COPY atest5 (two) FROM stdin; -- ok
-INSERT INTO atest5 (three) VALUES (4); -- fail
-ERROR: permission denied for table atest5
-INSERT INTO atest5 VALUES (5,5,5); -- fail
-ERROR: permission denied for table atest5
-UPDATE atest5 SET three = 10; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Operator Update on replicated tables not supported
-UPDATE atest5 SET one = 8; -- fail
-ERROR: permission denied for table atest5
-UPDATE atest5 SET three = 5, one = 2; -- fail
-ERROR: permission denied for table atest5
--- Check that column level privs are enforced in RETURNING
--- Ok.
-INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = 10;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ON CONFLICT clause
--- Error. No SELECT on column three.
-INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = 10 RETURNING atest5.three;
-ERROR: permission denied for table atest5
--- Ok. May SELECT on column "one":
-INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = 10 RETURNING atest5.one;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: RETURNING clause
- one
------
-
-(1 row)
-
--- Check that column level privileges are enforced for EXCLUDED
--- Ok. we may select one
-INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = EXCLUDED.one;
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ON CONFLICT clause
--- Error. No select rights on three
-INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = EXCLUDED.three;
-ERROR: permission denied for table atest5
-INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set one = 8; -- fails (due to UPDATE)
-ERROR: permission denied for table atest5
-INSERT INTO atest5(three) VALUES (4) ON CONFLICT (two) DO UPDATE set three = 10; -- fails (due to INSERT)
-ERROR: permission denied for table atest5
--- Check that the columns in the inference require select privileges
-INSERT INTO atest5(four) VALUES (4); -- fail
-ERROR: permission denied for table atest5
-SET SESSION AUTHORIZATION regress_priv_user1;
-GRANT INSERT (four) ON atest5 TO regress_priv_user4;
-SET SESSION AUTHORIZATION regress_priv_user4;
-INSERT INTO atest5(four) VALUES (4) ON CONFLICT (four) DO UPDATE set three = 3; -- fails (due to SELECT)
-ERROR: permission denied for table atest5
-INSERT INTO atest5(four) VALUES (4) ON CONFLICT ON CONSTRAINT atest5_four_key DO UPDATE set three = 3; -- fails (due to SELECT)
-ERROR: permission denied for table atest5
-INSERT INTO atest5(four) VALUES (4); -- ok
-SET SESSION AUTHORIZATION regress_priv_user1;
-GRANT SELECT (four) ON atest5 TO regress_priv_user4;
-SET SESSION AUTHORIZATION regress_priv_user4;
-INSERT INTO atest5(four) VALUES (4) ON CONFLICT (four) DO UPDATE set three = 3; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ON CONFLICT clause
-INSERT INTO atest5(four) VALUES (4) ON CONFLICT ON CONSTRAINT atest5_four_key DO UPDATE set three = 3; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ON CONFLICT clause
-SET SESSION AUTHORIZATION regress_priv_user1;
-REVOKE ALL (one) ON atest5 FROM regress_priv_user4;
-GRANT SELECT (one,two,blue) ON atest6 TO regress_priv_user4;
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT one FROM atest5; -- fail
-ERROR: permission denied for table atest5
-UPDATE atest5 SET one = 1; -- fail
-ERROR: permission denied for table atest5
-SELECT atest6 FROM atest6; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Whole-row variable
- atest6
---------
-(0 rows)
-
-COPY atest6 TO stdout; -- ok
--- check error reporting with column privs
-SET SESSION AUTHORIZATION regress_priv_user1;
-CREATE TABLE t1 (c1 int, c2 int, c3 int check (c3 < 5), primary key (c1, c2));
-GRANT SELECT (c1) ON t1 TO regress_priv_user2;
-GRANT INSERT (c1, c2, c3) ON t1 TO regress_priv_user2;
-GRANT UPDATE (c1, c2, c3) ON t1 TO regress_priv_user2;
--- seed data
-INSERT INTO t1 VALUES (1, 1, 1);
-INSERT INTO t1 VALUES (1, 2, 1);
-INSERT INTO t1 VALUES (2, 1, 2);
-INSERT INTO t1 VALUES (2, 2, 2);
-INSERT INTO t1 VALUES (3, 1, 3);
-SET SESSION AUTHORIZATION regress_priv_user2;
-INSERT INTO t1 (c1, c2) VALUES (1, 1); -- fail, but row not shown
-ERROR: duplicate key value violates unique constraint "t1_pkey"
-UPDATE t1 SET c2 = 1; -- fail, but row not shown
-ERROR: duplicate key value violates unique constraint "t1_pkey"
-INSERT INTO t1 (c1, c2) VALUES (null, null); -- fail, but see columns being inserted
-ERROR: null value in column "c1" violates not-null constraint
-DETAIL: Failing row contains (c1, c2) = (null, null).
-INSERT INTO t1 (c3) VALUES (null); -- fail, but see columns being inserted or have SELECT
-ERROR: null value in column "c1" violates not-null constraint
-DETAIL: Failing row contains (c1, c3) = (null, null).
-INSERT INTO t1 (c1) VALUES (5); -- fail, but see columns being inserted or have SELECT
-ERROR: null value in column "c2" violates not-null constraint
-DETAIL: Failing row contains (c1) = (5).
-UPDATE t1 SET c3 = 10; -- fail, but see columns with SELECT rights, or being modified
-ERROR: new row for relation "t1" violates check constraint "t1_c3_check"
-DETAIL: Failing row contains (c1, c3) = (1, 10).
-SET SESSION AUTHORIZATION regress_priv_user1;
-DROP TABLE t1;
--- check error reporting with column privs on a partitioned table
-CREATE TABLE errtst(a text, b text NOT NULL, c text, secret1 text, secret2 text) PARTITION BY LIST (a);
-CREATE TABLE errtst_part_1(secret2 text, c text, a text, b text NOT NULL, secret1 text) DISTRIBUTED BY (a);
-CREATE TABLE errtst_part_2(secret1 text, secret2 text, a text, c text, b text NOT NULL) DISTRIBUTED BY (a);
-ALTER TABLE errtst ATTACH PARTITION errtst_part_1 FOR VALUES IN ('aaa');
-ALTER TABLE errtst ATTACH PARTITION errtst_part_2 FOR VALUES IN ('aaaa');
-GRANT SELECT (a, b, c) ON TABLE errtst TO regress_priv_user2;
-GRANT UPDATE (a, b, c) ON TABLE errtst TO regress_priv_user2;
-GRANT INSERT (a, b, c) ON TABLE errtst TO regress_priv_user2;
-INSERT INTO errtst_part_1 (a, b, c, secret1, secret2)
-VALUES ('aaa', 'bbb', 'ccc', 'the body', 'is in the attic');
-SET SESSION AUTHORIZATION regress_priv_user2;
--- Perform a few updates that violate the NOT NULL constraint. Make sure
--- the error messages don't leak the secret fields.
--- simple insert.
-INSERT INTO errtst (a, b) VALUES ('aaa', NULL);
-ERROR: null value in column "b" violates not-null constraint
-DETAIL: Failing row contains (a, b, c) = (aaa, null, null).
--- simple update.
-UPDATE errtst SET b = NULL;
-ERROR: null value in column "b" violates not-null constraint
-DETAIL: Failing row contains (b) = (null).
--- partitioning key is updated, doesn't move the row.
-UPDATE errtst SET a = 'aaa', b = NULL;
-ERROR: null value in column "b" violates not-null constraint
-DETAIL: Failing row contains (a, b, c) = (aaa, null, ccc).
--- row is moved to another partition.
-UPDATE errtst SET a = 'aaaa', b = NULL;
-ERROR: null value in column "b" violates not-null constraint
-DETAIL: Failing row contains (a, b, c) = (aaaa, null, ccc).
--- row is moved to another partition. This differs from the previous case in
--- that the new partition is excluded by constraint exclusion, so its
--- ResultRelInfo is not created at ExecInitModifyTable, but needs to be
--- constructed on the fly when the updated tuple is routed to it.
-UPDATE errtst SET a = 'aaaa', b = NULL WHERE a = 'aaa';
-ERROR: null value in column "b" violates not-null constraint
-DETAIL: Failing row contains (a, b, c) = (aaaa, null, ccc).
-SET SESSION AUTHORIZATION regress_priv_user1;
-DROP TABLE errtst;
--- test column-level privileges when involved with DELETE
-SET SESSION AUTHORIZATION regress_priv_user1;
-ALTER TABLE atest6 ADD COLUMN three integer;
-GRANT DELETE ON atest5 TO regress_priv_user3;
-GRANT SELECT (two) ON atest5 TO regress_priv_user3;
-REVOKE ALL (one) ON atest5 FROM regress_priv_user3;
-GRANT SELECT (one) ON atest5 TO regress_priv_user4;
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT atest6 FROM atest6; -- fail
-ERROR: permission denied for table atest6
-SELECT one FROM atest5 NATURAL JOIN atest6; -- fail
-ERROR: permission denied for table atest5
-SET SESSION AUTHORIZATION regress_priv_user1;
-ALTER TABLE atest6 DROP COLUMN three;
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT atest6 FROM atest6; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Whole-row variable
- atest6
---------
-(0 rows)
-
-SELECT one FROM atest5 NATURAL JOIN atest6; -- ok
- one
------
-(0 rows)
-
-SET SESSION AUTHORIZATION regress_priv_user1;
-ALTER TABLE atest6 DROP COLUMN two;
-REVOKE SELECT (one,blue) ON atest6 FROM regress_priv_user4;
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT * FROM atest6; -- fail
-ERROR: permission denied for table atest6
-SELECT 1 FROM atest6; -- fail
-ERROR: permission denied for table atest6
-SET SESSION AUTHORIZATION regress_priv_user3;
-DELETE FROM atest5 WHERE one = 1; -- fail
-ERROR: permission denied for table atest5
-DELETE FROM atest5 WHERE two = 2; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Operator Delete on replicated tables not supported
--- check inheritance cases
-SET SESSION AUTHORIZATION regress_priv_user1;
-CREATE TABLE atestp1 (f1 int, f2 int);
-CREATE TABLE atestp2 (fx int, fy int);
-CREATE TABLE atestc (fz int) INHERITS (atestp1, atestp2);
-GRANT SELECT(fx,fy,tableoid) ON atestp2 TO regress_priv_user2;
-GRANT SELECT(fx) ON atestc TO regress_priv_user2;
-SET SESSION AUTHORIZATION regress_priv_user2;
-SELECT fx FROM atestp2; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
- fx
-----
-(0 rows)
-
-SELECT fy FROM atestp2; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
- fy
-----
-(0 rows)
-
-SELECT atestp2 FROM atestp2; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
- atestp2
----------
-(0 rows)
-
-SELECT tableoid FROM atestp2; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
- tableoid
-----------
-(0 rows)
-
-SELECT fy FROM atestc; -- fail
-ERROR: permission denied for table atestc
-SET SESSION AUTHORIZATION regress_priv_user1;
-GRANT SELECT(fy,tableoid) ON atestc TO regress_priv_user2;
-SET SESSION AUTHORIZATION regress_priv_user2;
-SELECT fx FROM atestp2; -- still ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
- fx
-----
-(0 rows)
-
-SELECT fy FROM atestp2; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
- fy
-----
-(0 rows)
-
-SELECT atestp2 FROM atestp2; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
- atestp2
----------
-(0 rows)
-
-SELECT tableoid FROM atestp2; -- ok
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables
- tableoid
-----------
-(0 rows)
-
--- privileges on functions, languages
--- switch to superuser
-\c -
-REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC;
-GRANT USAGE ON LANGUAGE sql TO regress_priv_user1; -- ok
-GRANT USAGE ON LANGUAGE c TO PUBLIC; -- fail
-ERROR: language "c" is not trusted
-DETAIL: GRANT and REVOKE are not allowed on untrusted languages, because only superusers can use untrusted languages.
-SET SESSION AUTHORIZATION regress_priv_user1;
-GRANT USAGE ON LANGUAGE sql TO regress_priv_user2; -- fail
-WARNING: no privileges were granted for "sql"
-CREATE FUNCTION priv_testfunc1(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql;
-CREATE FUNCTION priv_testfunc2(int) RETURNS int AS 'select 3 * $1;' LANGUAGE sql;
-CREATE AGGREGATE priv_testagg1(int) (sfunc = int4pl, stype = int4);
-CREATE PROCEDURE priv_testproc1(int) AS 'select $1;' LANGUAGE sql;
-REVOKE ALL ON FUNCTION priv_testfunc1(int), priv_testfunc2(int), priv_testagg1(int) FROM PUBLIC;
-GRANT EXECUTE ON FUNCTION priv_testfunc1(int), priv_testfunc2(int), priv_testagg1(int) TO regress_priv_user2;
-REVOKE ALL ON FUNCTION priv_testproc1(int) FROM PUBLIC; -- fail, not a function
-ERROR: priv_testproc1(integer) is not a function
-REVOKE ALL ON PROCEDURE priv_testproc1(int) FROM PUBLIC;
-GRANT EXECUTE ON PROCEDURE priv_testproc1(int) TO regress_priv_user2;
-GRANT USAGE ON FUNCTION priv_testfunc1(int) TO regress_priv_user3; -- semantic error
-ERROR: invalid privilege type USAGE for function
-GRANT USAGE ON FUNCTION priv_testagg1(int) TO regress_priv_user3; -- semantic error
-ERROR: invalid privilege type USAGE for function
-GRANT USAGE ON PROCEDURE priv_testproc1(int) TO regress_priv_user3; -- semantic error
-ERROR: invalid privilege type USAGE for procedure
-GRANT ALL PRIVILEGES ON FUNCTION priv_testfunc1(int) TO regress_priv_user4;
-GRANT ALL PRIVILEGES ON FUNCTION priv_testfunc_nosuch(int) TO regress_priv_user4;
-ERROR: function priv_testfunc_nosuch(integer) does not exist
-GRANT ALL PRIVILEGES ON FUNCTION priv_testagg1(int) TO regress_priv_user4;
-GRANT ALL PRIVILEGES ON PROCEDURE priv_testproc1(int) TO regress_priv_user4;
-CREATE FUNCTION priv_testfunc4(boolean) RETURNS text
- AS 'select col1 from atest2 where col2 = $1;'
- LANGUAGE sql SECURITY DEFINER;
-GRANT EXECUTE ON FUNCTION priv_testfunc4(boolean) TO regress_priv_user3;
-SET SESSION AUTHORIZATION regress_priv_user2;
-SELECT priv_testfunc1(5), priv_testfunc2(5); -- ok
- priv_testfunc1 | priv_testfunc2
-----------------+----------------
- 10 | 15
-(1 row)
-
-CREATE FUNCTION priv_testfunc3(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql; -- fail
-ERROR: permission denied for language sql
-SELECT priv_testagg1(x) FROM (VALUES (1), (2), (3)) _(x); -- ok
- priv_testagg1
----------------
- 6
-(1 row)
-
-CALL priv_testproc1(6); -- ok
-SET SESSION AUTHORIZATION regress_priv_user3;
-SELECT priv_testfunc1(5); -- fail
-ERROR: permission denied for function priv_testfunc1
-SELECT priv_testagg1(x) FROM (VALUES (1), (2), (3)) _(x); -- fail
-ERROR: permission denied for aggregate priv_testagg1
-CALL priv_testproc1(6); -- fail
-ERROR: permission denied for procedure priv_testproc1
-SELECT col1 FROM atest2 WHERE col2 = true; -- fail
-ERROR: permission denied for table atest2
-SELECT priv_testfunc4(true); -- ok
- priv_testfunc4
-----------------
- bar
-(1 row)
-
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT priv_testfunc1(5); -- ok
- priv_testfunc1
-----------------
- 10
-(1 row)
-
-SELECT priv_testagg1(x) FROM (VALUES (1), (2), (3)) _(x); -- ok
- priv_testagg1
----------------
- 6
-(1 row)
-
-CALL priv_testproc1(6); -- ok
-DROP FUNCTION priv_testfunc1(int); -- fail
-ERROR: must be owner of function priv_testfunc1
-DROP AGGREGATE priv_testagg1(int); -- fail
-ERROR: must be owner of aggregate priv_testagg1
-DROP PROCEDURE priv_testproc1(int); -- fail
-ERROR: must be owner of procedure priv_testproc1
-\c -
-DROP FUNCTION priv_testfunc1(int); -- ok
--- restore to sanity
-GRANT ALL PRIVILEGES ON LANGUAGE sql TO PUBLIC;
--- verify privilege checks on array-element coercions
-BEGIN;
-SELECT '{1}'::int4[]::int8[];
- int8
-------
- {1}
-(1 row)
-
-REVOKE ALL ON FUNCTION int8(integer) FROM PUBLIC;
-SELECT '{1}'::int4[]::int8[]; --superuser, succeed
- int8
-------
- {1}
-(1 row)
-
-SET SESSION AUTHORIZATION regress_priv_user4;
-SELECT '{1}'::int4[]::int8[]; --other user, fail
-ERROR: permission denied for function int8
-ROLLBACK;
--- privileges on types
--- switch to superuser
-\c -
-CREATE TYPE priv_testtype1 AS (a int, b text);
-REVOKE USAGE ON TYPE priv_testtype1 FROM PUBLIC;
-GRANT USAGE ON TYPE priv_testtype1 TO regress_priv_user2;
-GRANT USAGE ON TYPE _priv_testtype1 TO regress_priv_user2; -- fail
-ERROR: cannot set privileges of array types
-HINT: Set the privileges of the element type instead.
-GRANT USAGE ON DOMAIN priv_testtype1 TO regress_priv_user2; -- fail
-ERROR: "priv_testtype1" is not a domain
-CREATE DOMAIN priv_testdomain1 AS int;
-REVOKE USAGE on DOMAIN priv_testdomain1 FROM PUBLIC;
-GRANT USAGE ON DOMAIN priv_testdomain1 TO regress_priv_user2;
-GRANT USAGE ON TYPE priv_testdomain1 TO regress_priv_user2; -- ok
-SET SESSION AUTHORIZATION regress_priv_user1;
--- commands that should fail
-CREATE AGGREGATE priv_testagg1a(priv_testdomain1) (sfunc = int4_sum, stype = bigint);
-ERROR: permission denied for type priv_testdomain1
-CREATE DOMAIN priv_testdomain2a AS priv_testdomain1;
-ERROR: permission denied for type priv_testdomain1
-CREATE DOMAIN priv_testdomain3a AS int;
-CREATE FUNCTION castfunc(int) RETURNS priv_testdomain3a AS $$ SELECT $1::priv_testdomain3a $$ LANGUAGE SQL;
-CREATE CAST (priv_testdomain1 AS priv_testdomain3a) WITH FUNCTION castfunc(int);
-ERROR: permission denied for type priv_testdomain1
-DROP FUNCTION castfunc(int) CASCADE;
-DROP DOMAIN priv_testdomain3a;
-CREATE FUNCTION priv_testfunc5a(a priv_testdomain1) RETURNS int LANGUAGE SQL AS $$ SELECT $1 $$;
-ERROR: permission denied for type priv_testdomain1
-CREATE FUNCTION priv_testfunc6a(b int) RETURNS priv_testdomain1 LANGUAGE SQL AS $$ SELECT $1::priv_testdomain1 $$;
-ERROR: permission denied for type priv_testdomain1
-CREATE OPERATOR !+! (PROCEDURE = int4pl, LEFTARG = priv_testdomain1, RIGHTARG = priv_testdomain1);
-ERROR: permission denied for type priv_testdomain1
-CREATE TABLE test5a (a int, b priv_testdomain1);
-ERROR: permission denied for type priv_testdomain1
-CREATE TABLE test6a OF priv_testtype1;
-ERROR: permission denied for type priv_testtype1
-CREATE TABLE test10a (a int[], b priv_testtype1[]);
-ERROR: permission denied for type priv_testtype1
-CREATE TABLE test9a (a int, b int);
-ALTER TABLE test9a ADD COLUMN c priv_testdomain1;
-ERROR: permission denied for type priv_testdomain1
-ALTER TABLE test9a ALTER COLUMN b TYPE priv_testdomain1;
-ERROR: permission denied for type priv_testdomain1
-CREATE TYPE test7a AS (a int, b priv_testdomain1);
-ERROR: permission denied for type priv_testdomain1
-CREATE TYPE test8a AS (a int, b int);
-ALTER TYPE test8a ADD ATTRIBUTE c priv_testdomain1;
-ERROR: permission denied for type priv_testdomain1
-ALTER TYPE test8a ALTER ATTRIBUTE b TYPE priv_testdomain1;
-ERROR: permission denied for type priv_testdomain1
-CREATE TABLE test11a AS (SELECT 1::priv_testdomain1 AS a);
-ERROR: permission denied for type priv_testdomain1
-REVOKE ALL ON TYPE priv_testtype1 FROM PUBLIC;
-ERROR: permission denied for type priv_testtype1
-SET SESSION AUTHORIZATION regress_priv_user2;
--- commands that should succeed
-CREATE AGGREGATE priv_testagg1b(priv_testdomain1) (sfunc = int4_sum, stype = bigint);
-CREATE DOMAIN priv_testdomain2b AS priv_testdomain1;
-CREATE DOMAIN priv_testdomain3b AS int;
-CREATE FUNCTION castfunc(int) RETURNS priv_testdomain3b AS $$ SELECT $1::priv_testdomain3b $$ LANGUAGE SQL;
-CREATE CAST (priv_testdomain1 AS priv_testdomain3b) WITH FUNCTION castfunc(int);
-WARNING: cast will be ignored because the source data type is a domain
-CREATE FUNCTION priv_testfunc5b(a priv_testdomain1) RETURNS int LANGUAGE SQL AS $$ SELECT $1 $$;
-CREATE FUNCTION priv_testfunc6b(b int) RETURNS priv_testdomain1 LANGUAGE SQL AS $$ SELECT $1::priv_testdomain1 $$;
-CREATE OPERATOR !! (PROCEDURE = priv_testfunc5b, RIGHTARG = priv_testdomain1);
-CREATE TABLE test5b (a int, b priv_testdomain1);
-CREATE TABLE test6b OF priv_testtype1;
-CREATE TABLE test10b (a int[], b priv_testtype1[]);
-CREATE TABLE test9b (a int, b int);
-ALTER TABLE test9b ADD COLUMN c priv_testdomain1;
-ALTER TABLE test9b ALTER COLUMN b TYPE priv_testdomain1;
-CREATE TYPE test7b AS (a int, b priv_testdomain1);
-CREATE TYPE test8b AS (a int, b int);
-ALTER TYPE test8b ADD ATTRIBUTE c priv_testdomain1;
-ALTER TYPE test8b ALTER ATTRIBUTE b TYPE priv_testdomain1;
-CREATE TABLE test11b AS (SELECT 1::priv_testdomain1 AS a);
-REVOKE ALL ON TYPE priv_testtype1 FROM PUBLIC;
-WARNING: no privileges could be revoked for "priv_testtype1"
-NOTICE: no privileges could be revoked
-\c -
-DROP AGGREGATE priv_testagg1b(priv_testdomain1);
-DROP DOMAIN priv_testdomain2b;
-DROP OPERATOR !! (NONE, priv_testdomain1);
-DROP FUNCTION priv_testfunc5b(a priv_testdomain1);
-DROP FUNCTION priv_testfunc6b(b int);
-DROP TABLE test5b;
-DROP TABLE test6b;
-DROP TABLE test9b;
-DROP TABLE test10b;
-DROP TYPE test7b;
-DROP TYPE test8b;
-DROP CAST (priv_testdomain1 AS priv_testdomain3b);
-DROP FUNCTION castfunc(int) CASCADE;
-DROP DOMAIN priv_testdomain3b;
-DROP TABLE test11b;
-DROP TYPE priv_testtype1; -- ok
-DROP DOMAIN priv_testdomain1; -- ok
--- truncate
-SET SESSION AUTHORIZATION regress_priv_user5;
-TRUNCATE atest2; -- ok
-TRUNCATE atest3; -- fail
-ERROR: permission denied for table atest3
--- has_table_privilege function
--- bad-input checks
-select has_table_privilege(NULL,'pg_authid','select');
- has_table_privilege
----------------------
-
-(1 row)
-
-select has_table_privilege('pg_shad','select');
-ERROR: relation "pg_shad" does not exist
-select has_table_privilege('nosuchuser','pg_authid','select');
-ERROR: role "nosuchuser" does not exist
-select has_table_privilege('pg_authid','sel');
-ERROR: unrecognized privilege type: "sel"
-select has_table_privilege(-999999,'pg_authid','update');
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(1,'select');
- has_table_privilege
----------------------
-
-(1 row)
-
--- superuser
-\c -
-select has_table_privilege(current_user,'pg_authid','select');
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(current_user,'pg_authid','insert');
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t2.oid,'pg_authid','update')
-from (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t2.oid,'pg_authid','delete')
-from (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- t
-(1 row)
-
--- 'rule' privilege no longer exists, but for backwards compatibility
--- has_table_privilege still recognizes the keyword and says FALSE
-select has_table_privilege(current_user,t1.oid,'rule')
-from (select oid from pg_class where relname = 'pg_authid') as t1;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(current_user,t1.oid,'references')
-from (select oid from pg_class where relname = 'pg_authid') as t1;
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t2.oid,t1.oid,'select')
-from (select oid from pg_class where relname = 'pg_authid') as t1,
- (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t2.oid,t1.oid,'insert')
-from (select oid from pg_class where relname = 'pg_authid') as t1,
- (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege('pg_authid','update');
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege('pg_authid','delete');
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege('pg_authid','truncate');
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t1.oid,'select')
-from (select oid from pg_class where relname = 'pg_authid') as t1;
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t1.oid,'trigger')
-from (select oid from pg_class where relname = 'pg_authid') as t1;
- has_table_privilege
----------------------
- t
-(1 row)
-
--- non-superuser
-SET SESSION AUTHORIZATION regress_priv_user3;
-select has_table_privilege(current_user,'pg_class','select');
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(current_user,'pg_class','insert');
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(t2.oid,'pg_class','update')
-from (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(t2.oid,'pg_class','delete')
-from (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(current_user,t1.oid,'references')
-from (select oid from pg_class where relname = 'pg_class') as t1;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(t2.oid,t1.oid,'select')
-from (select oid from pg_class where relname = 'pg_class') as t1,
- (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t2.oid,t1.oid,'insert')
-from (select oid from pg_class where relname = 'pg_class') as t1,
- (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege('pg_class','update');
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege('pg_class','delete');
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege('pg_class','truncate');
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(t1.oid,'select')
-from (select oid from pg_class where relname = 'pg_class') as t1;
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t1.oid,'trigger')
-from (select oid from pg_class where relname = 'pg_class') as t1;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(current_user,'atest1','select');
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(current_user,'atest1','insert');
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(t2.oid,'atest1','update')
-from (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(t2.oid,'atest1','delete')
-from (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(current_user,t1.oid,'references')
-from (select oid from pg_class where relname = 'atest1') as t1;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(t2.oid,t1.oid,'select')
-from (select oid from pg_class where relname = 'atest1') as t1,
- (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t2.oid,t1.oid,'insert')
-from (select oid from pg_class where relname = 'atest1') as t1,
- (select oid from pg_roles where rolname = current_user) as t2;
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege('atest1','update');
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege('atest1','delete');
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege('atest1','truncate');
- has_table_privilege
----------------------
- f
-(1 row)
-
-select has_table_privilege(t1.oid,'select')
-from (select oid from pg_class where relname = 'atest1') as t1;
- has_table_privilege
----------------------
- t
-(1 row)
-
-select has_table_privilege(t1.oid,'trigger')
-from (select oid from pg_class where relname = 'atest1') as t1;
- has_table_privilege
----------------------
- f
-(1 row)
-
--- has_column_privilege function
--- bad-input checks (as non-super-user)
-select has_column_privilege('pg_authid',NULL,'select');
- has_column_privilege
-----------------------
-
-(1 row)
-
-select has_column_privilege('pg_authid','nosuchcol','select');
-ERROR: column "nosuchcol" of relation "pg_authid" does not exist
-select has_column_privilege(9999,'nosuchcol','select');
- has_column_privilege
-----------------------
-
-(1 row)
-
-select has_column_privilege(9999,99::int2,'select');
- has_column_privilege
-----------------------
-
-(1 row)
-
-select has_column_privilege('pg_authid',99::int2,'select');
- has_column_privilege
-----------------------
-
-(1 row)
-
-select has_column_privilege(9999,99::int2,'select');
- has_column_privilege
-----------------------
-
-(1 row)
-
-create temp table mytable(f1 int, f2 int, f3 int);
-alter table mytable drop column f2;
-select has_column_privilege('mytable','f2','select');
-ERROR: column "f2" of relation "mytable" does not exist
-select has_column_privilege('mytable','........pg.dropped.2........','select');
- has_column_privilege
-----------------------
-
-(1 row)
-
-select has_column_privilege('mytable',2::int2,'select');
- has_column_privilege
-----------------------
- t
-(1 row)
-
-revoke select on table mytable from regress_priv_user3;
-select has_column_privilege('mytable',2::int2,'select');
- has_column_privilege
-----------------------
-
-(1 row)
-
-drop table mytable;
--- Grant options
-SET SESSION AUTHORIZATION regress_priv_user1;
-CREATE TABLE atest4 (a int);
-GRANT SELECT ON atest4 TO regress_priv_user2 WITH GRANT OPTION;
-GRANT UPDATE ON atest4 TO regress_priv_user2;
-GRANT SELECT ON atest4 TO GROUP regress_priv_group1 WITH GRANT OPTION;
-SET SESSION AUTHORIZATION regress_priv_user2;
-GRANT SELECT ON atest4 TO regress_priv_user3;
-GRANT UPDATE ON atest4 TO regress_priv_user3; -- fail
-WARNING: no privileges were granted for "atest4"
-SET SESSION AUTHORIZATION regress_priv_user1;
-REVOKE SELECT ON atest4 FROM regress_priv_user3; -- does nothing
-NOTICE: no privileges could be revoked
-SELECT has_table_privilege('regress_priv_user3', 'atest4', 'SELECT'); -- true
- has_table_privilege
----------------------
- t
-(1 row)
-
-REVOKE SELECT ON atest4 FROM regress_priv_user2; -- fail
-ERROR: dependent privileges exist
-HINT: Use CASCADE to revoke them too.
-REVOKE GRANT OPTION FOR SELECT ON atest4 FROM regress_priv_user2 CASCADE; -- ok
-SELECT has_table_privilege('regress_priv_user2', 'atest4', 'SELECT'); -- true
- has_table_privilege
----------------------
- t
-(1 row)
-
-SELECT has_table_privilege('regress_priv_user3', 'atest4', 'SELECT'); -- false
- has_table_privilege
----------------------
- f
-(1 row)
-
-SELECT has_table_privilege('regress_priv_user1', 'atest4', 'SELECT WITH GRANT OPTION'); -- true
- has_table_privilege
----------------------
- t
-(1 row)
-
--- security-restricted operations
-\c -
-CREATE ROLE regress_sro_user;
--- Check that index expressions and predicates are run as the table's owner
--- A dummy index function checking current_user
-CREATE FUNCTION sro_ifun(int) RETURNS int AS $$
-BEGIN
- -- Below we set the table's owner to regress_sro_user
- ASSERT current_user = 'regress_sro_user',
- format('sro_ifun(%s) called by %s', $1, current_user);
- RETURN $1;
-END;
-$$ LANGUAGE plpgsql IMMUTABLE;
--- Create a table owned by regress_sro_user
-CREATE TABLE sro_tab (a int);
-ALTER TABLE sro_tab OWNER TO regress_sro_user;
-INSERT INTO sro_tab VALUES (1), (2), (3);
--- Create an expression index with a predicate
-CREATE INDEX sro_idx ON sro_tab ((sro_ifun(a) + sro_ifun(0)))
- WHERE sro_ifun(a + 10) > sro_ifun(10);
-DROP INDEX sro_idx;
--- Do the same concurrently
-CREATE INDEX sro_idx ON sro_tab ((sro_ifun(a) + sro_ifun(0)))
- WHERE sro_ifun(a + 10) > sro_ifun(10);
--- REINDEX
-REINDEX TABLE sro_tab;
-REINDEX INDEX sro_idx;
-REINDEX TABLE CONCURRENTLY sro_tab;
-ERROR: REINDEX CONCURRENTLY is not supported
-DROP INDEX sro_idx;
--- CLUSTER
-CREATE INDEX sro_cluster_idx ON sro_tab ((sro_ifun(a) + sro_ifun(0)));
-CLUSTER sro_tab USING sro_cluster_idx;
-DROP INDEX sro_cluster_idx;
--- BRIN index
-CREATE INDEX sro_brin ON sro_tab USING brin ((sro_ifun(a) + sro_ifun(0)));
-SELECT brin_desummarize_range('sro_brin', 0);
- brin_desummarize_range
-------------------------
-(0 rows)
-
-SELECT brin_summarize_range('sro_brin', 0);
- brin_summarize_range
-----------------------
- 2
-(1 row)
-
-DROP TABLE sro_tab;
--- Check with a partitioned table
-CREATE TABLE sro_ptab (a int) PARTITION BY RANGE (a);
-ALTER TABLE sro_ptab OWNER TO regress_sro_user;
-CREATE TABLE sro_part PARTITION OF sro_ptab FOR VALUES FROM (1) TO (10);
-ALTER TABLE sro_part OWNER TO regress_sro_user;
-INSERT INTO sro_ptab VALUES (1), (2), (3);
-CREATE INDEX sro_pidx ON sro_ptab ((sro_ifun(a) + sro_ifun(0)))
- WHERE sro_ifun(a + 10) > sro_ifun(10);
-REINDEX TABLE sro_ptab;
-REINDEX INDEX CONCURRENTLY sro_pidx;
-ERROR: REINDEX CONCURRENTLY is not supported
-SET SESSION AUTHORIZATION regress_sro_user;
-CREATE FUNCTION unwanted_grant() RETURNS void LANGUAGE sql AS
- 'GRANT regress_priv_group2 TO regress_sro_user';
-CREATE FUNCTION mv_action() RETURNS bool LANGUAGE sql AS
- 'DECLARE c CURSOR WITH HOLD FOR SELECT unwanted_grant(); SELECT true';
--- REFRESH of this MV will queue a GRANT at end of transaction
-CREATE MATERIALIZED VIEW sro_mv AS SELECT mv_action() WITH NO DATA;
-REFRESH MATERIALIZED VIEW sro_mv;
-ERROR: cannot create a cursor WITH HOLD within security-restricted operation
-CONTEXT: SQL function "mv_action" statement 1
-\c -
-REFRESH MATERIALIZED VIEW sro_mv;
-ERROR: cannot create a cursor WITH HOLD within security-restricted operation
-CONTEXT: SQL function "mv_action" statement 1
-SET SESSION AUTHORIZATION regress_sro_user;
--- INSERT to this table will queue a GRANT at end of transaction
-CREATE TABLE sro_trojan_table ();
-CREATE FUNCTION sro_trojan() RETURNS trigger LANGUAGE plpgsql AS
- 'BEGIN PERFORM unwanted_grant(); RETURN NULL; END';
-CREATE CONSTRAINT TRIGGER t AFTER INSERT ON sro_trojan_table
- INITIALLY DEFERRED FOR EACH ROW EXECUTE PROCEDURE sro_trojan();
--- Now, REFRESH will issue such an INSERT, queueing the GRANT
-CREATE OR REPLACE FUNCTION mv_action() RETURNS bool LANGUAGE sql AS
- 'INSERT INTO sro_trojan_table DEFAULT VALUES; SELECT true';
-REFRESH MATERIALIZED VIEW sro_mv;
-ERROR: cannot fire deferred trigger within security-restricted operation
-CONTEXT: SQL function "mv_action" statement 1
-\c -
-REFRESH MATERIALIZED VIEW sro_mv;
-ERROR: cannot fire deferred trigger within security-restricted operation
-CONTEXT: SQL function "mv_action" statement 1
-BEGIN; SET CONSTRAINTS ALL IMMEDIATE; REFRESH MATERIALIZED VIEW sro_mv; COMMIT;
-ERROR: function cannot execute on a QE slice because it issues a non-SELECT statement
-CONTEXT: SQL function "unwanted_grant" during startup
-SQL statement "SELECT unwanted_grant()"
-PL/pgSQL function sro_trojan() line 1 at PERFORM
-SQL function "mv_action" statement 1
--- REFRESH MATERIALIZED VIEW CONCURRENTLY use of eval_const_expressions()
-SET SESSION AUTHORIZATION regress_sro_user;
-CREATE FUNCTION unwanted_grant_nofail(int) RETURNS int
- IMMUTABLE LANGUAGE plpgsql AS $$
-BEGIN
- PERFORM unwanted_grant();
- RAISE WARNING 'owned';
- RETURN 1;
-EXCEPTION WHEN OTHERS THEN
- RETURN 2;
-END$$;
-CREATE MATERIALIZED VIEW sro_index_mv AS SELECT 1 AS c DISTRIBUTED BY (c);
-CREATE UNIQUE INDEX ON sro_index_mv (c) WHERE unwanted_grant_nofail(1) > 0;
-\c -
-REFRESH MATERIALIZED VIEW CONCURRENTLY sro_index_mv;
-REFRESH MATERIALIZED VIEW sro_index_mv;
-DROP OWNED BY regress_sro_user;
-DROP ROLE regress_sro_user;
--- Admin options
-SET SESSION AUTHORIZATION regress_priv_user4;
-CREATE FUNCTION dogrant_ok() RETURNS void LANGUAGE sql SECURITY DEFINER AS
- 'GRANT regress_priv_group2 TO regress_priv_user5';
-GRANT regress_priv_group2 TO regress_priv_user5; -- ok: had ADMIN OPTION
-SET ROLE regress_priv_group2;
-GRANT regress_priv_group2 TO regress_priv_user5; -- fails: SET ROLE suspended privilege
-ERROR: must have admin option on role "regress_priv_group2"
-SET SESSION AUTHORIZATION regress_priv_user1;
-GRANT regress_priv_group2 TO regress_priv_user5; -- fails: no ADMIN OPTION
-ERROR: must have admin option on role "regress_priv_group2"
-SELECT dogrant_ok(); -- ok: SECURITY DEFINER conveys ADMIN
-NOTICE: role "regress_priv_user5" is already a member of role "regress_priv_group2"
- dogrant_ok
-------------
-
-(1 row)
-
-SET ROLE regress_priv_group2;
-GRANT regress_priv_group2 TO regress_priv_user5; -- fails: SET ROLE did not help
-ERROR: must have admin option on role "regress_priv_group2"
-SET SESSION AUTHORIZATION regress_priv_group2;
-GRANT regress_priv_group2 TO regress_priv_user5; -- ok: a role can self-admin
-NOTICE: role "regress_priv_user5" is already a member of role "regress_priv_group2"
-CREATE FUNCTION dogrant_fails() RETURNS void LANGUAGE sql SECURITY DEFINER AS
- 'GRANT regress_priv_group2 TO regress_priv_user5';
-SELECT dogrant_fails(); -- fails: no self-admin in SECURITY DEFINER
-ERROR: must have admin option on role "regress_priv_group2"
-CONTEXT: SQL function "dogrant_fails" statement 1
-DROP FUNCTION dogrant_fails();
-SET SESSION AUTHORIZATION regress_priv_user4;
-DROP FUNCTION dogrant_ok();
-REVOKE regress_priv_group2 FROM regress_priv_user5;
--- has_sequence_privilege tests
-\c -
-CREATE SEQUENCE x_seq;
-GRANT USAGE on x_seq to regress_priv_user2;
-SELECT has_sequence_privilege('regress_priv_user1', 'atest1', 'SELECT');
-ERROR: "atest1" is not a sequence
-SELECT has_sequence_privilege('regress_priv_user1', 'x_seq', 'INSERT');
-ERROR: unrecognized privilege type: "INSERT"
-SELECT has_sequence_privilege('regress_priv_user1', 'x_seq', 'SELECT');
- has_sequence_privilege
-------------------------
- f
-(1 row)
-
-SET SESSION AUTHORIZATION regress_priv_user2;
-SELECT has_sequence_privilege('x_seq', 'USAGE');
- has_sequence_privilege
-------------------------
- t
-(1 row)
-
--- largeobject privilege tests
-\c -
-SET SESSION AUTHORIZATION regress_priv_user1;
--- start_ignore
-SELECT lo_create(1001);
- lo_create
------------
- 1001
-(1 row)
-
-SELECT lo_create(1002);
- lo_create
------------
- 1002
-(1 row)
-
-SELECT lo_create(1003);
- lo_create
------------
- 1003
-(1 row)
-
-SELECT lo_create(1004);
- lo_create
------------
- 1004
-(1 row)
-
-SELECT lo_create(1005);
- lo_create
------------
- 1005
-(1 row)
-
-GRANT ALL ON LARGE OBJECT 1001 TO PUBLIC;
-GRANT SELECT ON LARGE OBJECT 1003 TO regress_priv_user2;
-GRANT SELECT,UPDATE ON LARGE OBJECT 1004 TO regress_priv_user2;
-GRANT ALL ON LARGE OBJECT 1005 TO regress_priv_user2;
-GRANT SELECT ON LARGE OBJECT 1005 TO regress_priv_user2 WITH GRANT OPTION;
-GRANT SELECT, INSERT ON LARGE OBJECT 1001 TO PUBLIC; -- to be failed
-ERROR: invalid privilege type INSERT for large object
-GRANT SELECT, UPDATE ON LARGE OBJECT 1001 TO nosuchuser; -- to be failed
-ERROR: role "nosuchuser" does not exist
-GRANT SELECT, UPDATE ON LARGE OBJECT 999 TO PUBLIC; -- to be failed
-ERROR: large object 999 does not exist
--- end_ignore
-\c -
-SET SESSION AUTHORIZATION regress_priv_user2;
--- start_ignore
-SELECT lo_create(2001);
- lo_create
------------
- 2001
-(1 row)
-
-SELECT lo_create(2002);
- lo_create
------------
- 2002
-(1 row)
-
-SELECT loread(lo_open(1001, x'20000'::int), 32); -- allowed, for now
- loread
---------
- \x
-(1 row)
-
-SELECT lowrite(lo_open(1001, x'40000'::int), 'abcd'); -- fail, wrong mode
-ERROR: large object descriptor 0 was not opened for writing
-SELECT loread(lo_open(1001, x'40000'::int), 32);
- loread
---------
- \x
-(1 row)
-
-SELECT loread(lo_open(1002, x'40000'::int), 32); -- to be denied
-ERROR: permission denied for large object 1002
-SELECT loread(lo_open(1003, x'40000'::int), 32);
- loread
---------
- \x
-(1 row)
-
-SELECT loread(lo_open(1004, x'40000'::int), 32);
- loread
---------
- \x
-(1 row)
-
-SELECT lowrite(lo_open(1001, x'20000'::int), 'abcd');
- lowrite
----------
- 4
-(1 row)
-
-SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); -- to be denied
-ERROR: permission denied for large object 1002
-SELECT lowrite(lo_open(1003, x'20000'::int), 'abcd'); -- to be denied
-ERROR: permission denied for large object 1003
-SELECT lowrite(lo_open(1004, x'20000'::int), 'abcd');
- lowrite
----------
- 4
-(1 row)
-
-GRANT SELECT ON LARGE OBJECT 1005 TO regress_priv_user3;
-GRANT UPDATE ON LARGE OBJECT 1006 TO regress_priv_user3; -- to be denied
-ERROR: large object 1006 does not exist
-REVOKE ALL ON LARGE OBJECT 2001, 2002 FROM PUBLIC;
-GRANT ALL ON LARGE OBJECT 2001 TO regress_priv_user3;
-SELECT lo_unlink(1001); -- to be denied
-ERROR: must be owner of large object 1001
-SELECT lo_unlink(2002);
- lo_unlink
------------
- 1
-(1 row)
-
--- end_ignore
-\c -
--- start_ignore
--- confirm ACL setting
-SELECT oid, pg_get_userbyid(lomowner) ownername, lomacl FROM pg_largeobject_metadata WHERE oid >= 1000 AND oid < 3000 ORDER BY oid;
- oid | ownername | lomacl
-------+--------------------+------------------------------------------------------------------------------------------------------------------------------
- 1001 | regress_priv_user1 | {regress_priv_user1=rw/regress_priv_user1,=rw/regress_priv_user1}
- 1002 | regress_priv_user1 |
- 1003 | regress_priv_user1 | {regress_priv_user1=rw/regress_priv_user1,regress_priv_user2=r/regress_priv_user1}
- 1004 | regress_priv_user1 | {regress_priv_user1=rw/regress_priv_user1,regress_priv_user2=rw/regress_priv_user1}
- 1005 | regress_priv_user1 | {regress_priv_user1=rw/regress_priv_user1,regress_priv_user2=r*w/regress_priv_user1,regress_priv_user3=r/regress_priv_user2}
- 2001 | regress_priv_user2 | {regress_priv_user2=rw/regress_priv_user2,regress_priv_user3=rw/regress_priv_user2}
-(6 rows)
-
--- end_ignore
-SET SESSION AUTHORIZATION regress_priv_user3;
--- start_ignore
-SELECT loread(lo_open(1001, x'40000'::int), 32);
- loread
-------------
- \x61626364
-(1 row)
-
-SELECT loread(lo_open(1003, x'40000'::int), 32); -- to be denied
-ERROR: permission denied for large object 1003
-SELECT loread(lo_open(1005, x'40000'::int), 32);
- loread
---------
- \x
-(1 row)
-
-SELECT lo_truncate(lo_open(1005, x'20000'::int), 10); -- to be denied
-ERROR: permission denied for large object 1005
-SELECT lo_truncate(lo_open(2001, x'20000'::int), 10);
- lo_truncate
--------------
- 0
-(1 row)
-
--- end_ignore
--- compatibility mode in largeobject permission
-\c -
-SET lo_compat_privileges = false; -- default setting
-SET SESSION AUTHORIZATION regress_priv_user4;
--- start_ignore
-SELECT loread(lo_open(1002, x'40000'::int), 32); -- to be denied
-ERROR: permission denied for large object 1002
-SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); -- to be denied
-ERROR: permission denied for large object 1002
-SELECT lo_truncate(lo_open(1002, x'20000'::int), 10); -- to be denied
-ERROR: permission denied for large object 1002
-SELECT lo_put(1002, 1, 'abcd'); -- to be denied
-ERROR: permission denied for large object 1002
-SELECT lo_unlink(1002); -- to be denied
-ERROR: must be owner of large object 1002
-SELECT lo_export(1001, '/dev/null'); -- to be denied
-ERROR: permission denied for function lo_export
-SELECT lo_import('/dev/null'); -- to be denied
-ERROR: permission denied for function lo_import
-SELECT lo_import('/dev/null', 2003); -- to be denied
-ERROR: permission denied for function lo_import
--- end_ignore
-\c -
-SET lo_compat_privileges = true; -- compatibility mode
-SET SESSION AUTHORIZATION regress_priv_user4;
--- start_ignore
-SELECT loread(lo_open(1002, x'40000'::int), 32);
- loread
---------
- \x
-(1 row)
-
-SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd');
- lowrite
----------
- 4
-(1 row)
-
-SELECT lo_truncate(lo_open(1002, x'20000'::int), 10);
- lo_truncate
--------------
- 0
-(1 row)
-
-SELECT lo_unlink(1002);
- lo_unlink
------------
- 1
-(1 row)
-
-SELECT lo_export(1001, '/dev/null'); -- to be denied
-ERROR: permission denied for function lo_export
--- end_ignore
--- don't allow unpriv users to access pg_largeobject contents
-\c -
-SELECT * FROM pg_largeobject LIMIT 0;
- loid | pageno | data
-------+--------+------
-(0 rows)
-
-SET SESSION AUTHORIZATION regress_priv_user1;
-SELECT * FROM pg_largeobject LIMIT 0; -- to be denied
-ERROR: permission denied for table pg_largeobject
--- test default ACLs
-\c -
-CREATE SCHEMA testns;
-GRANT ALL ON SCHEMA testns TO regress_priv_user1;
-CREATE TABLE testns.acltest1 (x int);
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- no
- has_table_privilege
----------------------
- f
-(1 row)
-
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no
- has_table_privilege
----------------------
- f
-(1 row)
-
--- placeholder for test with duplicated schema and role names
-ALTER DEFAULT PRIVILEGES IN SCHEMA testns,testns GRANT SELECT ON TABLES TO public,public;
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- no
- has_table_privilege
----------------------
- f
-(1 row)
-
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no
- has_table_privilege
----------------------
- f
-(1 row)
-
-DROP TABLE testns.acltest1;
-CREATE TABLE testns.acltest1 (x int);
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- yes
- has_table_privilege
----------------------
- t
-(1 row)
-
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no
- has_table_privilege
----------------------
- f
-(1 row)
-
-ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT INSERT ON TABLES TO regress_priv_user1;
-DROP TABLE testns.acltest1;
-CREATE TABLE testns.acltest1 (x int);
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- yes
- has_table_privilege
----------------------
- t
-(1 row)
-
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- yes
- has_table_privilege
----------------------
- t
-(1 row)
-
-ALTER DEFAULT PRIVILEGES IN SCHEMA testns REVOKE INSERT ON TABLES FROM regress_priv_user1;
-DROP TABLE testns.acltest1;
-CREATE TABLE testns.acltest1 (x int);
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- yes
- has_table_privilege
----------------------
- t
-(1 row)
-
-SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no
- has_table_privilege
----------------------
- f
-(1 row)
-
-ALTER DEFAULT PRIVILEGES FOR ROLE regress_priv_user1 REVOKE EXECUTE ON FUNCTIONS FROM public;
-ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT USAGE ON SCHEMAS TO regress_priv_user2; -- error
-ERROR: cannot use IN SCHEMA clause when using GRANT/REVOKE ON SCHEMAS
---
--- Testing blanket default grants is very hazardous since it might change
--- the privileges attached to objects created by concurrent regression tests.
--- To avoid that, be sure to revoke the privileges again before committing.
---
-BEGIN;
-ALTER DEFAULT PRIVILEGES GRANT USAGE ON SCHEMAS TO regress_priv_user2;
-CREATE SCHEMA testns2;
-SELECT has_schema_privilege('regress_priv_user2', 'testns2', 'USAGE'); -- yes
- has_schema_privilege
-----------------------
- t
-(1 row)
-
-SELECT has_schema_privilege('regress_priv_user2', 'testns2', 'CREATE'); -- no
- has_schema_privilege
-----------------------
- f
-(1 row)
-
-ALTER DEFAULT PRIVILEGES REVOKE USAGE ON SCHEMAS FROM regress_priv_user2;
-CREATE SCHEMA testns3;
-SELECT has_schema_privilege('regress_priv_user2', 'testns3', 'USAGE'); -- no
- has_schema_privilege
-----------------------
- f
-(1 row)
-
-SELECT has_schema_privilege('regress_priv_user2', 'testns3', 'CREATE'); -- no
- has_schema_privilege
-----------------------
- f
-(1 row)
-
-ALTER DEFAULT PRIVILEGES GRANT ALL ON SCHEMAS TO regress_priv_user2;
-CREATE SCHEMA testns4;
-SELECT has_schema_privilege('regress_priv_user2', 'testns4', 'USAGE'); -- yes
- has_schema_privilege
-----------------------
- t
-(1 row)
-
-SELECT has_schema_privilege('regress_priv_user2', 'testns4', 'CREATE'); -- yes
- has_schema_privilege
-----------------------
- t
-(1 row)
-
-ALTER DEFAULT PRIVILEGES REVOKE ALL ON SCHEMAS FROM regress_priv_user2;
-COMMIT;
-CREATE SCHEMA testns5;
-SELECT has_schema_privilege('regress_priv_user2', 'testns5', 'USAGE'); -- no
- has_schema_privilege
-----------------------
- f
-(1 row)
-
-SELECT has_schema_privilege('regress_priv_user2', 'testns5', 'CREATE'); -- no
- has_schema_privilege
-----------------------
- f
-(1 row)
-
-SET ROLE regress_priv_user1;
-CREATE FUNCTION testns.foo() RETURNS int AS 'select 1' LANGUAGE sql;
-CREATE AGGREGATE testns.agg1(int) (sfunc = int4pl, stype = int4);
-CREATE PROCEDURE testns.bar() AS 'select 1' LANGUAGE sql;
-SELECT has_function_privilege('regress_priv_user2', 'testns.foo()', 'EXECUTE'); -- no
- has_function_privilege
-------------------------
- f
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user2', 'testns.agg1(int)', 'EXECUTE'); -- no
- has_function_privilege
-------------------------
- f
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user2', 'testns.bar()', 'EXECUTE'); -- no
- has_function_privilege
-------------------------
- f
-(1 row)
-
-ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT EXECUTE ON ROUTINES to public;
-DROP FUNCTION testns.foo();
-CREATE FUNCTION testns.foo() RETURNS int AS 'select 1' LANGUAGE sql;
-DROP AGGREGATE testns.agg1(int);
-CREATE AGGREGATE testns.agg1(int) (sfunc = int4pl, stype = int4);
-DROP PROCEDURE testns.bar();
-CREATE PROCEDURE testns.bar() AS 'select 1' LANGUAGE sql;
-SELECT has_function_privilege('regress_priv_user2', 'testns.foo()', 'EXECUTE'); -- yes
- has_function_privilege
-------------------------
- t
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user2', 'testns.agg1(int)', 'EXECUTE'); -- yes
- has_function_privilege
-------------------------
- t
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user2', 'testns.bar()', 'EXECUTE'); -- yes (counts as function here)
- has_function_privilege
-------------------------
- t
-(1 row)
-
-DROP FUNCTION testns.foo();
-DROP AGGREGATE testns.agg1(int);
-DROP PROCEDURE testns.bar();
-ALTER DEFAULT PRIVILEGES FOR ROLE regress_priv_user1 REVOKE USAGE ON TYPES FROM public;
-CREATE DOMAIN testns.priv_testdomain1 AS int;
-SELECT has_type_privilege('regress_priv_user2', 'testns.priv_testdomain1', 'USAGE'); -- no
- has_type_privilege
---------------------
- f
-(1 row)
-
-ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT USAGE ON TYPES to public;
-DROP DOMAIN testns.priv_testdomain1;
-CREATE DOMAIN testns.priv_testdomain1 AS int;
-SELECT has_type_privilege('regress_priv_user2', 'testns.priv_testdomain1', 'USAGE'); -- yes
- has_type_privilege
---------------------
- t
-(1 row)
-
-DROP DOMAIN testns.priv_testdomain1;
-RESET ROLE;
-SELECT count(*)
- FROM pg_default_acl d LEFT JOIN pg_namespace n ON defaclnamespace = n.oid
- WHERE nspname = 'testns';
- count
--------
- 3
-(1 row)
-
-DROP SCHEMA testns CASCADE;
-NOTICE: drop cascades to table testns.acltest1
-DROP SCHEMA testns2 CASCADE;
-DROP SCHEMA testns3 CASCADE;
-DROP SCHEMA testns4 CASCADE;
-DROP SCHEMA testns5 CASCADE;
-SELECT d.* -- check that entries went away
- FROM pg_default_acl d LEFT JOIN pg_namespace n ON defaclnamespace = n.oid
- WHERE nspname IS NULL AND defaclnamespace != 0;
- oid | defaclrole | defaclnamespace | defaclobjtype | defaclacl
------+------------+-----------------+---------------+-----------
-(0 rows)
-
--- Grant on all objects of given type in a schema
-\c -
--- GPDB: Create a helper function to inspect the segment information also
-DROP FUNCTION IF EXISTS has_table_privilege_seg(u text, r text, p text);
-NOTICE: function has_table_privilege_seg(text,text,text) does not exist, skipping
-CREATE FUNCTION has_table_privilege_seg(us text, rel text, priv text)
-RETURNS TABLE (
- segid int,
- has_table_privilege bool
-) AS $$
- SELECT
- gp_execution_segment() AS gegid,
- p.*
- FROM
- has_table_privilege($1, $2, $3) p
-$$ LANGUAGE SQL VOLATILE
-CONTAINS SQL EXECUTE ON ALL SEGMENTS;
-CREATE SCHEMA testns;
-CREATE TABLE testns.t1 (f1 int);
-CREATE TABLE testns.t2 (f1 int);
-CREATE TABLE testns.t3 (f1 int) PARTITION BY RANGE (f1) (START (2018) END (2020) EVERY (1),DEFAULT PARTITION extra );
-CREATE TABLE testns.t4 (f1 int) inherits (testns.t1);
-NOTICE: merging column "f1" with inherited definition
-SELECT has_table_privilege('regress_priv_user1', 'testns.t1', 'SELECT'); -- false
- has_table_privilege
----------------------
- f
-(1 row)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t1', 'SELECT'); -- false
- segid | has_table_privilege
--------+---------------------
- 2 | f
- 0 | f
- 1 | f
-(3 rows)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t3', 'SELECT'); -- false
- segid | has_table_privilege
--------+---------------------
- 0 | f
- 1 | f
- 2 | f
-(3 rows)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t3_1_prt_extra', 'SELECT'); -- false
- segid | has_table_privilege
--------+---------------------
- 0 | f
- 1 | f
- 2 | f
-(3 rows)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t4', 'SELECT'); -- false
- segid | has_table_privilege
--------+---------------------
- 0 | f
- 1 | f
- 2 | f
-(3 rows)
-
-GRANT ALL ON ALL TABLES IN SCHEMA testns TO regress_priv_user1;
-SELECT has_table_privilege('regress_priv_user1', 'testns.t1', 'SELECT'); -- true
- has_table_privilege
----------------------
- t
-(1 row)
-
-SELECT has_table_privilege('regress_priv_user1', 'testns.t2', 'SELECT'); -- true
- has_table_privilege
----------------------
- t
-(1 row)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t1', 'SELECT'); -- true
- segid | has_table_privilege
--------+---------------------
- 0 | t
- 1 | t
- 2 | t
-(3 rows)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t3', 'SELECT'); -- true
- segid | has_table_privilege
--------+---------------------
- 0 | t
- 1 | t
- 2 | t
-(3 rows)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t3_1_prt_extra', 'SELECT'); -- true
- segid | has_table_privilege
--------+---------------------
- 0 | t
- 1 | t
- 2 | t
-(3 rows)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t4', 'SELECT'); -- true
- segid | has_table_privilege
--------+---------------------
- 0 | t
- 1 | t
- 2 | t
-(3 rows)
-
-REVOKE ALL ON ALL TABLES IN SCHEMA testns FROM regress_priv_user1;
-SELECT has_table_privilege('regress_priv_user1', 'testns.t1', 'SELECT'); -- false
- has_table_privilege
----------------------
- f
-(1 row)
-
-SELECT has_table_privilege('regress_priv_user1', 'testns.t2', 'SELECT'); -- false
- has_table_privilege
----------------------
- f
-(1 row)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t3', 'SELECT'); -- false
- segid | has_table_privilege
--------+---------------------
- 0 | f
- 1 | f
- 2 | f
-(3 rows)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t3_1_prt_extra', 'SELECT'); -- false
- segid | has_table_privilege
--------+---------------------
- 0 | f
- 1 | f
- 2 | f
-(3 rows)
-
-SELECT * FROM has_table_privilege_seg('regress_priv_user1', 'testns.t4', 'SELECT'); -- false
- segid | has_table_privilege
--------+---------------------
- 0 | f
- 1 | f
- 2 | f
-(3 rows)
-
-CREATE FUNCTION testns.priv_testfunc(int) RETURNS int AS 'select 3 * $1;' LANGUAGE sql;
-CREATE AGGREGATE testns.priv_testagg(int) (sfunc = int4pl, stype = int4);
-CREATE PROCEDURE testns.priv_testproc(int) AS 'select 3' LANGUAGE sql;
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testfunc(int)', 'EXECUTE'); -- true by default
- has_function_privilege
-------------------------
- t
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testagg(int)', 'EXECUTE'); -- true by default
- has_function_privilege
-------------------------
- t
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- true by default
- has_function_privilege
-------------------------
- t
-(1 row)
-
-REVOKE ALL ON ALL FUNCTIONS IN SCHEMA testns FROM PUBLIC;
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testfunc(int)', 'EXECUTE'); -- false
- has_function_privilege
-------------------------
- f
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testagg(int)', 'EXECUTE'); -- false
- has_function_privilege
-------------------------
- f
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- still true, not a function
- has_function_privilege
-------------------------
- t
-(1 row)
-
-REVOKE ALL ON ALL PROCEDURES IN SCHEMA testns FROM PUBLIC;
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- now false
- has_function_privilege
-------------------------
- f
-(1 row)
-
-GRANT ALL ON ALL ROUTINES IN SCHEMA testns TO PUBLIC;
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testfunc(int)', 'EXECUTE'); -- true
- has_function_privilege
-------------------------
- t
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testagg(int)', 'EXECUTE'); -- true
- has_function_privilege
-------------------------
- t
-(1 row)
-
-SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- true
- has_function_privilege
-------------------------
- t
-(1 row)
-
-DROP SCHEMA testns CASCADE;
-NOTICE: drop cascades to 7 other objects
-DETAIL: drop cascades to table testns.t1
-drop cascades to table testns.t2
-drop cascades to table testns.t3
-drop cascades to table testns.t4
-drop cascades to function testns.priv_testfunc(integer)
-drop cascades to function testns.priv_testagg(integer)
-drop cascades to function testns.priv_testproc(integer)
--- Change owner of the schema & and rename of new schema owner
-\c -
-CREATE ROLE regress_schemauser1 superuser login;
-CREATE ROLE regress_schemauser2 superuser login;
-SET SESSION ROLE regress_schemauser1;
-CREATE SCHEMA testns;
-SELECT nspname, rolname FROM pg_namespace, pg_roles WHERE pg_namespace.nspname = 'testns' AND pg_namespace.nspowner = pg_roles.oid;
- nspname | rolname
----------+---------------------
- testns | regress_schemauser1
-(1 row)
-
-ALTER SCHEMA testns OWNER TO regress_schemauser2;
-ALTER ROLE regress_schemauser2 RENAME TO regress_schemauser_renamed;
-SELECT nspname, rolname FROM pg_namespace, pg_roles WHERE pg_namespace.nspname = 'testns' AND pg_namespace.nspowner = pg_roles.oid;
- nspname | rolname
----------+----------------------------
- testns | regress_schemauser_renamed
-(1 row)
-
-set session role regress_schemauser_renamed;
-DROP SCHEMA testns CASCADE;
--- clean up
-\c -
-DROP ROLE regress_schemauser1;
-DROP ROLE regress_schemauser_renamed;
--- test that dependent privileges are revoked (or not) properly
-\c -
-set session role regress_priv_user1;
-create table dep_priv_test (a int);
-grant select on dep_priv_test to regress_priv_user2 with grant option;
-grant select on dep_priv_test to regress_priv_user3 with grant option;
-set session role regress_priv_user2;
-grant select on dep_priv_test to regress_priv_user4 with grant option;
-set session role regress_priv_user3;
-grant select on dep_priv_test to regress_priv_user4 with grant option;
-set session role regress_priv_user4;
-grant select on dep_priv_test to regress_priv_user5;
-\dp dep_priv_test
- Access privileges
- Schema | Name | Type | Access privileges | Column privileges | Policies
---------+---------------+-------+-----------------------------------------------+-------------------+----------
- public | dep_priv_test | table | regress_priv_user1=arwdDxt/regress_priv_user1+| |
- | | | regress_priv_user2=r*/regress_priv_user1 +| |
- | | | regress_priv_user3=r*/regress_priv_user1 +| |
- | | | regress_priv_user4=r*/regress_priv_user2 +| |
- | | | regress_priv_user4=r*/regress_priv_user3 +| |
- | | | regress_priv_user5=r/regress_priv_user4 | |
-(1 row)
-
-set session role regress_priv_user2;
-revoke select on dep_priv_test from regress_priv_user4 cascade;
-\dp dep_priv_test
- Access privileges
- Schema | Name | Type | Access privileges | Column privileges | Policies
---------+---------------+-------+-----------------------------------------------+-------------------+----------
- public | dep_priv_test | table | regress_priv_user1=arwdDxt/regress_priv_user1+| |
- | | | regress_priv_user2=r*/regress_priv_user1 +| |
- | | | regress_priv_user3=r*/regress_priv_user1 +| |
- | | | regress_priv_user4=r*/regress_priv_user3 +| |
- | | | regress_priv_user5=r/regress_priv_user4 | |
-(1 row)
-
-set session role regress_priv_user3;
-revoke select on dep_priv_test from regress_priv_user4 cascade;
-\dp dep_priv_test
- Access privileges
- Schema | Name | Type | Access privileges | Column privileges | Policies
---------+---------------+-------+-----------------------------------------------+-------------------+----------
- public | dep_priv_test | table | regress_priv_user1=arwdDxt/regress_priv_user1+| |
- | | | regress_priv_user2=r*/regress_priv_user1 +| |
- | | | regress_priv_user3=r*/regress_priv_user1 | |
-(1 row)
-
-set session role regress_priv_user1;
-drop table dep_priv_test;
--- security-restricted operations
-\c -
-CREATE ROLE regress_sro_user;
-SET SESSION AUTHORIZATION regress_sro_user;
-CREATE FUNCTION unwanted_grant() RETURNS void LANGUAGE sql AS
- 'GRANT regress_priv_group2 TO regress_sro_user';
-CREATE FUNCTION mv_action() RETURNS bool LANGUAGE sql AS
- 'DECLARE c CURSOR WITH HOLD FOR SELECT unwanted_grant(); SELECT true';
--- REFRESH of this MV will queue a GRANT at end of transaction
-CREATE MATERIALIZED VIEW sro_mv AS SELECT mv_action() WITH NO DATA;
-REFRESH MATERIALIZED VIEW sro_mv;
-ERROR: cannot create a cursor WITH HOLD within security-restricted operation
-CONTEXT: SQL function "mv_action" statement 1
-\c -
-REFRESH MATERIALIZED VIEW sro_mv;
-ERROR: cannot create a cursor WITH HOLD within security-restricted operation
-CONTEXT: SQL function "mv_action" statement 1
-SET SESSION AUTHORIZATION regress_sro_user;
--- INSERT to this table will queue a GRANT at end of transaction
-CREATE TABLE sro_trojan_table ();
-CREATE FUNCTION sro_trojan() RETURNS trigger LANGUAGE plpgsql AS
- 'BEGIN PERFORM unwanted_grant(); RETURN NULL; END';
-CREATE CONSTRAINT TRIGGER t AFTER INSERT ON sro_trojan_table
- INITIALLY DEFERRED FOR EACH ROW EXECUTE PROCEDURE sro_trojan();
--- Now, REFRESH will issue such an INSERT, queueing the GRANT
-CREATE OR REPLACE FUNCTION mv_action() RETURNS bool LANGUAGE sql AS
- 'INSERT INTO sro_trojan_table DEFAULT VALUES; SELECT true';
-REFRESH MATERIALIZED VIEW sro_mv;
-ERROR: cannot fire deferred trigger within security-restricted operation
-CONTEXT: SQL function "mv_action" statement 1
-\c -
-REFRESH MATERIALIZED VIEW sro_mv;
-ERROR: cannot fire deferred trigger within security-restricted operation
-CONTEXT: SQL function "mv_action" statement 1
-BEGIN; SET allow_segment_DML = ON; SET CONSTRAINTS ALL IMMEDIATE; REFRESH MATERIALIZED VIEW sro_mv; COMMIT;
-ERROR: must have admin option on role "regress_priv_group2"
-CONTEXT: SQL function "unwanted_grant" statement 1
-SQL statement "SELECT unwanted_grant()"
-PL/pgSQL function sro_trojan() line 1 at PERFORM
-SQL function "mv_action" statement 1
-DROP OWNED BY regress_sro_user;
-DROP ROLE regress_sro_user;
--- Test sandbox escape with CVE-2020-25695 on Greenplum.
---
--- The idea of CVE-2020-25695 is to make superuser fire a defered
--- trigger with security invoker function that executes some malicious
--- code with superuser privileges.
---
--- We create a two-step trap for a superuser running a maintenance
--- operation (ANALYZE) on a "trap" table. First of all we create
--- an index with stable function and replace it with volatile one after
--- creation. This index function is invoked by ANALYZE and acts as a
--- vulnerability firestarter - it inserts data to some table aside ("executor").
--- "Executor" table has a defered insert trigger with security invoker
--- function that executes malicious code under superuser. In a current example
--- we give superuser to our unprivileged user on segments (not on coordinator node).
-\c -
-CREATE ROLE regress_sro_user;
-SET SESSION AUTHORIZATION regress_sro_user;
-CREATE TABLE executor (s varchar) DISTRIBUTED REPLICATED;
-CREATE TABLE trap (a int) WITH(appendonly = true) DISTRIBUTED REPLICATED;
--- Create a "firestarter" stable index funcion
-CREATE OR REPLACE FUNCTION trap_sfunc(integer) RETURNS integer
-LANGUAGE sql IMMUTABLE AS
-'SELECT $1';
-CREATE INDEX trap_idx ON trap (trap_sfunc(a));
--- and replace it with volatile security invoker to prodice insert operation on ANALYZE.
-CREATE OR REPLACE FUNCTION trap_sfunc(integer) RETURNS integer
-LANGUAGE sql SECURITY INVOKER AS
-'SET allow_segment_DML = ON; INSERT INTO executor VALUES (current_user); SELECT $1';
--- Populate data in a "trap" table to run ANALYZE on.
-SET allow_segment_DML = ON;
-INSERT INTO trap VALUES(1);
--- Create malicious function to run in defered trigger
-CREATE OR REPLACE FUNCTION executor_sfunc(integer) RETURNS integer
-LANGUAGE sql SECURITY INVOKER AS
-'SET allow_segment_DML = ON; ALTER USER regress_sro_user WITH superuser; SELECT $1';
--- and the trigger itself.
-CREATE OR REPLACE FUNCTION executor_trig_sfunc() RETURNS trigger
-AS $$
-BEGIN PERFORM executor_sfunc(1000); RETURN NEW; END
-$$ LANGUAGE plpgsql;
-CREATE CONSTRAINT TRIGGER executor_trig
-AFTER INSERT ON executor
-INITIALLY DEFERRED FOR EACH ROW
-EXECUTE PROCEDURE executor_trig_sfunc();
--- Check "regress_sro_user" superuser privileges on segments.
-CREATE OR REPLACE FUNCTION is_superuser_on_segments(username text) RETURNS setof boolean AS $$
-SELECT rolsuper FROM pg_roles WHERE rolname = $1;
-$$ LANGUAGE sql EXECUTE ON ALL SEGMENTS;
-SELECT DISTINCT is_superuser_on_segments('regress_sro_user');
- is_superuser_on_segments
---------------------------
- f
-(1 row)
-
--- Execute a trap with superuser.
-RESET SESSION AUTHORIZATION;
-ANALYZE trap;
-ERROR: cannot fire deferred trigger within security-restricted operation
-CONTEXT: SQL function "trap_sfunc" statement 2
--- Check "regress_sro_user" superuser privileges on segments.
-SELECT DISTINCT is_superuser_on_segments('regress_sro_user');
- is_superuser_on_segments
---------------------------
- f
-(1 row)
-
-DROP TABLE trap;
-DROP TABLE executor;
-DROP FUNCTION trap_sfunc(integer);
-DROP FUNCTION executor_sfunc(integer);
-DROP FUNCTION executor_trig_sfunc();
-DROP FUNCTION is_superuser_on_segments(text);
-DROP ROLE regress_sro_user;
--- clean up
-\c
-drop sequence x_seq;
-DROP AGGREGATE priv_testagg1(int);
-DROP FUNCTION priv_testfunc2(int);
-DROP FUNCTION priv_testfunc4(boolean);
-DROP PROCEDURE priv_testproc1(int);
-DROP VIEW atestv0;
-DROP VIEW atestv1;
-DROP VIEW atestv2;
--- this should cascade to drop atestv4
-DROP VIEW atestv3 CASCADE;
-NOTICE: drop cascades to view atestv4
--- this should complain "does not exist"
-DROP VIEW atestv4;
-ERROR: view "atestv4" does not exist
-DROP TABLE atest1;
-DROP TABLE atest2;
-DROP TABLE atest3;
-DROP TABLE atest4;
-DROP TABLE atest5;
-DROP TABLE atest6;
-DROP TABLE atestc;
-DROP TABLE atestp1;
-DROP TABLE atestp2;
-DROP TABLE atest2_ctas_ok;
--- start_ignore
-SELECT lo_unlink(oid) FROM pg_largeobject_metadata WHERE oid >= 1000 AND oid < 3000 ORDER BY oid;
- lo_unlink
------------
- 1
- 1
- 1
- 1
- 1
-(5 rows)
-
--- end_ignore
-DROP GROUP regress_priv_group1;
-DROP GROUP regress_priv_group2;
--- these are needed to clean up permissions
-REVOKE USAGE ON LANGUAGE sql FROM regress_priv_user1;
-DROP OWNED BY regress_priv_user1;
-DROP USER regress_priv_user1;
-DROP USER regress_priv_user2;
-DROP USER regress_priv_user3;
-DROP USER regress_priv_user4;
-DROP USER regress_priv_user5;
-DROP USER regress_priv_user6;
-ERROR: role "regress_priv_user6" does not exist
--- permissions with LOCK TABLE
-CREATE USER regress_locktable_user;
-CREATE TABLE lock_table (a int);
--- LOCK TABLE and SELECT permission
-GRANT SELECT ON lock_table TO regress_locktable_user;
-SET SESSION AUTHORIZATION regress_locktable_user;
-BEGIN;
-LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should fail
-ERROR: permission denied for table lock_table
-ROLLBACK;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should pass
-COMMIT;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should fail
-ERROR: permission denied for table lock_table
-ROLLBACK;
-\c
-REVOKE SELECT ON lock_table FROM regress_locktable_user;
--- LOCK TABLE and INSERT permission
-GRANT INSERT ON lock_table TO regress_locktable_user;
-SET SESSION AUTHORIZATION regress_locktable_user;
-BEGIN;
-LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass
-COMMIT;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail
-ERROR: permission denied for table lock_table
-ROLLBACK;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should fail
-ERROR: permission denied for table lock_table
-ROLLBACK;
-\c
-REVOKE INSERT ON lock_table FROM regress_locktable_user;
--- LOCK TABLE and UPDATE permission
-GRANT UPDATE ON lock_table TO regress_locktable_user;
-SET SESSION AUTHORIZATION regress_locktable_user;
-BEGIN;
-LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass
-COMMIT;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail
-ERROR: permission denied for table lock_table
-ROLLBACK;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should pass
-COMMIT;
-\c
-REVOKE UPDATE ON lock_table FROM regress_locktable_user;
--- LOCK TABLE and DELETE permission
-GRANT DELETE ON lock_table TO regress_locktable_user;
-SET SESSION AUTHORIZATION regress_locktable_user;
-BEGIN;
-LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass
-COMMIT;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail
-ERROR: permission denied for table lock_table
-ROLLBACK;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should pass
-COMMIT;
-\c
-REVOKE DELETE ON lock_table FROM regress_locktable_user;
--- LOCK TABLE and TRUNCATE permission
-GRANT TRUNCATE ON lock_table TO regress_locktable_user;
-SET SESSION AUTHORIZATION regress_locktable_user;
-BEGIN;
-LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass
-COMMIT;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail
-ERROR: permission denied for table lock_table
-ROLLBACK;
-BEGIN;
-LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should pass
-COMMIT;
-\c
-REVOKE TRUNCATE ON lock_table FROM regress_locktable_user;
--- clean up
-DROP TABLE lock_table;
-DROP USER regress_locktable_user;
diff --git a/src/test/regress/expected/qp_indexscan.out b/src/test/regress/expected/qp_indexscan.out
index d931438098..f09f6a5aca 100644
--- a/src/test/regress/expected/qp_indexscan.out
+++ b/src/test/regress/expected/qp_indexscan.out
@@ -1030,14 +1030,16 @@ select d from zoo order by d limit 3;
-- Validate if Backward IndexScan is chosen for query with offset and without limit
explain (costs off) select e,d,a from zoo order by e desc,d nulls first,a desc offset 9990;
- QUERY PLAN
---------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+-------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
Merge Key: e, d, a
- -> Index Only Scan Backward using dir_index_eda on zoo
+ -> Sort
+ Sort Key: e DESC, d NULLS FIRST, a DESC
+ -> Seq Scan on zoo
Optimizer: Postgres query optimizer
-(5 rows)
+(7 rows)
select e,d,a from zoo order by e desc,d nulls first,a desc offset 9997;
e | d | a
@@ -1051,16 +1053,18 @@ select e,d,a from zoo order by e desc,d nulls first,a desc offset 9997;
-- Validate if Backward IndexScan is chosen for query with offset value in subquery
-- ORCA_FEATURE_NOT_SUPPORTED: ORCA doesn't support limit or offset values specified as part of a subquery
explain (costs off) select c from zoo order by c desc nulls last offset (select 9997);
- QUERY PLAN
-------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------
Limit
InitPlan 1 (returns $0) (slice2)
-> Result
-> Gather Motion 3:1 (slice1; segments: 3)
Merge Key: zoo.c
- -> Index Only Scan Backward using dir_index_c on zoo
+ -> Sort
+ Sort Key: zoo.c DESC NULLS LAST
+ -> Seq Scan on zoo
Optimizer: Postgres query optimizer
-(7 rows)
+(9 rows)
select c from zoo order by c desc nulls last offset (select 9997);
c
@@ -1861,15 +1865,17 @@ CREATE INDEX ao_index_eda on test_ao_table using btree(e desc nulls last, d,a de
INSERT INTO test_ao_table SELECT i, i+3, i/4.2, concat('sample_text ',i), i/5 from generate_series(1,100) i;
-- Expected to choose IndexOnlyScan Forward
explain(costs off) select e,d,a from test_ao_table order by e desc nulls last, d, a desc limit 3;
- QUERY PLAN
------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
Merge Key: e, d, a
-> Limit
- -> Index Only Scan using ao_index_eda on test_ao_table
+ -> Sort
+ Sort Key: e DESC NULLS LAST, d, a DESC
+ -> Seq Scan on test_ao_table
Optimizer: Postgres query optimizer
-(6 rows)
+(8 rows)
select e,d,a from test_ao_table order by e desc nulls last, d, a desc limit 3;
e | d | a
@@ -1881,15 +1887,17 @@ select e,d,a from test_ao_table order by e desc nulls last, d, a desc limit 3;
-- Expected to choose IndexOnlyScan Backward
explain(costs off) select e,d,a from test_ao_table order by e nulls first, d desc, a limit 3;
- QUERY PLAN
---------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
Merge Key: e, d, a
-> Limit
- -> Index Only Scan Backward using ao_index_eda on test_ao_table
+ -> Sort
+ Sort Key: e NULLS FIRST, d DESC, a
+ -> Seq Scan on test_ao_table
Optimizer: Postgres query optimizer
-(6 rows)
+(8 rows)
select e,d,a from test_ao_table order by e nulls first, d desc, a limit 3;
e | d | a
@@ -2348,30 +2356,30 @@ ANALYZE tbl_range;
-- Demonstrate that Planner could use IndexScan with MergeAppend for these cases
set enable_seqscan to off;
explain(costs off) select * from tbl_range order by col1, col2 limit 3;
- QUERY PLAN
------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: p1.col1, p1.col2
+ Merge Key: tbl_range.col1, tbl_range.col2
-> Limit
-> Append
- -> Index Scan using p1_col1_col2_idx on p1
- -> Index Scan using p2_col1_col2_idx on p2
- -> Index Scan using p3_col1_col2_idx on p3
+ -> Index Scan using p1_col1_col2_idx on p1 tbl_range_1
+ -> Index Scan using p2_col1_col2_idx on p2 tbl_range_2
+ -> Index Scan using p3_col1_col2_idx on p3 tbl_range_3
Optimizer: Postgres query optimizer
(9 rows)
explain(costs off) select * from tbl_range order by col1 limit 3;
- QUERY PLAN
------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: p1.col1
+ Merge Key: tbl_range.col1
-> Limit
-> Append
- -> Index Scan using p1_col1_col2_idx on p1
- -> Index Scan using p2_col1_col2_idx on p2
- -> Index Scan using p3_col1_col2_idx on p3
+ -> Index Scan using p1_col1_col2_idx on p1 tbl_range_1
+ -> Index Scan using p2_col1_col2_idx on p2 tbl_range_2
+ -> Index Scan using p3_col1_col2_idx on p3 tbl_range_3
Optimizer: Postgres query optimizer
(9 rows)
@@ -2389,16 +2397,16 @@ NOTICE: table has parent, setting distribution columns to match parent table
CREATE INDEX idx_on_year ON sales_data USING btree(year desc);
ANALYZE sales_data;
explain(costs off) select * from sales_data order by year desc limit 3;
- QUERY PLAN
-----------------------------------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: sales_data_uk_18_20.year
+ Merge Key: sales_data_1.year
-> Limit
-> Merge Append
- Sort Key: sales_data_uk_18_20.year DESC
- -> Index Scan using sales_data_uk_18_20_year_idx on sales_data_uk_18_20
- -> Index Scan using sales_data_us_18_20_year_idx on sales_data_us_18_20
+ Sort Key: sales_data_1.year DESC
+ -> Index Scan using sales_data_uk_18_20_year_idx on sales_data_uk_18_20 sales_data_1
+ -> Index Scan using sales_data_us_18_20_year_idx on sales_data_us_18_20 sales_data_2
Optimizer: Postgres query optimizer
(9 rows)
@@ -2414,16 +2422,16 @@ NOTICE: table has parent, setting distribution columns to match parent table
CREATE INDEX idx_on_tbl_hash ON tbl_hash using btree(col1);
ANALYZE tbl_hash;
explain(costs off) select * from tbl_hash order by col1 limit 3;
- QUERY PLAN
-------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: p1.col1
+ Merge Key: tbl_hash.col1
-> Limit
-> Merge Append
- Sort Key: p1.col1
- -> Index Scan using p1_col1_idx on p1
- -> Index Scan using p2_col1_idx on p2
+ Sort Key: tbl_hash.col1
+ -> Index Scan using p1_col1_idx on p1 tbl_hash_1
+ -> Index Scan using p2_col1_idx on p2 tbl_hash_2
Optimizer: Postgres query optimizer
(9 rows)
@@ -2440,15 +2448,15 @@ CREATE INDEX idx_on_geo ON sales_data using btree(geo);
ANALYZE sales_data;
-- Expected to use DynamicSeqScan with Sort
explain(costs off) select * from sales_data order by geo limit 3;
- QUERY PLAN
----------------------------------------------------------------------------------
+ QUERY PLAN
+----------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: sales_data_au.geo
+ Merge Key: sales_data.geo
-> Limit
-> Append
- -> Index Scan using sales_data_au_geo_idx on sales_data_au
- -> Index Scan using sales_data_uk_geo_idx on sales_data_uk
+ -> Index Scan using sales_data_au_geo_idx on sales_data_au sales_data_1
+ -> Index Scan using sales_data_uk_geo_idx on sales_data_uk sales_data_2
Optimizer: Postgres query optimizer
(8 rows)
@@ -2472,17 +2480,17 @@ ANALYZE tbl_range;
-- Demonstrate that Planner could use IndexScan with MergeAppend for these cases
set enable_seqscan to off;
explain(costs off) select * from tbl_range order by col1 limit 3;
- QUERY PLAN
-------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: p1.col1
+ Merge Key: tbl_range.col1
-> Limit
-> Merge Append
- Sort Key: p1.col1
- -> Index Scan using p1_col1_idx on p1
- -> Index Scan using p2_col1_idx on p2
- -> Index Scan using p3_col1_idx on p3
+ Sort Key: tbl_range.col1
+ -> Index Scan using p1_col1_idx on p1 tbl_range_1
+ -> Index Scan using p2_col1_idx on p2 tbl_range_2
+ -> Index Scan using p3_col1_idx on p3 tbl_range_3
Optimizer: Postgres query optimizer
(10 rows)
@@ -2788,310 +2796,310 @@ ANALYZE test_partition_table;
-- Currently ORCA doesn't support DynamicIndex(Only)Scans for order by on partition tables,
-- even if a btree index exists matching/commutative to order by cols. ORCA uses DynamicSeqScan with sort.
explain(costs off) select c,d from test_partition_table order by c, d limit 3;
- QUERY PLAN
---------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+-------------------------------------------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_1.c, test_partition_table_1_prt_1.d
+ Merge Key: test_partition_table.c, test_partition_table.d
-> Limit
-> Merge Append
- Sort Key: test_partition_table_1_prt_1.c, test_partition_table_1_prt_1.d
- -> Index Only Scan using test_partition_table_1_prt_1_c_d_idx on test_partition_table_1_prt_1
- -> Index Only Scan using test_partition_table_1_prt_2_c_d_idx on test_partition_table_1_prt_2
- -> Index Only Scan using test_partition_table_1_prt_3_c_d_idx on test_partition_table_1_prt_3
- -> Index Only Scan using test_partition_table_1_prt_4_c_d_idx on test_partition_table_1_prt_4
- -> Index Only Scan using test_partition_table_1_prt_5_c_d_idx on test_partition_table_1_prt_5
+ Sort Key: test_partition_table.c, test_partition_table.d
+ -> Index Only Scan using test_partition_table_1_prt_1_c_d_idx on test_partition_table_1_prt_1 test_partition_table_1
+ -> Index Only Scan using test_partition_table_1_prt_2_c_d_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan using test_partition_table_1_prt_3_c_d_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan using test_partition_table_1_prt_4_c_d_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan using test_partition_table_1_prt_5_c_d_idx on test_partition_table_1_prt_5 test_partition_table_5
Optimizer: Postgres query optimizer
(12 rows)
explain(costs off) select c,a,d from test_partition_table order by c,a,d limit 3;
- QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_1.c, test_partition_table_1_prt_1.a, test_partition_table_1_prt_1.d
+ Merge Key: test_partition_table.c, test_partition_table.a, test_partition_table.d
-> Limit
-> Merge Append
- Sort Key: test_partition_table_1_prt_1.c, test_partition_table_1_prt_1.a, test_partition_table_1_prt_1.d
- -> Index Only Scan using test_partition_table_1_prt_1_c_a_d_idx on test_partition_table_1_prt_1
- -> Index Only Scan using test_partition_table_1_prt_2_c_a_d_idx on test_partition_table_1_prt_2
- -> Index Only Scan using test_partition_table_1_prt_3_c_a_d_idx on test_partition_table_1_prt_3
- -> Index Only Scan using test_partition_table_1_prt_4_c_a_d_idx on test_partition_table_1_prt_4
- -> Index Only Scan using test_partition_table_1_prt_5_c_a_d_idx on test_partition_table_1_prt_5
+ Sort Key: test_partition_table.c, test_partition_table.a, test_partition_table.d
+ -> Index Only Scan using test_partition_table_1_prt_1_c_a_d_idx on test_partition_table_1_prt_1 test_partition_table_1
+ -> Index Only Scan using test_partition_table_1_prt_2_c_a_d_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan using test_partition_table_1_prt_3_c_a_d_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan using test_partition_table_1_prt_4_c_a_d_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan using test_partition_table_1_prt_5_c_a_d_idx on test_partition_table_1_prt_5 test_partition_table_5
Optimizer: Postgres query optimizer
(12 rows)
explain(costs off) select b,c,d from test_partition_table order by b desc,c desc,d desc limit 3;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_1.b, test_partition_table_1_prt_1.c, test_partition_table_1_prt_1.d
+ Merge Key: test_partition_table.b, test_partition_table.c, test_partition_table.d
-> Limit
-> Merge Append
- Sort Key: test_partition_table_1_prt_1.b DESC, test_partition_table_1_prt_1.c DESC, test_partition_table_1_prt_1.d DESC
- -> Index Only Scan Backward using test_partition_table_1_prt_1_b_c_d_idx on test_partition_table_1_prt_1
- -> Index Only Scan Backward using test_partition_table_1_prt_2_b_c_d_idx on test_partition_table_1_prt_2
- -> Index Only Scan Backward using test_partition_table_1_prt_3_b_c_d_idx on test_partition_table_1_prt_3
- -> Index Only Scan Backward using test_partition_table_1_prt_4_b_c_d_idx on test_partition_table_1_prt_4
- -> Index Only Scan Backward using test_partition_table_1_prt_5_b_c_d_idx on test_partition_table_1_prt_5
+ Sort Key: test_partition_table.b DESC, test_partition_table.c DESC, test_partition_table.d DESC
+ -> Index Only Scan Backward using test_partition_table_1_prt_1_b_c_d_idx on test_partition_table_1_prt_1 test_partition_table_1
+ -> Index Only Scan Backward using test_partition_table_1_prt_2_b_c_d_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan Backward using test_partition_table_1_prt_3_b_c_d_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan Backward using test_partition_table_1_prt_4_b_c_d_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan Backward using test_partition_table_1_prt_5_b_c_d_idx on test_partition_table_1_prt_5 test_partition_table_5
Optimizer: Postgres query optimizer
(12 rows)
-- Cases with just order by without limit
explain(costs off) select a from test_partition_table order by a desc;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> Append
- -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
- -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
- -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
- -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
- -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
+ -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Optimizer: Postgres query optimizer
(9 rows)
-- Since col a is asc in index, max(a) could use a backward index scan
explain(costs off) select max(a) from test_partition_table;
- QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
Result
InitPlan 1 (returns $0) (slice1)
-> Limit
-> Gather Motion 3:1 (slice2; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> Append
- -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
+ -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
Index Cond: (a IS NOT NULL)
- -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
+ -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
Index Cond: (a IS NOT NULL)
- -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
+ -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
Index Cond: (a IS NOT NULL)
- -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
+ -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
Index Cond: (a IS NOT NULL)
- -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Index Cond: (a IS NOT NULL)
Optimizer: Postgres query optimizer
(17 rows)
-- Cases with a predicate and order by (with/without limit). Order by columns commutating index column
explain(costs off) select * from test_partition_table where a BETWEEN 40 and 4000 or c not between 4000 and 6000 order by a desc;
- QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> Append
- -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
+ -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
Filter: (((a >= 40) AND (a <= 4000)) OR (c < '4000'::double precision) OR (c > '6000'::double precision))
- -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
+ -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
Filter: (((a >= 40) AND (a <= 4000)) OR (c < '4000'::double precision) OR (c > '6000'::double precision))
- -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
+ -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
Filter: (((a >= 40) AND (a <= 4000)) OR (c < '4000'::double precision) OR (c > '6000'::double precision))
- -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
+ -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
Filter: (((a >= 40) AND (a <= 4000)) OR (c < '4000'::double precision) OR (c > '6000'::double precision))
- -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Filter: (((a >= 40) AND (a <= 4000)) OR (c < '4000'::double precision) OR (c > '6000'::double precision))
Optimizer: Postgres query optimizer
(14 rows)
explain(costs off) select * from test_partition_table where a>7 order by a desc limit 4;
- QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> Limit
-> Append
- -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
+ -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
Index Cond: (a > 7)
- -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
+ -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
Index Cond: (a > 7)
- -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
+ -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
Index Cond: (a > 7)
- -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
+ -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
Index Cond: (a > 7)
- -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Index Cond: (a > 7)
Optimizer: Postgres query optimizer
(16 rows)
-- Cases with group by, order by (with/without limit). Order by cols commutating index column
explain(costs off) select a, sum(d) from test_partition_table group by a order by a desc;
- QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> GroupAggregate
- Group Key: test_partition_table_1_prt_5.a
+ Group Key: test_partition_table.a
-> Append
- -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
- -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
- -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
- -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
- -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
+ -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Optimizer: Postgres query optimizer
(11 rows)
explain(costs off) select a, sum(d) from test_partition_table group by a order by a desc limit 3;
- QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> Limit
-> GroupAggregate
- Group Key: test_partition_table_1_prt_5.a
+ Group Key: test_partition_table.a
-> Append
- -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
- -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
- -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
- -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
- -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
+ -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Optimizer: Postgres query optimizer
(13 rows)
-- Case with group by, order by and a having clause (with/without limit). Order by cols commutating index.
explain(costs off) select a, sum(d) from test_partition_table group by a having a>30 order by a desc;
- QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> GroupAggregate
- Group Key: test_partition_table_1_prt_5.a
+ Group Key: test_partition_table.a
-> Append
- -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
+ -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
Index Cond: (a > 30)
- -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
+ -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
Index Cond: (a > 30)
- -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
+ -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
Index Cond: (a > 30)
- -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
+ -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
Index Cond: (a > 30)
- -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Index Cond: (a > 30)
Optimizer: Postgres query optimizer
(16 rows)
explain(costs off) select a, sum(d) from test_partition_table group by a having a>30 order by a desc;
- QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> GroupAggregate
- Group Key: test_partition_table_1_prt_5.a
+ Group Key: test_partition_table.a
-> Append
- -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
+ -> Index Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
Index Cond: (a > 30)
- -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
+ -> Index Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
Index Cond: (a > 30)
- -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
+ -> Index Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
Index Cond: (a > 30)
- -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
+ -> Index Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
Index Cond: (a > 30)
- -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Index Cond: (a > 30)
Optimizer: Postgres query optimizer
(16 rows)
-- Case with ordering via over() using window aggregates (with/without limit): rank(), row_number(), percent_rank() etc...
explain(costs off) select a, rank() over (order by a desc) from test_partition_table;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------------------
WindowAgg
- Order By: test_partition_table_1_prt_5.a
+ Order By: test_partition_table.a
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> Append
- -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
- -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
- -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
- -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
- -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
+ -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Optimizer: Postgres query optimizer
(11 rows)
explain(costs off) select a, rank() over (order by a desc) from test_partition_table limit 3;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------------------------
Limit
-> WindowAgg
- Order By: test_partition_table_1_prt_5.a
+ Order By: test_partition_table.a
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> Append
- -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
- -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
- -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
- -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
- -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
+ -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Optimizer: Postgres query optimizer
(12 rows)
-- Case with distinct and order by (with/without limit)
explain(costs off) select distinct(a) from test_partition_table order by a desc;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> Unique
- Group Key: test_partition_table_1_prt_5.a
+ Group Key: test_partition_table.a
-> Append
- -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
- -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
- -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
- -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
- -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
+ -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Optimizer: Postgres query optimizer
(11 rows)
explain(costs off) select distinct(a) from test_partition_table order by a desc limit 3;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_5.a
+ Merge Key: test_partition_table.a
-> Limit
-> Unique
- Group Key: test_partition_table_1_prt_5.a
+ Group Key: test_partition_table.a
-> Append
- -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
- -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
- -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
- -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
- -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
+ -> Index Only Scan Backward using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
+ -> Index Only Scan Backward using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan Backward using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan Backward using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan Backward using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
Optimizer: Postgres query optimizer
(13 rows)
-- Order by within a CTE without limit
explain(costs off) with sorted_by_a as (select a from test_partition_table order by a) select a from sorted_by_a;
- QUERY PLAN
-------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
-> Append
- -> Index Only Scan using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
- -> Index Only Scan using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
- -> Index Only Scan using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
- -> Index Only Scan using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
- -> Index Only Scan using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
+ -> Index Only Scan using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
+ -> Index Only Scan using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
Optimizer: Postgres query optimizer
(8 rows)
-- Order by within a CTE, with limit outside CTE expression
explain(costs off) with sorted_by_a as (select a from test_partition_table order by a) select a from sorted_by_a limit 3;
- QUERY PLAN
-------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_1.a
+ Merge Key: test_partition_table.a
-> Limit
-> Append
- -> Index Only Scan using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1
- -> Index Only Scan using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2
- -> Index Only Scan using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3
- -> Index Only Scan using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4
- -> Index Only Scan using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5
+ -> Index Only Scan using test_partition_table_1_prt_1_a_idx on test_partition_table_1_prt_1 test_partition_table_1
+ -> Index Only Scan using test_partition_table_1_prt_2_a_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan using test_partition_table_1_prt_3_a_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan using test_partition_table_1_prt_4_a_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan using test_partition_table_1_prt_5_a_idx on test_partition_table_1_prt_5 test_partition_table_5
Optimizer: Postgres query optimizer
(11 rows)
@@ -3102,17 +3110,17 @@ explain(costs off) with sorted_by_a as (select a from test_partition_table order
-- the output cols and hence alternative isn't added. This issue has to be fixed after adding support for MergeAppend.
vacuum test_partition_table;
explain(costs off) select b,c,d from test_partition_table order by b desc, c desc, d desc;
- QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: test_partition_table_1_prt_1.b, test_partition_table_1_prt_1.c, test_partition_table_1_prt_1.d
+ Merge Key: test_partition_table.b, test_partition_table.c, test_partition_table.d
-> Merge Append
- Sort Key: test_partition_table_1_prt_1.b DESC, test_partition_table_1_prt_1.c DESC, test_partition_table_1_prt_1.d DESC
- -> Index Only Scan Backward using test_partition_table_1_prt_1_b_c_d_idx on test_partition_table_1_prt_1
- -> Index Only Scan Backward using test_partition_table_1_prt_2_b_c_d_idx on test_partition_table_1_prt_2
- -> Index Only Scan Backward using test_partition_table_1_prt_3_b_c_d_idx on test_partition_table_1_prt_3
- -> Index Only Scan Backward using test_partition_table_1_prt_4_b_c_d_idx on test_partition_table_1_prt_4
- -> Index Only Scan Backward using test_partition_table_1_prt_5_b_c_d_idx on test_partition_table_1_prt_5
+ Sort Key: test_partition_table.b DESC, test_partition_table.c DESC, test_partition_table.d DESC
+ -> Index Only Scan Backward using test_partition_table_1_prt_1_b_c_d_idx on test_partition_table_1_prt_1 test_partition_table_1
+ -> Index Only Scan Backward using test_partition_table_1_prt_2_b_c_d_idx on test_partition_table_1_prt_2 test_partition_table_2
+ -> Index Only Scan Backward using test_partition_table_1_prt_3_b_c_d_idx on test_partition_table_1_prt_3 test_partition_table_3
+ -> Index Only Scan Backward using test_partition_table_1_prt_4_b_c_d_idx on test_partition_table_1_prt_4 test_partition_table_4
+ -> Index Only Scan Backward using test_partition_table_1_prt_5_b_c_d_idx on test_partition_table_1_prt_5 test_partition_table_5
Optimizer: Postgres query optimizer
(10 rows)
@@ -3139,54 +3147,54 @@ set enable_seqscan to off;
-- 'index_salary', but ORCA since it doesn't generate DynamicIndexScan
-- alternative uses NL join with a Sort operator.
explain(costs off) select e.id, e.name, e.salary, d.dep_name from part_employee e join part_department d on e.id=d.dep_id order by e.id desc;
- QUERY PLAN
+ QUERY PLAN
-------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: e_4.id
+ Merge Key: e.id
-> Nested Loop
- Join Filter: (e_4.id = d.dep_id)
+ Join Filter: (e.id = d.dep_id)
-> Append
Partition Selectors: $0
- -> Index Scan Backward using part_employee_1_prt_5_id_idx on part_employee_1_prt_5 e_4
- -> Index Scan Backward using part_employee_1_prt_4_id_idx on part_employee_1_prt_4 e_3
- -> Index Scan Backward using part_employee_1_prt_3_id_idx on part_employee_1_prt_3 e_2
- -> Index Scan Backward using part_employee_1_prt_2_id_idx on part_employee_1_prt_2 e_1
- -> Index Scan Backward using part_employee_1_prt_1_id_idx on part_employee_1_prt_1 e
+ -> Index Scan Backward using part_employee_1_prt_5_id_idx on part_employee_1_prt_5 e_5
+ -> Index Scan Backward using part_employee_1_prt_4_id_idx on part_employee_1_prt_4 e_4
+ -> Index Scan Backward using part_employee_1_prt_3_id_idx on part_employee_1_prt_3 e_3
+ -> Index Scan Backward using part_employee_1_prt_2_id_idx on part_employee_1_prt_2 e_2
+ -> Index Scan Backward using part_employee_1_prt_1_id_idx on part_employee_1_prt_1 e_1
-> Materialize
-> Partition Selector (selector id: $0)
-> Append
- -> Seq Scan on part_department_1_prt_1 d
- -> Seq Scan on part_department_1_prt_2 d_1
- -> Seq Scan on part_department_1_prt_3 d_2
- -> Seq Scan on part_department_1_prt_4 d_3
- -> Seq Scan on part_department_1_prt_5 d_4
+ -> Seq Scan on part_department_1_prt_1 d_1
+ -> Seq Scan on part_department_1_prt_2 d_2
+ -> Seq Scan on part_department_1_prt_3 d_3
+ -> Seq Scan on part_department_1_prt_4 d_4
+ -> Seq Scan on part_department_1_prt_5 d_5
Optimizer: Postgres query optimizer
(20 rows)
explain(costs off) select e.id, e.name, e.salary, d.dep_name from part_employee e join part_department d on e.id=d.dep_id order by e.id desc limit 3;
- QUERY PLAN
+ QUERY PLAN
-------------------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: e_4.id
+ Merge Key: e.id
-> Limit
-> Nested Loop
- Join Filter: (e_4.id = d.dep_id)
+ Join Filter: (e.id = d.dep_id)
-> Append
Partition Selectors: $0
- -> Index Scan Backward using part_employee_1_prt_5_id_idx on part_employee_1_prt_5 e_4
- -> Index Scan Backward using part_employee_1_prt_4_id_idx on part_employee_1_prt_4 e_3
- -> Index Scan Backward using part_employee_1_prt_3_id_idx on part_employee_1_prt_3 e_2
- -> Index Scan Backward using part_employee_1_prt_2_id_idx on part_employee_1_prt_2 e_1
- -> Index Scan Backward using part_employee_1_prt_1_id_idx on part_employee_1_prt_1 e
+ -> Index Scan Backward using part_employee_1_prt_5_id_idx on part_employee_1_prt_5 e_5
+ -> Index Scan Backward using part_employee_1_prt_4_id_idx on part_employee_1_prt_4 e_4
+ -> Index Scan Backward using part_employee_1_prt_3_id_idx on part_employee_1_prt_3 e_3
+ -> Index Scan Backward using part_employee_1_prt_2_id_idx on part_employee_1_prt_2 e_2
+ -> Index Scan Backward using part_employee_1_prt_1_id_idx on part_employee_1_prt_1 e_1
-> Materialize
-> Partition Selector (selector id: $0)
-> Append
- -> Seq Scan on part_department_1_prt_1 d
- -> Seq Scan on part_department_1_prt_2 d_1
- -> Seq Scan on part_department_1_prt_3 d_2
- -> Seq Scan on part_department_1_prt_4 d_3
- -> Seq Scan on part_department_1_prt_5 d_4
+ -> Seq Scan on part_department_1_prt_1 d_1
+ -> Seq Scan on part_department_1_prt_2 d_2
+ -> Seq Scan on part_department_1_prt_3 d_3
+ -> Seq Scan on part_department_1_prt_4 d_4
+ -> Seq Scan on part_department_1_prt_5 d_5
Optimizer: Postgres query optimizer
(22 rows)
@@ -3216,22 +3224,22 @@ INSERT INTO part_table2 select i, i from generate_series(1,99)i;
ANALYZE part_table1;
ANALYZE part_table2;
explain(costs off) select a from part_table1 union all select a from part_table2 order by a desc;
- QUERY PLAN
----------------------------------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: part_table1_1_prt_5.a
+ Merge Key: part_table1_4.a
-> Merge Append
- Sort Key: part_table1_1_prt_5.a DESC
- -> Index Only Scan Backward using part_table1_1_prt_5_a_idx on part_table1_1_prt_5
- -> Index Only Scan Backward using part_table1_1_prt_4_a_idx on part_table1_1_prt_4
- -> Index Only Scan Backward using part_table1_1_prt_3_a_idx on part_table1_1_prt_3
- -> Index Only Scan Backward using part_table1_1_prt_2_a_idx on part_table1_1_prt_2
- -> Index Only Scan Backward using part_table1_1_prt_1_a_idx on part_table1_1_prt_1
- -> Index Only Scan Backward using part_table2_1_prt_5_a_idx on part_table2_1_prt_5
- -> Index Only Scan Backward using part_table2_1_prt_4_a_idx on part_table2_1_prt_4
- -> Index Only Scan Backward using part_table2_1_prt_3_a_idx on part_table2_1_prt_3
- -> Index Only Scan Backward using part_table2_1_prt_2_a_idx on part_table2_1_prt_2
- -> Index Only Scan Backward using part_table2_1_prt_1_a_idx on part_table2_1_prt_1
+ Sort Key: part_table1_4.a DESC
+ -> Index Only Scan Backward using part_table1_1_prt_5_a_idx on part_table1_1_prt_5 part_table1_4
+ -> Index Only Scan Backward using part_table1_1_prt_4_a_idx on part_table1_1_prt_4 part_table1_3
+ -> Index Only Scan Backward using part_table1_1_prt_3_a_idx on part_table1_1_prt_3 part_table1_2
+ -> Index Only Scan Backward using part_table1_1_prt_2_a_idx on part_table1_1_prt_2 part_table1_1
+ -> Index Only Scan Backward using part_table1_1_prt_1_a_idx on part_table1_1_prt_1 part_table1
+ -> Index Only Scan Backward using part_table2_1_prt_5_a_idx on part_table2_1_prt_5 part_table2_4
+ -> Index Only Scan Backward using part_table2_1_prt_4_a_idx on part_table2_1_prt_4 part_table2_3
+ -> Index Only Scan Backward using part_table2_1_prt_3_a_idx on part_table2_1_prt_3 part_table2_2
+ -> Index Only Scan Backward using part_table2_1_prt_2_a_idx on part_table2_1_prt_2 part_table2_1
+ -> Index Only Scan Backward using part_table2_1_prt_1_a_idx on part_table2_1_prt_1 part_table2
Optimizer: Postgres query optimizer
(15 rows)
diff --git a/src/test/regress/expected/qp_indexscan_optimizer.out b/src/test/regress/expected/qp_indexscan_optimizer.out
index 7f2fcc5b9a..1d9f59245f 100644
--- a/src/test/regress/expected/qp_indexscan_optimizer.out
+++ b/src/test/regress/expected/qp_indexscan_optimizer.out
@@ -1050,16 +1050,18 @@ select e,d,a from zoo order by e desc,d nulls first,a desc offset 9997;
-- Validate if Backward IndexScan is chosen for query with offset value in subquery
-- ORCA_FEATURE_NOT_SUPPORTED: ORCA doesn't support limit or offset values specified as part of a subquery
explain (costs off) select c from zoo order by c desc nulls last offset (select 9997);
- QUERY PLAN
-------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------
Limit
InitPlan 1 (returns $0) (slice2)
-> Result
-> Gather Motion 3:1 (slice1; segments: 3)
Merge Key: zoo.c
- -> Index Only Scan Backward using dir_index_c on zoo
+ -> Sort
+ Sort Key: zoo.c DESC NULLS LAST
+ -> Seq Scan on zoo
Optimizer: Postgres query optimizer
-(7 rows)
+(9 rows)
select c from zoo order by c desc nulls last offset (select 9997);
c
@@ -2331,30 +2333,30 @@ ANALYZE tbl_range;
-- Demonstrate that Planner could use IndexScan with MergeAppend for these cases
set enable_seqscan to off;
explain(costs off) select * from tbl_range order by col1, col2 limit 3;
- QUERY PLAN
------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: p1.col1, p1.col2
+ Merge Key: tbl_range.col1, tbl_range.col2
-> Limit
-> Append
- -> Index Scan using p1_col1_col2_idx on p1
- -> Index Scan using p2_col1_col2_idx on p2
- -> Index Scan using p3_col1_col2_idx on p3
+ -> Index Scan using p1_col1_col2_idx on p1 tbl_range_1
+ -> Index Scan using p2_col1_col2_idx on p2 tbl_range_2
+ -> Index Scan using p3_col1_col2_idx on p3 tbl_range_3
Optimizer: Postgres query optimizer
(9 rows)
explain(costs off) select * from tbl_range order by col1 limit 3;
- QUERY PLAN
------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: p1.col1
+ Merge Key: tbl_range.col1
-> Limit
-> Append
- -> Index Scan using p1_col1_col2_idx on p1
- -> Index Scan using p2_col1_col2_idx on p2
- -> Index Scan using p3_col1_col2_idx on p3
+ -> Index Scan using p1_col1_col2_idx on p1 tbl_range_1
+ -> Index Scan using p2_col1_col2_idx on p2 tbl_range_2
+ -> Index Scan using p3_col1_col2_idx on p3 tbl_range_3
Optimizer: Postgres query optimizer
(9 rows)
@@ -2372,16 +2374,16 @@ NOTICE: table has parent, setting distribution columns to match parent table
CREATE INDEX idx_on_year ON sales_data USING btree(year desc);
ANALYZE sales_data;
explain(costs off) select * from sales_data order by year desc limit 3;
- QUERY PLAN
-----------------------------------------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: sales_data_uk_18_20.year
+ Merge Key: sales_data_1.year
-> Limit
-> Merge Append
- Sort Key: sales_data_uk_18_20.year DESC
- -> Index Scan using sales_data_uk_18_20_year_idx on sales_data_uk_18_20
- -> Index Scan using sales_data_us_18_20_year_idx on sales_data_us_18_20
+ Sort Key: sales_data_1.year DESC
+ -> Index Scan using sales_data_uk_18_20_year_idx on sales_data_uk_18_20 sales_data_1
+ -> Index Scan using sales_data_us_18_20_year_idx on sales_data_us_18_20 sales_data_2
Optimizer: Postgres query optimizer
(9 rows)
@@ -2397,16 +2399,16 @@ NOTICE: table has parent, setting distribution columns to match parent table
CREATE INDEX idx_on_tbl_hash ON tbl_hash using btree(col1);
ANALYZE tbl_hash;
explain(costs off) select * from tbl_hash order by col1 limit 3;
- QUERY PLAN
-------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------------
Limit
-> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: p1.col1
+ Merge Key: tbl_hash.col1
-> Limit
-> Merge Append
- Sort Key: p1.col1
- -> Index Scan using p1_col1_idx on p1
- -> Index Scan using p2_col1_idx on p2
+ Sort Key: tbl_hash.col1
+ -> Index Scan using p1_col1_idx on p1 tbl_hash_1
+ -> Index Scan using p2_col1_idx on p2 tbl_hash_2
Optimizer: Postgres query optimizer
(9 rows)
diff --git a/src/test/regress/expected/qp_join_universal.out b/src/test/regress/expected/qp_join_universal.out
index 4c5c795a61..294b8b7735 100644
--- a/src/test/regress/expected/qp_join_universal.out
+++ b/src/test/regress/expected/qp_join_universal.out
@@ -67,18 +67,14 @@ set optimizer_enable_hashjoin = on;
-- hash the much smaller universal table, instead of
-- the much larger distributed table.
explain (analyze, costs off, timing off, summary off) select * from dist join const_tvf(1) ct(c1) on dist.c1 = ct.c1;
- QUERY PLAN
--------------------------------------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3) (actual rows=1 loops=1)
- -> Hash Join (actual rows=1 loops=1)
- Hash Cond: (dist.c1 = ct.c1)
- Extra Text: (seg1) Hash chain length 1.0 avg, 1 max, using 1 of 262144 buckets.
- -> Seq Scan on dist (actual rows=340 loops=1)
- -> Hash (actual rows=1 loops=1)
- Buckets: 262144 Batches: 1 Memory Usage: 2049kB
- -> Function Scan on ct (actual rows=1 loops=1)
+ QUERY PLAN
+------------------------------------------------------------------
+ Gather Motion 1:1 (slice1; segments: 1) (actual rows=1 loops=1)
+ -> Seq Scan on dist (actual rows=1 loops=1)
+ Filter: (c1 = 1)
+ Rows Removed by Filter: 321
Optimizer: Postgres query optimizer
-(9 rows)
+(5 rows)
explain (analyze, costs off, timing off, summary off) select * from dist join unnest_arr on dist.c1 = unnest_arr.c1;
QUERY PLAN
@@ -119,18 +115,14 @@ explain (analyze, costs off, timing off, summary off) select * from dist join ge
-- operations are expected to fluctuate in randomly
-- distributed tables.)
explain (analyze, timing off, summary off) select * from rand join const_tvf(1) ct(c1) on rand.c1 = ct.c1;
- QUERY PLAN
------------------------------------------------------------------------------------------------------
- Gather Motion 3:1 (slice1; segments: 3) (cost=0.02..5.35 rows=10 width=8) (actual rows=1 loops=1)
- -> Hash Join (cost=0.02..5.22 rows=3 width=8) (actual rows=1 loops=1)
- Hash Cond: (rand.c1 = ct.c1)
- Extra Text: (seg2) Hash chain length 1.0 avg, 1 max, using 1 of 262144 buckets.
- -> Seq Scan on rand (cost=0.00..4.33 rows=333 width=4) (actual rows=346 loops=1)
- -> Hash (cost=0.01..0.01 rows=1 width=4) (actual rows=1 loops=1)
- Buckets: 262144 Batches: 1 Memory Usage: 2049kB
- -> Function Scan on ct (cost=0.00..0.01 rows=1 width=4) (actual rows=1 loops=1)
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..5.18 rows=1 width=8) (actual rows=1 loops=1)
+ -> Seq Scan on rand (cost=0.00..5.16 rows=1 width=8) (actual rows=1 loops=1)
+ Filter: (c1 = 1)
+ Rows Removed by Filter: 346
Optimizer: Postgres query optimizer
-(9 rows)
+(5 rows)
explain (analyze, timing off, summary off) select * from rand join unnest_arr on rand.c1 = unnest_arr.c1;
QUERY PLAN
@@ -168,18 +160,14 @@ explain (analyze, timing off, summary off) select * from rand join gen_series on
-- This is achieved by a one-time segment filter
-- (duplicate-sensitive random motion).
explain (analyze, costs off, timing off, summary off) select * from rep join const_tvf(1) ct(c1) on rep.c1 = ct.c1;
- QUERY PLAN
-----------------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------------
Gather Motion 1:1 (slice1; segments: 1) (actual rows=1 loops=1)
- -> Hash Join (actual rows=1 loops=1)
- Hash Cond: (rep.c1 = ct.c1)
- Extra Text: Hash chain length 1.0 avg, 1 max, using 1 of 262144 buckets.
- -> Seq Scan on rep (actual rows=999 loops=1)
- -> Hash (actual rows=1 loops=1)
- Buckets: 262144 Batches: 1 Memory Usage: 2049kB
- -> Function Scan on ct (actual rows=1 loops=1)
+ -> Seq Scan on rep (actual rows=1 loops=1)
+ Filter: (c1 = 1)
+ Rows Removed by Filter: 998
Optimizer: Postgres query optimizer
-(9 rows)
+(5 rows)
explain (analyze, costs off, timing off, summary off) select * from rep join unnest_arr on rep.c1 = unnest_arr.c1;
QUERY PLAN
@@ -217,36 +205,27 @@ explain (analyze, costs off, timing off, summary off) select * from rep join gen
-- when the inner side is universal. This allows the
-- propagation of the partition selector, and enables DPE.
explain (analyze, costs off, timing off, summary off) select * from part join const_tvf(1) ct(c1) on part.c2 = ct.c1;
- QUERY PLAN
--------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=100 loops=1)
- -> Hash Join (actual rows=43 loops=1)
- Hash Cond: (part_1_prt_part3.c2 = ct.c1)
- Extra Text: (seg0) Hash chain length 1.0 avg, 1 max, using 1 of 262144 buckets.
- -> Append (actual rows=150 loops=1)
- Partition Selectors: $0
- -> Seq Scan on part_1_prt_part3 (never executed)
- -> Seq Scan on part_1_prt_part1 (actual rows=150 loops=1)
- -> Seq Scan on part_1_prt_part2 (never executed)
- -> Hash (actual rows=1 loops=1)
- Buckets: 262144 Batches: 1 Memory Usage: 2049kB
- -> Partition Selector (selector id: $0) (actual rows=1 loops=1)
- -> Function Scan on ct (actual rows=1 loops=1)
+ -> Seq Scan on part_1_prt_part1 part (actual rows=43 loops=1)
+ Filter: (c2 = 1)
+ Rows Removed by Filter: 107
Optimizer: Postgres query optimizer
-(14 rows)
+(5 rows)
explain (analyze, costs off, timing off, summary off) select * from part join unnest_arr on part.c2 = unnest_arr.c1;
- QUERY PLAN
-------------------------------------------------------------------------------------------------
+ QUERY PLAN
+-------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=399 loops=1)
-> Hash Join (actual rows=150 loops=1)
- Hash Cond: (part_1_prt_part3.c2 = (((unnest('{-3,-2,-1,0,1,2,3}'::text[])))::integer))
+ Hash Cond: (part.c2 = (((unnest('{-3,-2,-1,0,1,2,3}'::text[])))::integer))
Extra Text: (seg0) Hash chain length 1.0 avg, 1 max, using 7 of 524288 buckets.
-> Append (actual rows=245 loops=1)
Partition Selectors: $0
- -> Seq Scan on part_1_prt_part3 (actual rows=106 loops=1)
- -> Seq Scan on part_1_prt_part1 (actual rows=150 loops=1)
- -> Seq Scan on part_1_prt_part2 (never executed)
+ -> Seq Scan on part_1_prt_part3 part_1 (actual rows=106 loops=1)
+ -> Seq Scan on part_1_prt_part1 part_2 (actual rows=150 loops=1)
+ -> Seq Scan on part_1_prt_part2 part_3 (never executed)
-> Hash (actual rows=7 loops=1)
Buckets: 524288 Batches: 1 Memory Usage: 4097kB
-> Partition Selector (selector id: $0) (actual rows=7 loops=1)
@@ -261,13 +240,13 @@ explain (analyze, costs off, timing off, summary off) select * from part join ge
--------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=999 loops=1)
-> Hash Join (actual rows=340 loops=1)
- Hash Cond: (part_1_prt_part3.c2 = (generate_series('-10'::integer, 10)))
+ Hash Cond: (part.c2 = (generate_series('-10'::integer, 10)))
Extra Text: (seg2) Hash chain length 1.0 avg, 1 max, using 21 of 524288 buckets.
-> Append (actual rows=340 loops=1)
Partition Selectors: $0
- -> Seq Scan on part_1_prt_part3 (actual rows=106 loops=1)
- -> Seq Scan on part_1_prt_part1 (actual rows=150 loops=1)
- -> Seq Scan on part_1_prt_part2 (actual rows=113 loops=1)
+ -> Seq Scan on part_1_prt_part3 part_1 (actual rows=106 loops=1)
+ -> Seq Scan on part_1_prt_part1 part_2 (actual rows=150 loops=1)
+ -> Seq Scan on part_1_prt_part2 part_3 (actual rows=113 loops=1)
-> Hash (actual rows=21 loops=1)
Buckets: 524288 Batches: 1 Memory Usage: 4097kB
-> Partition Selector (selector id: $0) (actual rows=21 loops=1)
@@ -280,18 +259,17 @@ explain (analyze, costs off, timing off, summary off) select * from part join ge
-- We get the same plans as those of the inner join,
-- since the outer table is deduplicated.
explain (analyze, costs off, timing off, summary off) select * from dist left join const_tvf(1) ct(c1) on dist.c1 = ct.c1;
- QUERY PLAN
--------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=999 loops=1)
- -> Hash Left Join (actual rows=340 loops=1)
- Hash Cond: (dist.c1 = ct.c1)
- Extra Text: (seg2) Hash chain length 1.0 avg, 1 max, using 1 of 262144 buckets.
+ -> Nested Loop Left Join (actual rows=340 loops=1)
+ Join Filter: (dist.c1 = 1)
+ Rows Removed by Join Filter: 340
-> Seq Scan on dist (actual rows=340 loops=1)
- -> Hash (actual rows=1 loops=1)
- Buckets: 262144 Batches: 1 Memory Usage: 2049kB
- -> Function Scan on ct (actual rows=1 loops=1)
+ -> Materialize (actual rows=1 loops=340)
+ -> Result (actual rows=1 loops=1)
Optimizer: Postgres query optimizer
-(9 rows)
+(8 rows)
explain (analyze, costs off, timing off, summary off) select * from dist left join unnest_arr on dist.c1 = unnest_arr.c1;
QUERY PLAN
@@ -432,12 +410,11 @@ explain (analyze, costs off, timing off, summary off) select * from dist join co
QUERY PLAN
------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=0 loops=1)
- -> Nested Loop (actual rows=0 loops=1)
- Join Filter: (dist.c1 < ct.c1)
- -> Function Scan on ct (actual rows=1 loops=1)
- -> Seq Scan on dist (actual rows=340 loops=1)
+ -> Seq Scan on dist (actual rows=0 loops=1)
+ Filter: (c1 < 1)
+ Rows Removed by Filter: 337
Optimizer: Postgres query optimizer
-(6 rows)
+(5 rows)
explain (analyze, costs off, timing off, summary off) select * from dist join unnest_arr on dist.c1 < unnest_arr.c1;
QUERY PLAN
diff --git a/src/test/regress/expected/qp_join_universal_optimizer.out b/src/test/regress/expected/qp_join_universal_optimizer.out
index 258a204739..3bec51ee4f 100644
--- a/src/test/regress/expected/qp_join_universal_optimizer.out
+++ b/src/test/regress/expected/qp_join_universal_optimizer.out
@@ -445,10 +445,11 @@ explain (analyze, costs off, timing off, summary off) select * from dist join co
Gather Motion 3:1 (slice1; segments: 3) (actual rows=0 loops=1)
-> Nested Loop (actual rows=0 loops=1)
Join Filter: (c1 < (1))
+ Rows Removed by Join Filter: 337
-> Result (actual rows=1 loops=1)
-> Seq Scan on dist (actual rows=170 loops=2)
Optimizer: Pivotal Optimizer (GPORCA)
-(6 rows)
+(7 rows)
explain (analyze, costs off, timing off, summary off) select * from dist join unnest_arr on dist.c1 < unnest_arr.c1;
QUERY PLAN
diff --git a/src/test/regress/expected/qp_orca_fallback_optimizer.out b/src/test/regress/expected/qp_orca_fallback_optimizer.out
index b7b27e8725..fabbba4cb0 100644
--- a/src/test/regress/expected/qp_orca_fallback_optimizer.out
+++ b/src/test/regress/expected/qp_orca_fallback_optimizer.out
@@ -318,7 +318,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
explain delete from ext_part where a=1;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Delete with External/foreign partition storage types
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(delete) on partitioned tables
QUERY PLAN
-----------------------------------------------------------------------
Delete on ext_part (cost=0.00..435.25 rows=0 width=0)
@@ -330,5 +330,10 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
explain update ext_part set a=1;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Update with External/foreign partition storage types
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: DML(update) on partitioned tables
ERROR: cannot update foreign table "p2_ext"
+-- start_ignore
+-- FIXME: gpcheckcat fails due to mismatching distribution policy if this table isn't dropped
+-- Keep this table around once this is fixed
+drop table ext_part;
+-- end_ignore
diff --git a/src/test/regress/expected/qp_with_clause_optimizer.out b/src/test/regress/expected/qp_with_clause_optimizer.out
index 8b1a6f9351..69f24d2159 100644
--- a/src/test/regress/expected/qp_with_clause_optimizer.out
+++ b/src/test/regress/expected/qp_with_clause_optimizer.out
@@ -9518,7 +9518,7 @@ and country.indepyear > 1900
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
@@ -9528,7 +9528,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
View "qp_with_clause.view_with_shared_scans"
Column | Type | Collation | Nullable | Default | Storage | Description
---------------------+------------------+-----------+----------+---------+----------+-------------
diff --git a/src/test/regress/expected/select_optimizer.out b/src/test/regress/expected/select_optimizer.out
index a40e6fa177..9a3592bea0 100644
--- a/src/test/regress/expected/select_optimizer.out
+++ b/src/test/regress/expected/select_optimizer.out
@@ -887,15 +887,19 @@ RESET enable_indexscan;
explain (costs off)
select unique1, unique2 from onek2
where (unique2 = 11 or unique1 = 0) and stringu1 < 'B';
- QUERY PLAN
----------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
-> Bitmap Heap Scan on onek2
- Recheck Cond: (stringu1 < 'B'::name)
- Filter: ((unique2 = 11) OR (unique1 = 0))
- -> Bitmap Index Scan on onek2_u2_prtl
+ Recheck Cond: (((unique2 = 11) AND (stringu1 < 'B'::name)) OR (unique1 = 0))
+ Filter: (stringu1 < 'B'::name)
+ -> BitmapOr
+ -> Bitmap Index Scan on onek2_u2_prtl
+ Index Cond: (unique2 = 11)
+ -> Bitmap Index Scan on onek2_u1_prtl
+ Index Cond: (unique1 = 0)
Optimizer: Postgres query optimizer
-(6 rows)
+(10 rows)
select unique1, unique2 from onek2
where (unique2 = 11 or unique1 = 0) and stringu1 < 'B';
diff --git a/src/test/regress/expected/subselect_gp_optimizer.out b/src/test/regress/expected/subselect_gp_optimizer.out
index 1c8f1f03f7..6de48b9748 100644
--- a/src/test/regress/expected/subselect_gp_optimizer.out
+++ b/src/test/regress/expected/subselect_gp_optimizer.out
@@ -288,8 +288,8 @@ select a from gs_tab t1 where b in
or (c >= 2))
or (b <= 3)
order by a;
- QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
Merge Key: gs_tab_2.a
-> Sort
@@ -298,28 +298,28 @@ order by a;
Filter: (CASE WHEN ((count((true))) > '0'::bigint) THEN CASE WHEN ((sum((CASE WHEN ((gs_tab_2.b = gs_tab_1.b) IS NULL) THEN 1 ELSE 0 END))) = (count((true)))) THEN NULL::boolean ELSE true END ELSE false END OR (gs_tab_2.b <= 3))
-> GroupAggregate
Group Key: gs_tab_2.a, gs_tab_2.b, gs_tab_2.ctid, gs_tab_2.gp_segment_id
- -> Sort
- Sort Key: gs_tab_2.a, gs_tab_2.b, gs_tab_2.ctid, gs_tab_2.gp_segment_id
- -> Nested Loop Left Join
- Join Filter: ((gs_tab_2.b = gs_tab_1.b) IS NOT FALSE)
+ -> Nested Loop Left Join
+ Join Filter: ((gs_tab_2.b = gs_tab_1.b) IS NOT FALSE)
+ -> Sort
+ Sort Key: gs_tab_2.a, gs_tab_2.b, gs_tab_2.ctid, gs_tab_2.gp_segment_id
-> Seq Scan on gs_tab gs_tab_2
- -> Materialize
- -> Result
- -> Broadcast Motion 3:3 (slice2; segments: 3)
- -> Result
- Filter: (CASE WHEN ((count((true))) > '0'::bigint) THEN CASE WHEN ((sum((CASE WHEN ((gs_tab_1.c = gs_tab.c) IS NULL) THEN 1 ELSE 0 END))) = (count((true)))) THEN NULL::boolean ELSE true END ELSE false END OR (gs_tab_1.c >= 2))
- -> GroupAggregate
- Group Key: gs_tab_1.a, gs_tab_1.b, gs_tab_1.c, gs_tab_1.ctid, gs_tab_1.gp_segment_id
+ -> Materialize
+ -> Result
+ -> Broadcast Motion 3:3 (slice2; segments: 3)
+ -> Result
+ Filter: (CASE WHEN ((count((true))) > '0'::bigint) THEN CASE WHEN ((sum((CASE WHEN ((gs_tab_1.c = gs_tab.c) IS NULL) THEN 1 ELSE 0 END))) = (count((true)))) THEN NULL::boolean ELSE true END ELSE false END OR (gs_tab_1.c >= 2))
+ -> GroupAggregate
+ Group Key: gs_tab_1.a, gs_tab_1.b, gs_tab_1.c, gs_tab_1.ctid, gs_tab_1.gp_segment_id
+ -> Nested Loop Left Join
+ Join Filter: ((gs_tab_1.c = gs_tab.c) IS NOT FALSE)
-> Sort
Sort Key: gs_tab_1.a, gs_tab_1.b, gs_tab_1.c, gs_tab_1.ctid, gs_tab_1.gp_segment_id
- -> Nested Loop Left Join
- Join Filter: ((gs_tab_1.c = gs_tab.c) IS NOT FALSE)
- -> Seq Scan on gs_tab gs_tab_1
- -> Materialize
- -> Result
- -> Broadcast Motion 3:3 (slice3; segments: 3)
- -> Seq Scan on gs_tab
- Optimizer: Pivotal Optimizer (GPORCA)
+ -> Seq Scan on gs_tab gs_tab_1
+ -> Materialize
+ -> Result
+ -> Broadcast Motion 3:3 (slice3; segments: 3)
+ -> Seq Scan on gs_tab
+ Optimizer: GPORCA
(30 rows)
select a from gs_tab t1 where b in
diff --git a/src/test/regress/expected/subselect_optimizer.out b/src/test/regress/expected/subselect_optimizer.out
index 403f4929a5..b60d15f74d 100644
--- a/src/test/regress/expected/subselect_optimizer.out
+++ b/src/test/regress/expected/subselect_optimizer.out
@@ -1024,24 +1024,24 @@ analyze exists_tbl;
explain (costs off)
select * from exists_tbl t1
where (exists(select 1 from exists_tbl t2 where t1.c1 = t2.c2) or c3 < 0);
- QUERY PLAN
--------------------------------------------------------------------------------------------------------
- Finalize Aggregate
- -> Gather Motion 3:1 (slice1; segments: 3)
- -> Partial Aggregate
- -> Result
- Filter: ((COALESCE((count()), '0'::bigint) > '0'::bigint) OR (exists_tbl.c3 < 0))
- -> Hash Left Join
- Hash Cond: (exists_tbl.c1 = exists_tbl_1.c2)
- -> Dynamic Seq Scan on exists_tbl
- Number of partitions to scan: 2 (out of 2)
- -> Hash
- -> HashAggregate
- Group Key: exists_tbl_1.c2
- -> Redistribute Motion 3:3 (slice2; segments: 3)
- Hash Key: exists_tbl_1.c2
- -> Dynamic Seq Scan on exists_tbl exists_tbl_1
- Number of partitions to scan: 2 (out of 2)
+ QUERY PLAN
+-------------------------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Result
+ Filter: ((COALESCE((count()), '0'::bigint) > '0'::bigint) OR (exists_tbl.c3 < 0))
+ -> Hash Left Join
+ Hash Cond: (exists_tbl.c1 = exists_tbl_1.c2)
+ -> Dynamic Seq Scan on exists_tbl
+ Number of partitions to scan: 2 (out of 2)
+ -> Hash
+ -> GroupAggregate
+ Group Key: exists_tbl_1.c2
+ -> Sort
+ Sort Key: exists_tbl_1.c2
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: exists_tbl_1.c2
+ -> Dynamic Seq Scan on exists_tbl exists_tbl_1
+ Number of partitions to scan: 2 (out of 2)
Optimizer: Pivotal Optimizer (GPORCA)
(17 rows)
diff --git a/src/test/regress/expected/tsrf_optimizer.out b/src/test/regress/expected/tsrf_optimizer.out
index fc7c9529c8..20aaed2e82 100644
--- a/src/test/regress/expected/tsrf_optimizer.out
+++ b/src/test/regress/expected/tsrf_optimizer.out
@@ -108,8 +108,8 @@ SELECT unnest(ARRAY[1, 2]) FROM few WHERE false;
explain (verbose, costs off)
SELECT * FROM few f1,
(SELECT unnest(ARRAY[1,2]) FROM few f2 WHERE false OFFSET 0) ss;
- QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
Output: id, dataa, datab, (unnest('{1,2}'::integer[]))
-> Nested Loop
@@ -118,19 +118,13 @@ SELECT * FROM few f1,
-> ProjectSet
Output: unnest('{1,2}'::integer[])
-> Result
- Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer
+ Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer, NULL::oid
One-Time Filter: false
-> Seq Scan on public.few
Output: id, dataa, datab
- -> Materialize
- Output: (unnest('{1,2}'::integer[]))
- -> ProjectSet
- Output: unnest('{1,2}'::integer[])
- -> Result
- Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer, NULL::oid
- One-Time Filter: false
+ Settings: enable_parallel = 'off', optimizer = 'on'
Optimizer: Pivotal Optimizer (GPORCA)
-(13 rows)
+(14 rows)
SELECT * FROM few f1,
(SELECT unnest(ARRAY[1,2]) FROM few f2 WHERE false OFFSET 0) ss;
diff --git a/src/test/regress/expected/union_gp_optimizer.out b/src/test/regress/expected/union_gp_optimizer.out
index c0cd6453a2..10289eab98 100644
--- a/src/test/regress/expected/union_gp_optimizer.out
+++ b/src/test/regress/expected/union_gp_optimizer.out
@@ -303,12 +303,12 @@ set allow_system_table_mods = on;
update gp_distribution_policy set numsegments = 2
where localoid = 'rep2'::regclass;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
select localoid::regclass, policytype, numsegments
from gp_distribution_policy
where localoid::regclass in ('rep2', 'rep3');
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
localoid | policytype | numsegments
----------+------------+-------------
rep3 | r | 3
@@ -2134,11 +2134,11 @@ set allow_system_table_mods = on;
update gp_distribution_policy set numsegments = 1
where localoid = 'union_schema.t1'::regclass::oid;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
update gp_distribution_policy set numsegments = 2
where localoid = 'union_schema.t2'::regclass::oid;
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables
select relname, policytype, numsegments, distkey
from pg_class, gp_distribution_policy, pg_namespace ns
where pg_class.oid = localoid and relnamespace = ns.oid
diff --git a/src/test/regress/expected/union_optimizer.out b/src/test/regress/expected/union_optimizer.out
index 5a870835f9..5e93f926bd 100644
--- a/src/test/regress/expected/union_optimizer.out
+++ b/src/test/regress/expected/union_optimizer.out
@@ -709,8 +709,8 @@ reset enable_hashagg;
set enable_hashagg to on;
explain (costs off)
select x from (values (row(1, 2)), (row(1, 3))) _(x) union select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
QUERY PLAN
-----------------------------------------------
Unique
@@ -724,8 +724,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
(8 rows)
select x from (values (row(1, 2)), (row(1, 3))) _(x) union select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
x
-------
(1,2)
@@ -735,8 +735,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
explain (costs off)
select x from (values (row(1, 2)), (row(1, 3))) _(x) intersect select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
QUERY PLAN
-----------------------------------------------------
SetOp Intersect
@@ -751,8 +751,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
(9 rows)
select x from (values (row(1, 2)), (row(1, 3))) _(x) intersect select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
x
-------
(1,2)
@@ -760,8 +760,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
explain (costs off)
select x from (values (row(1, 2)), (row(1, 3))) _(x) except select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
QUERY PLAN
-----------------------------------------------------
SetOp Except
@@ -776,8 +776,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
(9 rows)
select x from (values (row(1, 2)), (row(1, 3))) _(x) except select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
x
-------
(1,3)
@@ -788,8 +788,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
-- type is hashable. (Otherwise, this would fail at execution time.)
explain (costs off)
select x from (values (row(100::money)), (row(200::money))) _(x) union select x from (values (row(100::money)), (row(300::money))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
QUERY PLAN
-----------------------------------------------
Unique
@@ -803,8 +803,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
(8 rows)
select x from (values (row(100::money)), (row(200::money))) _(x) union select x from (values (row(100::money)), (row(300::money))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
x
-----------
($100.00)
@@ -841,8 +841,8 @@ drop type ct1;
set enable_hashagg to off;
explain (costs off)
select x from (values (row(1, 2)), (row(1, 3))) _(x) union select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
QUERY PLAN
-----------------------------------------------
Unique
@@ -856,8 +856,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
(8 rows)
select x from (values (row(1, 2)), (row(1, 3))) _(x) union select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
x
-------
(1,2)
@@ -867,8 +867,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
explain (costs off)
select x from (values (row(1, 2)), (row(1, 3))) _(x) intersect select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
QUERY PLAN
-----------------------------------------------------
SetOp Intersect
@@ -883,8 +883,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
(9 rows)
select x from (values (row(1, 2)), (row(1, 3))) _(x) intersect select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
x
-------
(1,2)
@@ -892,8 +892,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
explain (costs off)
select x from (values (row(1, 2)), (row(1, 3))) _(x) except select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
QUERY PLAN
-----------------------------------------------------
SetOp Except
@@ -908,8 +908,8 @@ DETAIL: Feature not supported: ROW EXPRESSION
(9 rows)
select x from (values (row(1, 2)), (row(1, 3))) _(x) except select x from (values (row(1, 2)), (row(1, 4))) _(x);
-INFO: GPORCA failed to produce a plan, falling back to planner
-DETAIL: Feature not supported: ROW EXPRESSION
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: ROW EXPRESSION
x
-------
(1,3)
@@ -1380,23 +1380,21 @@ SELECT * FROM
SELECT 2 AS t, 4 AS x) ss
WHERE x < 4
ORDER BY x;
- QUERY PLAN
-------------------------------------------------------------------
- Sort
- Sort Key: (generate_series(1, 10))
- -> GroupAggregate
- Group Key: (1), (generate_series(1, 10))
- -> Sort
- Sort Key: (1), (generate_series(1, 10))
- -> Append
- -> Result
- Filter: ((generate_series(1, 10)) < 4)
- -> ProjectSet
- -> Result
- -> Result
- One-Time Filter: false
+ QUERY PLAN
+------------------------------------------------------------
+ GroupAggregate
+ Group Key: (1), (generate_series(1, 10))
+ -> Sort
+ Sort Key: (generate_series(1, 10)), (1)
+ -> Append
+ -> Result
+ Filter: ((generate_series(1, 10)) < 4)
+ -> ProjectSet
+ -> Result
+ -> Result
+ One-Time Filter: false
Optimizer: Pivotal Optimizer (GPORCA)
-(14 rows)
+(12 rows)
SELECT * FROM
(SELECT 1 AS t, generate_series(1,10) AS x
diff --git a/src/test/regress/expected/window_optimizer.out b/src/test/regress/expected/window_optimizer.out
index 5582722649..f6a271c8c9 100644
--- a/src/test/regress/expected/window_optimizer.out
+++ b/src/test/regress/expected/window_optimizer.out
@@ -3794,11 +3794,11 @@ WINDOW fwd AS (
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
-DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
-INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: SIRV functions
INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: SIRV functions
+INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner
+DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Query Parameter
eq1 | eq2 | eq3
-----+-----+-----
t | t | t
diff --git a/src/test/regress/sql/autostats.sql b/src/test/regress/sql/autostats.sql
index daf4a21ef2..ca70830384 100644
--- a/src/test/regress/sql/autostats.sql
+++ b/src/test/regress/sql/autostats.sql
@@ -6,13 +6,14 @@
-- end_matchsubs
-- start_matchignore
-- m/^LOG: .*Feature not supported: Queries on master-only tables./
--- m/^LOG: .*Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables./
+-- m/^LOG: .*Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables./
-- m/^LOG:.*ERROR,"PG exception raised"/
-- end_matchignore
set gp_autostats_mode=on_change;
set gp_autostats_on_change_threshold=9;
set log_autostats=on;
set client_min_messages=log;
+reset optimizer_trace_fallback;
drop table if exists autostats_test;
create table autostats_test (a INTEGER);
diff --git a/src/test/regress/sql/catcache.sql b/src/test/regress/sql/catcache.sql
index 1a4ecb3a99..0d8d0f8380 100644
--- a/src/test/regress/sql/catcache.sql
+++ b/src/test/regress/sql/catcache.sql
@@ -8,7 +8,7 @@ create table dml_14027_union_s_1_prt_2 partition of dml_14027_union_s for values
create table dml_14027_union_s_1_prt_def partition of dml_14027_union_s default;
insert into dml_14027_union_s select generate_series(1,1), generate_series(1,1);
-
+analyze dml_14027_union_s;
begin;
drop table dml_14027_union_s_1_prt_def;
explain select count(distinct(b)) from dml_14027_union_s;
diff --git a/src/test/regress/sql/correlated_subquery.sql b/src/test/regress/sql/correlated_subquery.sql
index bba5416788..a2036cfeeb 100644
--- a/src/test/regress/sql/correlated_subquery.sql
+++ b/src/test/regress/sql/correlated_subquery.sql
@@ -30,3 +30,5 @@ BEGIN;
CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;
SELECT (SELECT b FROM correlated_subquery_test LIMIT 1)=ALL(SELECT a FROM correlated_subquery_test);
ROLLBACK;
+
+reset optimizer_trace_fallback;
diff --git a/src/test/regress/sql/orca_groupingsets_fallbacks.sql b/src/test/regress/sql/orca_groupingsets_fallbacks.sql
index 13f5aa66d8..b9586b6009 100644
--- a/src/test/regress/sql/orca_groupingsets_fallbacks.sql
+++ b/src/test/regress/sql/orca_groupingsets_fallbacks.sql
@@ -39,7 +39,10 @@ insert into gstest2 values (2, 2, 2, 2, 1);
select d from gstest2 group by grouping sets ((a,b), (a));
-- Orca falls back due to HAVING clause with outer references
+-- start_ignore
+-- The output with relid will not be the same.
select v.c, (select count(*) from gstest1 group by () having v.c) from (values (false),(true)) v(c);
+-- end_ignore
-- Orca falls back due to grouping function with multiple arguments
select a, b, grouping(a,b), sum(v), count(*), max(v) from gstest1 group by rollup (a,b);
diff --git a/src/test/regress/sql/privileges.sql b/src/test/regress/sql/privileges.sql
index 4e45d44754..02300dd5b7 100644
--- a/src/test/regress/sql/privileges.sql
+++ b/src/test/regress/sql/privileges.sql
@@ -130,6 +130,9 @@ GRANT ALL ON atest1 TO PUBLIC; -- fail
-- checks in subquery, both ok
SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) );
SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) );
+-- test ctas
+create table atest2_ctas_ok as select col1 from atest2
+where col1 in (select distinct b from atest1); -- ok
SET SESSION AUTHORIZATION regress_priv_user6;
SELECT * FROM atest1; -- ok
@@ -147,9 +150,6 @@ DELETE FROM atest2; -- ok
UPDATE pg_catalog.pg_class SET relname = '123'; -- fail
DELETE FROM pg_catalog.pg_class; -- fail
UPDATE pg_toast.pg_toast_1213 SET chunk_id = 1; -- fail
--- test ctas
-create table atest2_ctas_ok as select col1 from atest2
-where col1 in (select distinct b from atest1); -- ok
SET SESSION AUTHORIZATION regress_priv_user3;
SELECT session_user, current_user;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org