forked from cockroachdb/cockroach
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: help the user understand unsupported correlation
Prior to this patch, a client trying to use an unsupported correlated query would encounter an obscure error like "column v does not exist" or "no data source matches prefix". Given that the new optimizer code can determine whether a query is correlated, we can use this information to enhance the error message. Before: ``` > select * from pg_class a where exists (select * from pg_class b where a.oid = b.oid); pq: no data source matches prefix: a > select * from pg_class a where exists (select * from kv where v::oid = oid); pq: column "oid" does not exist ``` After: ``` > select * from pg_class a where exists (select * from pg_class b where a.oid = b.oid); pq: no data source matches prefix: a HINT: some correlated subqueries are not supported yet - see cockroachdb#3288 > select * from pg_class a where exists (select * from kv where v::oid = oid); pq: column "oid" does not exist HINT: some correlated subqueries are not supported yet - see cockroachdb#3288 ``` Note: some correlated queries do not benefit from this improvement, specifically those for which the optimizer code aborts early before it has detected correlation (e.g. because of some other unrelated feature). Release note (sql change): CockroachDB will now report a hint in the error message if it encounters a correlated query that it does not support yet.
- Loading branch information
Showing
7 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters