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

release-20.2: sql: avoid looking up empty-string object names #58900

Merged
merged 2 commits into from
Jan 14, 2021

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Jan 13, 2021

Backport 2/2 commits from #58674.

/cc @cockroachdb/release


sql: fix name resolution to avoid empty-name db lookups

The internal executor has a current DB of "", and it also executes
against queries against system tables using names like system.users.
The name resolution logic turned this into a lookup of "".system.users,
which was not desired.

Now we explicitly only allow the "" DB name if the schema name
corresponds to a virtual schema.

Release note: None

sql/catalog: avoid KV lookup for "" name

Sometimes the current DB is "". Normally we wouldn't try to resolve this
name, but if there's a mistake in name resolution logic, this check is a
simple way to avoid a KV lookup when we don't need it.

Release note: None

Sometimes the current DB is "". Normally we wouldn't try to resolve this
name, but if there's a mistake in name resolution logic, this check is a
simple way to avoid a KV lookup when we don't need it.

Release note: None
@rafiss rafiss requested review from thoszhang and a team January 13, 2021 00:52
@cockroach-teamcity
Copy link
Member

This change is Reviewable

The internal executor has a current DB of "", and it also executes
against queries against system tables using names like `system.users`.
The name resolution logic turned this into a lookup of "".system.users,
which was not desired.

Now we explicitly only allow the "" DB name if the schema name
corresponds to a virtual schema.

Release note: none
@rafiss rafiss changed the title release-20.2: sql/catalog: avoid KV lookup for "" name release-20.2: sql: avoid looking up empty-string object names Jan 14, 2021
@rafiss
Copy link
Collaborator Author

rafiss commented Jan 14, 2021

tftr! @lucy-zhang confirmed that we can backport both of these commits

@rafiss rafiss merged commit 812d282 into cockroachdb:release-20.2 Jan 14, 2021
@rafiss rafiss deleted the backport20.2-58674 branch January 14, 2021 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants