citusdata / citusdata/citus

Misleading error message when using a local table in a correlated subquery

Open
#4,641 0 comments 1 reaction 0 assignees View on GitHub
error message
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

This error message occurs only in case of correlated subqueries, but it talks of "direct joins" and suggest using a subquery as a solution.
```
postgres=# SELECT (SELECT count(*) FROM local WHERE local.x = test.x) FROM test;
ERROR: direct joins between distributed and local tables are not supported
HINT: Use CTE's or subqueries to select from local tables and use them in joins
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided correlated-subquery query against Citus and trace the error path for joins between distributed and local tables. Determine why this case produces the direct-joins message and hint; done means the message accurately describes correlated subqueries and a regression test covers the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.