diff --git a/src/pog_ffi.erl b/src/pog_ffi.erl index 9c486a2..c21f174 100644 --- a/src/pog_ffi.erl +++ b/src/pog_ffi.erl @@ -85,7 +85,8 @@ start(Config) -> query(Pool, Sql, Arguments, Timeout) -> Res = case Pool of {single_connection, Conn} -> - pgo_handler:extended_query(Conn, Sql, Arguments, #{}); + DecodeOpts = element(11, Conn), + pgo_handler:extended_query(Conn, Sql, Arguments, DecodeOpts, #{}); {pool, Name} -> Options = #{ pool => Name, diff --git a/test/pog_test.gleam b/test/pog_test.gleam index 3a6f7ad..1a49a31 100644 --- a/test/pog_test.gleam +++ b/test/pog_test.gleam @@ -515,13 +515,25 @@ pub fn expected_maps_test() { VALUES (DEFAULT, 'neo', true, ARRAY ['black'], '2022-10-10 11:30:30', '2020-03-04') RETURNING - id" + id, name" let assert Ok(pog.Returned(rows: [id], ..)) = pog.query(sql) |> pog.returning(decode.at(["id"], decode.int)) |> pog.execute(db.data) + let assert Ok(pog.Returned(1, ["neo"])) = + pog.transaction(db.data, fn(conn) { + let assert Ok(returned) = + pog.query(sql) + |> pog.returning(decode.at(["name"], decode.string)) + |> pog.execute(conn) + + assert returned.rows == ["neo"] + + Ok(returned) + }) + let assert Ok(returned) = pog.query("SELECT * FROM cats WHERE id = $1") |> pog.parameter(pog.int(id))