data_rig
data_rig · Multidimensional OLAP fact data type with GiST indexing support.
Overview
| Relationships | |
|---|---|
| Requires | cube |
Usage
Sources:
data_rig is an experimental native type for representing a multidimensional OLAP fact as a sorted set of encoded integers. It supplies containment operators and a default GiST operator class.
Core Workflow
The SQL script refers to the cube type in GiST support signatures, but the control file does not declare cube in requires. Install it explicitly before data_rig; CREATE EXTENSION data_rig CASCADE cannot infer this dependency.
fact(integer[]) sorts and deduplicates the encoded members and rejects arrays containing NULL. @> and <@ test containment, fact_intersect(fact, fact) returns the common members, and to_fact_number(dimension, value) packs a dimension and value into an int4.
Limitations and Safety
Text input is unusable: the type’s fact_in(cstring) function always raises fact_in() not implemented, so construct values with fact(integer[]) rather than literals or text casts. The output routine exists mainly for display and does not provide a round-trip text format.
Upstream provides only a one-line README and no compatibility matrix or meaningful regression suite. The custom type and GiST implementation contain unchecked pointer and array arithmetic; malformed values or index edge cases may return incorrect results or crash a backend. Do not use data_rig for production data. If evaluating it, use a disposable database, compare every indexed result with a sequential scan, exercise empty and boundary sets, and be prepared to drop and rebuild indexes after any binary change.