Skip to content

fix: count codepoints on the stored value, not a normalized copy - #261

Merged
zachdaniel merged 1 commit into
ash-project:mainfrom
matt-beanland:fix/string-length-of-decomposed
Sep 10, 2026
Merged

fix: count codepoints on the stored value, not a normalized copy#261
zachdaniel merged 1 commit into
ash-project:mainfrom
matt-beanland:fix/string-length-of-decomposed

Conversation

@matt-beanland

Copy link
Copy Markdown
Contributor

Contributor checklist

  • 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

Summary

Makes string_length(..., :codepoints) return what Postgres itself answers for the stored value.

Reported downstream as ash_postgres#845, where a max_length constraint is enforced against a recomposed copy in the database and against the stored value in Elixir, so a value can be written which may be rejected by the same constraint on the way back. ash_sql was counting a recomposed copy rather than the stored value.

Enables an ash_postgres test PR: chore/string-length-tests, red against ash_sql 0.7.3 and green against this branch

@zachdaniel
zachdaniel merged commit 5d86f95 into ash-project:main Sep 10, 2026
25 of 26 checks passed
@zachdaniel

Copy link
Copy Markdown
Contributor

🚀 Thank you for your contribution! 🚀

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