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

AWS: do not depend on ordering of UNION ALL #1240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pobrn
Copy link

@pobrn pobrn commented Sep 11, 2023

Apparently neither postgres nor the SQL standard guarantees that the order of the results will match the order the of the queries0.

If the results are not returned in order, then AWS will confuse which result belongs to which query, producing incomprehensible results on the admin page.

@pobrn
Copy link
Author

pobrn commented Sep 11, 2023

I suppose queries could be converted to be just a simple list now, but I have not tested that at all.

EDIT: done, tested a bit.

Apparently neither postgres nor the SQL standard guarantees that the
order of the results will match the order the of the queries[0].

If the results are not returned in order, then AWS will confuse
which result belongs to which query, producing incomprehensible
results on the admin page.

[0]: https://dba.stackexchange.com/questions/316818/are-results-from-union-all-clauses-always-appended-in-order
@wil93
Copy link
Member

wil93 commented Sep 12, 2023

Hi @pobrn, thanks for the PR. I wonder if this is similar to what was implemented in #1201?

@pobrn
Copy link
Author

pobrn commented Sep 12, 2023

You're right. The linked PR seems to fix the same issue. In any case, it would good to merge either one because this came up during IOI2023 so a fix would be appreciated.

Please do note that the linked PR uses add_column, which appears to be deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants