You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mix.install([{:postgrex,"~> 0.19.0"}]){:ok,conn}=Postgrex.start_link(username: "postgres",password: "postgres",database: "postgres")Postgrex.query!(conn,"DROP TABLE IF EXISTS availability;",[])Postgrex.query!(conn,"DROP TYPE IF EXISTS timerange;",[])Postgrex.query!(conn,""" CREATE OR REPLACE FUNCTION time_subtype_diff(x time(0), y time(0)) RETURNS float8 AS 'SELECT EXTRACT(EPOCH FROM (x - y))' LANGUAGE sql STRICT IMMUTABLE; """,[])Postgrex.query!(conn,""" CREATE TYPE timerange AS RANGE ( subtype = time(0), subtype_diff = time_subtype_diff ); """,[])Postgrex.query!(conn,"CREATE TABLE availability (hours timerange[]);",[])Postgrex.query!(conn,"INSERT INTO availability (hours) VALUES ($1);",[[struct!(Postgrex.Range,lower: ~T[09:00:00],upper: ~T[12:00:00],lower_inclusive: true,upper_inclusive: true),struct!(Postgrex.Range,lower: ~T[14:00:00],upper: ~T[17:00:00],lower_inclusive: true,upper_inclusive: true)]])Postgrex.query!(conn,"SELECT * FROM availability;",[])|>inspect(pretty: true)|>IO.puts()
The above script crashes on the select query with the following:
This crash happens if the array contains more than one time range. The commit that is breaks at is "Allow extensions to access type modifiers". The extension type macros made it difficult for me to follow, but I'll add more info as I trace the issue further.
Expected behavior
With postgrex 0.18, the above script returns the expected result:
Elixir version
Elixir 1.17.2 (compiled with Erlang/OTP 27)
Database and Version
PostgreSQL 16.4
Postgrex Version
0.19.1
Current behavior
A minimal script to reproduce the issue:
The above script crashes on the select query with the following:
This crash happens if the array contains more than one time range. The commit that is breaks at is "Allow extensions to access type modifiers". The extension type macros made it difficult for me to follow, but I'll add more info as I trace the issue further.
Expected behavior
With postgrex 0.18, the above script returns the expected result:
The text was updated successfully, but these errors were encountered: