Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: poor error message for out of order CTEs #22419

Open
jordanlewis opened this issue Feb 6, 2018 · 3 comments
Open

sql: poor error message for out of order CTEs #22419

jordanlewis opened this issue Feb 6, 2018 · 3 comments
Labels
A-sql-name-resolution SQL name resolution rules and CTEs. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) E-quick-win Likely to be a quick win for someone experienced. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. T-sql-queries SQL Queries Team
Projects

Comments

@jordanlewis
Copy link
Member

jordanlewis commented Feb 6, 2018

WITH outermost(x) AS (
  SELECT 1
  UNION (WITH innermost as (SELECT 2)
         SELECT * FROM outermost  -- fail
         UNION SELECT * FROM innermost)
)
SELECT * FROM outermost ORDER BY 1;

pq: relation "outermost" does not exist

Postgres has a much nicer error message:

DETAIL:  There is a WITH item named "outermost", but it cannot be referenced from this part of the query.
HINT:  Use WITH RECURSIVE, or re-order the WITH items to remove forward references.

Jira issue: CRDB-6361

@jordanlewis jordanlewis added the A-sql-name-resolution SQL name resolution rules and CTEs. label Feb 6, 2018
@jordanlewis jordanlewis self-assigned this Feb 6, 2018
@petermattis petermattis added this to the 2.0 milestone Feb 21, 2018
@jordanlewis jordanlewis modified the milestones: 2.0, 2.1 Mar 13, 2018
@jordanlewis jordanlewis added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. labels Apr 25, 2018
@knz knz moved this from Triage to Backlog in (DEPRECATED) SQL Front-end, Lang & Semantics May 3, 2018
@knz knz modified the milestones: 2.1, 2.2 Aug 30, 2018
@petermattis petermattis removed this from the 2.2 milestone Oct 5, 2018
@jordanlewis jordanlewis added this to To do in BACKLOG, NO NEW ISSUES: SQL Optimizer via automation Apr 24, 2019
@RaduBerinde RaduBerinde moved this from Triage to Lower Priority Backlog in BACKLOG, NO NEW ISSUES: SQL Optimizer Jul 9, 2019
@jordanlewis jordanlewis removed their assignment Nov 20, 2019
@RaduBerinde RaduBerinde moved this from Lower Priority Backlog to Functional issues in BACKLOG, NO NEW ISSUES: SQL Optimizer Apr 18, 2020
@github-actions
Copy link

github-actions bot commented Jun 7, 2021

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
5 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@knz knz added this to Triage in SQL Queries via automation Jun 7, 2021
@RaduBerinde RaduBerinde moved this from Triage to Backlog in SQL Queries Jun 8, 2021
@RaduBerinde RaduBerinde removed this from Functional issues in BACKLOG, NO NEW ISSUES: SQL Optimizer Jun 8, 2021
@RaduBerinde RaduBerinde added the E-quick-win Likely to be a quick win for someone experienced. label Jun 8, 2021
@RaduBerinde
Copy link
Member

Consider fixing together with #22421.

@jlinder jlinder added the T-sql-queries SQL Queries Team label Jun 16, 2021
@mgartner mgartner moved this from Backlog to New Backlog in SQL Queries Feb 16, 2023
@github-actions
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2023
@yuzefovich yuzefovich reopened this May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-name-resolution SQL name resolution rules and CTEs. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) E-quick-win Likely to be a quick win for someone experienced. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. T-sql-queries SQL Queries Team
Projects
Archived in project
SQL Queries
New Backlog
Development

No branches or pull requests

6 participants