{"action":"opened","issue":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/929","labels_url":"https://api.github.com/repos/elixir-lang/ecto/issues/929/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/ecto/issues/929/comments","events_url":"https://api.github.com/repos/elixir-lang/ecto/issues/929/events","html_url":"https://github.com/elixir-lang/ecto/issues/929","id":105047746,"number":929,"title":"get_by: ** (Postgrex.Error) ERROR (undefined_function): operator does not exist: json = unknown","user":{"login":"arathunku","id":749393,"avatar_url":"https://avatars.githubusercontent.com/u/749393?v=3","gravatar_id":"","url":"https://api.github.com/users/arathunku","html_url":"https://github.com/arathunku","followers_url":"https://api.github.com/users/arathunku/followers","following_url":"https://api.github.com/users/arathunku/following{/other_user}","gists_url":"https://api.github.com/users/arathunku/gists{/gist_id}","starred_url":"https://api.github.com/users/arathunku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arathunku/subscriptions","organizations_url":"https://api.github.com/users/arathunku/orgs","repos_url":"https://api.github.com/users/arathunku/repos","events_url":"https://api.github.com/users/arathunku/events{/privacy}","received_events_url":"https://api.github.com/users/arathunku/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-05T20:36:41Z","updated_at":"2015-09-05T20:36:41Z","closed_at":null,"body":"Hello,\r\n\r\nI'm playing around with ecto, postgresql and json and I've issue with using `get_by/2` where one of the keys is a map(jsonb) type.\r\n\r\nSome details:\r\n\r\ndeps versions:\r\n  - postgresql 9.4.4\r\n  - ecto 1.0.1\r\n  - poison 1.5.0\r\n\r\nerror:\r\n```\r\n  1) test creates new bullet (Bulleter.Api.BulletsControllerTest)\r\n     test/controllers/api/bullets_controller_test.exs:18\r\n     ** (Postgrex.Error) ERROR (undefined_function): operator does not exist: json = unknown\r\n     stacktrace:\r\n       (ecto) lib/ecto/adapters/sql.ex:172: Ecto.Adapters.SQL.query!/5\r\n       (ecto) lib/ecto/adapters/sql.ex:465: Ecto.Adapters.SQL.execute/6\r\n       (ecto) lib/ecto/repo/queryable.ex:95: Ecto.Repo.Queryable.execute/5\r\n       (ecto) lib/ecto/repo/queryable.ex:15: Ecto.Repo.Queryable.all/4\r\n       (ecto) lib/ecto/repo/queryable.ex:44: Ecto.Repo.Queryable.one/4\r\n       test/controllers/api/bullets_controller_test.exs:22\r\n```\r\n\r\ncode that's causing the problem:\r\n```elixir\r\n  @valid_attrs %{content: %{\"x\" => 1}, name: \"some content\", receiver: \"username\"}\r\n\r\n  test \"creates new bullet\" do\r\n    conn = post conn, bullets_path(conn, :create), bullet: @valid_attrs\r\n    assert Repo.get_by(Bullet, @valid_attrs)\r\n  end\r\n```\r\n\r\nwhen I omit json attribute: \r\n```elixir\r\n    assert Repo.get_by(Bullet, Map.delete(@valid_attrs, :content))\r\n```\r\nit works without a problem.\r\n\r\n\r\nfull trace from dbg:\r\n\r\n```\r\niex(1)> Dbg.trace(:send)\r\n%{counts: %{nonode@nohost: 1}, errors: %{}}\r\niex(2)> Bulleter.Repo.get_by Bulleter.Bullet, %{content: %{\"x\"=>1}}\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:code_call, #PID<0.205.0>, {:ensure_loaded, List.Chars.List}}, :code_server}\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:code_call, #PID<0.205.0>, {:ensure_loaded, Bulleter.Repo}}, :code_server}\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:code_call, #PID<0.205.0>, {:ensure_loaded, Ecto.Queryable.Atom}}, :code_server}\r\n[debug] SELECT b0.\"id\", b0.\"name\", b0.\"content\", b0.\"receiver\", b0.\"inserted_at\", b0.\"updated_at\" FROM \"bullets\" AS b0 WHERE (b0.\"content\" = $1) [%{\"x\" => 1}] ERROR query=0.5ms\r\n** (Postgrex.Error) ERROR (undefined_function): operator does not exist: json = unknown\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:code_call, #PID<0.205.0>, {:ensure_loaded, Ecto.Queryable.Ecto.Query}}, :code_server}\r\n\r\n** (Dbg) #PID<0.205.0> sends to #PID<0.193.0>:\r\n    {:\"$gen_call\", {#PID<0.205.0>, #Reference<0.0.4.900>}, {:checkout, #Reference<0.0.4.899>, true}}\r\n\r\n** (Dbg) #PID<0.205.0> sends to #PID<0.204.0>:\r\n    {:\"$gen_call\", {#PID<0.205.0>, #Reference<0.0.4.902>}, {:checkout, :run}}\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:code_call, #PID<0.205.0>, {:ensure_loaded, Access.List}}, :code_server}\r\n    (ecto) lib/ecto/adapters/sql.ex:172: Ecto.Adapters.SQL.query!/5\r\n    (ecto) lib/ecto/adapters/sql.ex:465: Ecto.Adapters.SQL.execute/6\r\n    (ecto) lib/ecto/repo/queryable.ex:95: Ecto.Repo.Queryable.execute/5\r\n    (ecto) lib/ecto/repo/queryable.ex:15: Ecto.Repo.Queryable.all/4\r\n    (ecto) lib/ecto/repo/queryable.ex:44: Ecto.Repo.Queryable.one/4\r\n\r\n** (Dbg) #PID<0.205.0> sends to #PID<0.210.0>:\r\n    {:\"$gen_call\", {#PID<0.205.0>, #Reference<0.0.4.903>}, {:query, \"SELECT b0.\\\"id\\\", b0.\\\"name\\\", b0.\\\"content\\\", b0.\\\"receiver\\\", b0.\\\"inserted_at\\\", b0.\\\"updated_at\\\" FROM \\\"bullets\\\" AS b0 WHERE (b0.\\\"content\\\" = $1)\", [%{\"x\" => 1}]}}\r\niex(2)> \r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:\"$gen_cast\", {:checkin, #PID<0.204.0>}}, Bulleter.Repo.Pool}\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:code_call, #PID<0.205.0>, {:ensure_loaded, Inspect.List}}, :code_server}\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:code_call, #PID<0.205.0>, {:ensure_loaded, Inspect.Map}}, :code_server}\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:code_call, #PID<0.205.0>, {:ensure_loaded, Inspect.BitString}}, :code_server}\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:code_call, #PID<0.205.0>, {:ensure_loaded, Inspect.Integer}}, :code_server}\r\n\r\n** (Dbg) unknown event:\r\n    {:trace, #PID<0.205.0>, :send, {:notify, {:debug, #PID<0.27.0>, {Logger, [\"SELECT b0.\\\"id\\\", b0.\\\"name\\\", b0.\\\"content\\\", b0.\\\"receiver\\\", b0.\\\"inserted_at\\\", b0.\\\"updated_at\\\" FROM \\\"bullets\\\" AS b0 WHERE (b0.\\\"content\\\" = $1)\", 32, \"[%{\\\"x\\\" => 1}]\", 32, \"ERROR\", [32, \"query\", 61, '0.5', 109, 115], []], {{2015, 9, 5}, {22, 32, 35, 535}}, [pid: #PID<0.205.0>, module: Bulleter.Repo, function: \"log/1\", line: 2, ecto_conn_pid: #PID<0.210.0>]}}}, Logger}\r\n\r\n```\r\n\r\nI wanted to report that here and I'll try to create a PR with a fix if that isn't something too advanced (only few hours with elixir). It looks like it doesn't serialize the columns specified as (map)(json) in schema.\r\n\r\n I hope I've not missed any details needed to debug the problem."}}