Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

moxley
Copy link

@moxley moxley commented Sep 14, 2025

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

Demonstrates the bug when translating an Ash.Query into SQL, by modifying the test that was recently added. Here's the test output:

  1) test `is_nil` operator works on get_path results (AshPostgres.StorageTypesTest)
     test/storage_types_test.exs:70
     ** (Ash.Error.Unknown) 
     Bread Crumbs:
       > Error returned from: AshPostgres.Test.Author.read

     Unknown Error

     * ** (Postgrex.Error) ERROR 22P02 (invalid_text_representation) malformed array literal: "["email", "sms"]". If you are trying to query a JSON field, the parameter may need to be interpolated. Instead of

         p.json["field"] != "value"

     do

         p.json["field"] != ^"value"


     "[" must introduce explicitly-specified array dimensions.

The debug logging output shows that ash_postgres is trying to cast the return value of jsonb_extract_path_text() with ::text[], which is apparently invalid. Changing the cast to ::jsonb[] should fix it.

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.

1 participant