Hi sequel fans,

Given a custom Range:

    CREATE TYPE timerange AS range (subtype = time);

I'm trying to have a Sequel database with the `pg_range` and `pg_array` 
extensions correctly deserialize a `timerange[]` array of ranges of times.

Disregarding the question of how to look up the oid, here's what I have:

    SELECT oid, typname FROM pg_type WHERE typname LIKE '%timerange%';

    oid       typname
    4242529   timerange
    4242530   _timerange

with this code:

    type = :timerange
    time_oid = 1183 # time without time zone
    range_oid = 4242529
    array_oid = range_oid + 1

    Sequel::Postgres::PGRange.register(type, oid: range_oid, subtype_oid: 
time_oid)
    Sequel::Postgres::PGArray.register(type, oid: array_oid, scalar_oid: 
range_oid, scalar_typecast: type)

Any pointers on how to get this to work? I'm expecting to end up with:

    PGArray[PGRange(SqlTime..SqlTime)..PGRange(SqlTime..SqlTime)]

Second question: what's the best way to register these by name rather than 
oid?

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to