pgfaceting icon indicating copy to clipboard operation
pgfaceting copied to clipboard

Integer out of range

Open rudibroekhuizen opened this issue 3 years ago • 1 comments

Nice project! My id's have bigint as datatype, I get this error when I run the populate_facets function:

ERROR:  integer out of range
CONTEXT:  SQL statement "INSERT INTO explore.gbif_enriched_facets 
SELECT facet_id, (gbifid >> 20) chunk_id, facet_value collate "POSIX", rb_build_agg(gbifid::int4 ORDER BY gbifid)
FROM explore.gbif_enriched d,
    LATERAL (
        VALUES (1, date_trunc('decade', eventdate)::text),
               (2, recordedby::text),
               (3, preparations::text),
               (4, stateprovince::text),
               (5, lifestage::text)
    ) t(facet_id, facet_value)
GROUP BY facet_id, facet_value collate "POSIX", chunk_id
    "
PL/pgSQL function faceting.populate_facets(oid,boolean,boolean) line 23 at EXECUTE
SQL statement "SELECT faceting.populate_facets(v_table_id, false)"
PL/pgSQL function faceting.add_faceting_to_table(regclass,name,faceting.facet_definition[],text,boolean,boolean) line 60 at PERFORM
SQL state: 22003

rudibroekhuizen avatar Dec 16 '22 15:12 rudibroekhuizen

Added support for bigint typed columns in 90c9a83b8f3d3c16c39e7a1dd9ec9242ca3e7717. It will still cause out of range though for values > 2^51. However the roaringbitmap datatype is quite inefficient for sparse datatypes anyway so for globally unique id's youd want to maintain a denser sequentially assigned id column anyway. I will add a documentation example for that.

ants avatar Jun 22 '23 13:06 ants