On Tue, Jul 23, 2019 at 3:32 PM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> Just checking if you've had a chance to make progress on this.
Not a lot. :-) But I should have more time for it the next few weeks
than I did the last few. I do have some code for creating concrete
multirange types (used when you create a concrete range type) and
filling in a TypeCacheEntry based on the range type oid---which I know
is all very modest progress. I've been working on a multirange_in
function and mostly just learning about Postgres varlena and TOASTed
objects by reading the code for range_in & array_in.
Here is something from my multirangetypes.h:
/*
* Multiranges are varlena objects, so must meet the varlena convention that
* the first int32 of the object contains the total object size in bytes.
* Be sure to use VARSIZE() and SET_VARSIZE() to access it, though!
*/
typedef struct
{
int32 vl_len_; /* varlena header (do not touch
directly!) */
Oid multirangetypid; /* multirange type's own OID */
/*
* Following the OID are the range objects themselves.
* Note that ranges are varlena too,
* depending on whether they have lower/upper bounds
* and because even their base types can be varlena.
* So we can't really index into this list.
*/
} MultirangeType;
I'm working on parsing a multirange much like we parse an array,
although it's a lot simpler because it's a single dimension and there
are no nulls.
I know that's not much to go on, but let me know if any of it worries you. :-)
Paul