Postgrex count result - reading big vs small values

congrats on reaching this level of “elixir” expertise… we all go through this little gotcha.

it’s only outputted in iex as a letter since it’s valid ascii… see this thread [7, 8, 9] in iex returns '\a\b\t' Why? - #4 by hauleth

edit:
for pattern matching:

result = %Postgrex.Result{
  columns: ["count"],
  command: :select,
  connection_id: 103477,
  messages: [],
  num_rows: 1,
  rows: [[1632691]]
}

[[count]] = result.rows
3 Likes