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: not-searched index name found already qualified #24475

Closed
nvanbenschoten opened this issue Apr 4, 2018 · 0 comments
Closed

sql: not-searched index name found already qualified #24475

nvanbenschoten opened this issue Apr 4, 2018 · 0 comments
Assignees
Labels
C-investigation Further steps needed to qualify. C-label will change.
Milestone

Comments

@nvanbenschoten
Copy link
Member

The following statement fails to execute. This is likely fallout from #22753.

8 exec "" {} "DROP INDEX public.\"primary\"" {} 0.109 0
"programmer error: not-searched index name found already qualified: public.\"primary\"@"

Found when revisiting #22298.

@nvanbenschoten nvanbenschoten added the C-investigation Further steps needed to qualify. C-label will change. label Apr 4, 2018
@nvanbenschoten nvanbenschoten added this to the 2.1 milestone Apr 4, 2018
craig bot pushed a commit that referenced this issue Apr 16, 2018
24778: sql: fix qualified index name resolution r=knz a=knz

Fixes #24475.
cc @nvanbenschoten 

In CockroachDB index names are relative to a table name
(e.g. `tbl@idx`) but in Postgres index names live in the schema
namespace. To offer compatibility with Postgres, CockroachDB
implements a special name resolution algorithm for index names
specified without the '@' syntax. For example, `DROP INDEX foo` will
search all tables in the current schema to find one with index name
`foo`.

Prior to this patch, CockroachDB was not able to search for a
_qualified_ index name specified without the '@' syntax. For example,
TypeORM issues `DROP INDEX public."primary"`, expecting to be able to
drop the primary index of some table in the `public` schema. This was
not recognized by CockroachDB.

This patch extends the name resolution for index names to support both
partial and complete qualification, using the same name resolution
rules as other objects.

Release note (sql change): CockroachDB now supports more ways to
specify an index name for statements that require one (e.g., `DROP
INDEX`, `ALTER INDEX ... RENAME`, etc.), in a way more compatible with
PostgreSQL.

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
@craig craig bot closed this as completed in #24778 Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-investigation Further steps needed to qualify. C-label will change.
Projects
None yet
Development

No branches or pull requests

2 participants