Skip to content

Conversation

@DohanKim
Copy link
Contributor

@DohanKim DohanKim commented Dec 3, 2025

Problem

When using Ash.bulk_create/4 with the AshPostgres data layer, upsert?: true, and return_skipped_upsert?: true, if all records are successfully inserted (none skipped due to upsert conditions), the code builds a filter with or: [] to fetch skipped records, which triggers a crash:

  ** (FunctionClauseError) no function clause matching in Ash.Filter.parse_and_join/3
      (ash 3.9.0) lib/ash/filter/filter.ex:4711: Ash.Filter.parse_and_join([], :or, %{...})

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

…ly inserted, for return_skipped_upsert?: true
@DohanKim DohanKim changed the title do not build query filter with or: [] when all records are successfully inserted, for return_skipped_upsert?: true do not build query filter with or: [] when all records are successfully upserted, for return_skipped_upsert?: true Dec 3, 2025
@zachdaniel zachdaniel merged commit 23cc10a into ash-project:main Dec 4, 2025
64 of 67 checks passed
@zachdaniel
Copy link
Contributor

🚀 Thank you for your contribution! 🚀

rgraff added a commit that referenced this pull request Dec 10, 2025
…tributes

* main: (23 commits)
  fix: do not build query filter with or: [] when all records are successfully inserted, for return_skipped_upsert?: true (#659)
  test: load aggregate with select and sort on from_many relationship (#661)
  test: add failing test for expr(has_one.function_calc) nil poisoning in batch (#660)
  test: aggregate with parent ref in relationship filter and sorting on relationship field (#658)
  test: binding error when loading aggregate (#657)
  chore(deps): bump ash_sql in the production-dependencies group (#656)
  test: multi relationship problems (#654)
  chore: release version v2.6.26
  chore: update ash_sql, use new select binding
  test: add complex calculation tests with filtered aggregates (#652)
  improvement: add generator to tsvector type (#655)
  test: add failing test for aggregate filtering on nested first aggregate (#653)
  chore: update ash_sql and add test
  docs: Mention :define_ecto_repo? option of use AshPostgres.Repo macro in getting started guide (#648)
  improvement: verify check constraint attributes at compile time
  chore: update ash
  chore: reuse compliance
  improvement: update deps for bug fixes
  chore: release version v2.6.25
  test: Add failing test for aggregate with parent() + select() + limit() (#644)
  ...
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