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

opt: nextval argument must be qualified for CREATE VIEW, CREATE TABLE AS #40813

Open
RaduBerinde opened this issue Sep 16, 2019 · 2 comments
Open
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team

Comments

@RaduBerinde
Copy link
Member

RaduBerinde commented Sep 16, 2019

For CREATE VIEW and CREATE TABLE AS, the optimizer rewrites the SQL statement to fully qualify object names. This does not include the sequence name argument to nextval and similar.

root@127.144.215.162:45189/movr> select nextval('seq');
  nextval  
+---------+
        3  
(1 row)

root@127.144.215.162:45189/movr> create table t as select nextval('seq');
pq: nextval(): relation "seq" does not exist

Similar problem with views:

root@127.144.215.162:45189/movr> create view v as select nextval('seq');
CREATE VIEW

root@127.144.215.162:45189/movr> select * from v;
  nextval  
+---------+
       12  
(1 row)

root@127.144.215.162:45189/movr> use d;
SET

root@127.144.215.162:45189/d> select * from movr.v;
pq: nextval(): relation "seq" does not exist

Jira issue: CRDB-5507

@RaduBerinde RaduBerinde added this to Triage in BACKLOG, NO NEW ISSUES: SQL Optimizer via automation Sep 16, 2019
@RaduBerinde RaduBerinde moved this from Triage to Functional issues in BACKLOG, NO NEW ISSUES: SQL Optimizer Apr 18, 2020
@github-actions
Copy link

github-actions bot commented Jun 4, 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!

@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 2, 2023
BACKLOG, NO NEW ISSUES: SQL Optimizer automation moved this from Functional issues to Done Oct 2, 2023
@yuzefovich yuzefovich added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. and removed X-stale no-issue-activity labels May 2, 2024
@yuzefovich yuzefovich reopened this May 2, 2024
BACKLOG, NO NEW ISSUES: SQL Optimizer automation moved this from Done to Triage May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team
Projects
Status: Bugs to Fix
Development

No branches or pull requests

3 participants