-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: Error messages should be improved in case of no matching data source #22966
Copy link
Copy link
Closed
Labels
A-sql-name-resolutionSQL name resolution rules and CTEs.SQL name resolution rules and CTEs.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Description
Consider the following invalid query:
root@:26257/> select count(tpch.nation.n_nationkey) from tpch.customer c, tpch.public.nation n where tpch.public.customer.c_nationkey = nation.n_nationkey group by tpch.public.nation.n_nationkey limit 10;
The error that CockroachDB returns for this query is:
pq: no data source matches prefix: tpch.public.customer
PostgreSQL has a friendlier error message with a hint:
Postgres: ERROR: invalid reference to FROM-clause entry for table "nation" Hint: Perhaps you meant to reference the table alias "n". Position: 14
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-name-resolutionSQL name resolution rules and CTEs.SQL name resolution rules and CTEs.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)