Skip to content

Commit 5c15c7e

Browse files
authored
fix: casting integers to string in expressions works as intended (#564)
This commit currently only adds a failing test.
1 parent 12579ad commit 5c15c7e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

test/support/resources/post.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ defmodule AshPostgres.Test.Post do
154154

155155
defaults([:read, :destroy])
156156

157+
read :with_version_check do
158+
argument(:version, :integer)
159+
160+
filter(expr(type(^arg(:version), :string) in ["1", "2"]))
161+
end
162+
157163
read :first_and_last_post do
158164
prepare(fn query, _ ->
159165
Ash.Query.combination_of(query, [

test/type_test.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,11 @@ defmodule AshPostgres.Test.TypeTest do
100100
assert %{x: 2.0, y: 3.0, z: 4.0} = p.db_string_point_id
101101
assert %{x: 2.0, y: 3.0, z: 4.0} = p.db_string_point.id
102102
end
103+
104+
test "casting integer to string works" do
105+
Post |> Ash.Changeset.for_create(:create) |> Ash.create!()
106+
107+
post = Ash.Query.for_read(Post, :with_version_check, version: 1) |> Ash.read!()
108+
refute is_nil(post)
109+
end
103110
end

0 commit comments

Comments
 (0)