Skip to content

Conversation

@jechol
Copy link
Contributor

@jechol jechol commented Nov 27, 2025

When wrap_in_subquery_for_aggregates tries to select :calculations from the subquery, it fails with:

** (Ecto.QueryError) field `calculations` in struct/2 is not available in the subquery. 
Subquery only returns fields: [...]

This fix filters out :calculations from select_calculations, keeping only the actual calculation columns (like __calculations____calc__0).

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

@jechol jechol force-pushed the fix/subquery-calculations-251127 branch 2 times, most recently from 1b8d3cd to ea3b6d0 Compare November 27, 2025 02:12
@jechol jechol force-pushed the fix/subquery-calculations-251127 branch from ea3b6d0 to 5ba0965 Compare November 28, 2025 00:28
@zachdaniel
Copy link
Contributor

Hmm...in the case you're hitting, wouldn't this result in us missing calculations?

@zachdaniel
Copy link
Contributor

What is the value of calculations there when you're hitting that case?

@zachdaniel
Copy link
Contributor

@jechol any update here?

@jechol
Copy link
Contributor Author

jechol commented Dec 3, 2025

Hi, I just got time to work on this and created a minimal repro: https://github.com/jechol/ash_sql_load_sort_page_bug

Hope this helps with debugging!

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