oxidecomputer / oxidecomputer/omicron
Some named objects in DB lacking UNIQUE name index
Open
@davepacheco is already working on this.
Since Aug 15, 2023.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
Some objects in the DB have a name, and a corresponding index to ensure the name remains unique.
For example:
CREATE TABLE omicron.public.silo (
/* Identity metadata */
id UUID PRIMARY KEY,
name STRING(63) NOT NULL,
description STRING(512) NOT NULL,
time_created TIMESTAMPTZ NOT NULL,
time_modified TIMESTAMPTZ NOT NULL,
time_deleted TIMESTAMPTZ,
...
);
CREATE UNIQUE INDEX ON omicron.public.silo (
name
) WHERE
time_deleted IS NULL;
The following objects within the database have a name field, but no UNIQUE index on the name:
- omicron.public.saml_identity_provider: Has an index on
id+silo_id, but no name-based index. This might be fine, if the assumption exists that "only one can ever exist within the scope of a silo anyway". - omicron.public.external_ip: Has no name-based index, but has the constraint that names are NOT NULL for
floatingips. I believe this means that multiple floating IPs could exist with the same name. - omicron.public.saga: I'm not sure if name uniqueness matters; these names are more like labels than unique identifiers.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.