Skip to content

Use md5(flux) for SpectroscopyReducedDatum index - #1697

Open
Fingel wants to merge 1 commit into
devfrom
hash-flux-unique-constraint
Open

Fingel wants to merge 1 commit into
devfrom
hash-flux-unique-constraint

Conversation

@Fingel

@Fingel Fingel commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

The value of the flux field on SpectroscopyReducedDatum is unbounded, which makes it unsuitable for use in a unique index. This changes the index such that the md5 of the field (after converting it to text) is used instead.

The resulting index looks like this in postgres:

"unique_spectroscopy" UNIQUE, btree (target_id, "timestamp", telescope, instrument, md5(flux::text), reduction_version)

The value of the flux field on SpectroscopyReducedDatum is unbounded,
which makes it unsuitable for use in a unique index. This changes the
index such that the md5 of the field (after converting it to text) is
used instead.
@Fingel
Fingel requested review from griffin-h and jchate6 October 8, 2026 23:08

@griffin-h griffin-h left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration applies cleanly for me!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

3 participants