Skip to content

Commit

Permalink
Order deep proposal queries by another column
Browse files Browse the repository at this point in the history
Without this change, a non-deterministic sort order can cause an HTTP
500 response with message "...values and fields must be sorted...".

With this change, the sort order is first by position (as before) and
then also by proposal field value (pfv) ID because there can be many
pfv rows for a given application form field (aff) row. This should be
sufficient to guarantee deterministic order such that the application
join will succeed.

Issue #381 Unexpected 500 response: "values and fields must be sorted"

See also #198
and #210.
  • Loading branch information
bickelj committed May 31, 2023
1 parent fcf52e5 commit 5ddf751
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ INNER JOIN proposal_field_values pfv
INNER JOIN proposal_versions pv
ON pv.id = pfv.proposal_version_id
WHERE pv.proposal_id = :proposalId
ORDER BY pv.version DESC, pfv.position;
ORDER BY pv.version DESC, pfv.position, pfv.id;
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ FROM proposal_field_values pfv
INNER JOIN proposal_versions pv
ON pv.id = pfv.proposal_version_id
WHERE pv.proposal_id = :proposalId
ORDER BY pv.version DESC, pfv.position;
ORDER BY pv.version DESC, pfv.position, pfv.id;

0 comments on commit 5ddf751

Please sign in to comment.