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

don't use MAX on an UUID field #993

Merged
merged 1 commit into from
Jun 4, 2024
Merged

don't use MAX on an UUID field #993

merged 1 commit into from
Jun 4, 2024

Conversation

senko
Copy link
Contributor

@senko senko commented Jun 4, 2024

A long time ago, ProjectState.id was an integer, project listing used MAX(id) and all was good.

But since it was global instead of per-project, we didn't want to expose it externally as a sequence number / index of the current state. So, we switched the field to UUID and introduced another, step_index, which was an integer.

No-one bothered to tell poor ol' get_all_projects() about it, but SQLite happily obliged, calculating maximum value of an unorderable random field (Like the White Queen, SQLite can execute six impossible queries before breakfast).

So it was that a brave adventurer ventured forth to the land of PostgreSQL, which immediately complained, as it often will. The omission was detected and promptly fixed, lest no unwary souls get caught in the trap.

@senko senko requested a review from gperetin June 4, 2024 07:53
@senko senko merged commit 7fe056b into main Jun 4, 2024
6 checks passed
@LeonOstrez LeonOstrez deleted the fix-list-projects branch July 2, 2024 17:09
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.

2 participants