-
Notifications
You must be signed in to change notification settings - Fork 745
Open
Labels
bugcherry-pick-12.1cherry-pick-13.0cherry-pick-13.1cherry-pick-13.2The tag to be removed once the PR is cherry-picked to 13.2 rel branch.The tag to be removed once the PR is cherry-picked to 13.2 rel branch.
Milestone
Description
Environment
PG 16 + Citus 12.1.5
Prepare
CREATE SCHEMA my_test;
SELECT citus_schema_distribute('my_test');
SET search_path TO my_test;
CREATE TABLE t1(id bigserial PRIMARY KEY, name text);
CREATE TABLE t2(id bigserial PRIMARY KEY, name text);Error
=> EXPLAIN INSERT INTO my_test.t1(name) SELECT name FROM (SELECT name, max(id) FROM my_test.t2 GROUP BY name) AS sub;
QUERY PLAN
-----------------------------------------------
Custom Scan (Citus INSERT ... SELECT) (cost=0.00..0.00 rows=0 width=0)
INSERT/SELECT method: pull to coordinator
-> Custom Scan (Citus Adaptive) (cost=0.00..250.00 rows=100000 width=40)
Task Count: 0
Tasks Shown: All
(5 rows)Here, Task Count: 0 is not expected.
Analysis
The reason may be related to the following code. It doesn't handle schema based sharding tables and doesn't error out.
multi_physical_planner.c:2202
forboth_ptr(prunedShardList, prunedRelationShardList,
relationRestriction, relationRestrictionContext->relationRestrictionList)
{
Oid relationId = relationRestriction->relationId;
CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry(relationId);
if (!HasDistributionKeyCacheEntry(cacheEntry))
{
continue;
}Can you review this issue
Metadata
Metadata
Assignees
Labels
bugcherry-pick-12.1cherry-pick-13.0cherry-pick-13.1cherry-pick-13.2The tag to be removed once the PR is cherry-picked to 13.2 rel branch.The tag to be removed once the PR is cherry-picked to 13.2 rel branch.