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

Image promote does not check for duplicate names #2895

Closed
askfongjojo opened this issue Apr 20, 2023 · 3 comments · Fixed by #3254
Closed

Image promote does not check for duplicate names #2895

askfongjojo opened this issue Apr 20, 2023 · 3 comments · Fixed by #3254
Assignees
Milestone

Comments

@askfongjojo
Copy link

I was able to promote an image with the same name as another image that exists at the silo-level. It should probably complain about name duplication.

@askfongjojo askfongjojo added this to the MVP milestone Apr 20, 2023
@zephraph
Copy link
Contributor

zephraph commented May 24, 2023

I'm surprised about this given the unique index constraint on silo_id, project_id, and name. My expectation is that the update should fail if it violates that unique index.

Regardless, I'll dig deeper into it.

@davepacheco
Copy link
Collaborator

I suspect what's going on is that you've got two items in the index both having (silo_id, NULL project_id, name), but the two NULL values act as though they're distinct. Check this out:
https://www.cockroachlabs.com/docs/stable/null-handling.html#nulls-and-unique-constraints

It may be clearer to have two different partial indexes, one for project-level uniqueness and one for silo-level uniqueness. I'm not sure but I think it's a good idea to leave NULL values out of indexes.

@zephraph
Copy link
Contributor

That's unfortunate. I'll put a PR.

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 a pull request may close this issue.

3 participants