Skip to content

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

Closed
pobrn wants to merge 1 commit intocms-dev:masterfrom
pobrn:aws_no_depend_union_all
Closed

AWS: do not depend on ordering of UNION ALL#1240
pobrn wants to merge 1 commit intocms-dev:masterfrom
pobrn:aws_no_depend_union_all

Conversation

@pobrn
Copy link
Contributor

@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
Contributor 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.

@pobrn pobrn force-pushed the aws_no_depend_union_all branch from 20211d9 to ed9c468 Compare September 11, 2023 14:39
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
@pobrn pobrn force-pushed the aws_no_depend_union_all branch from ed9c468 to 95948a2 Compare September 11, 2023 14:44
@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
Contributor 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.

@pobrn
Copy link
Contributor Author

pobrn commented Oct 31, 2024

Gentle ping. Would it be possible to merge either of the PRs?

@wil93
Copy link
Member

wil93 commented Nov 6, 2024

Thank you for the ping. Merged #1201 with a small change (to replace the deprecated add_column)

@wil93 wil93 closed this Nov 6, 2024
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