Fix broken GiST compression
authorPeter Geoghegan <[email protected]>
Fri, 7 Mar 2014 07:41:10 +0000 (23:41 -0800)
committerPeter Geoghegan <[email protected]>
Fri, 7 Mar 2014 07:41:10 +0000 (23:41 -0800)
Forgot to detoast ghstore value during compression.

src/backend/utils/adt/jsonb_gist.c
src/include/catalog/pg_type.h

index 1bc22dc2acae92bca551f3a4261198cb5d5033cc..3b32fe202ee3f2b4a5e27b7e0beb80d5df6f96bc 100644 (file)
@@ -411,7 +411,7 @@ gjsonb_compress(PG_FUNCTION_ARGS)
    if (entry->leafkey)
    {
        GISTTYPE        *res = (GISTTYPE *) palloc0(CALCGTSIZE(0));
-       Jsonb           *val = (Jsonb*) entry->key;
+       Jsonb           *val = (Jsonb*) PG_DETOAST_DATUM(entry->key);
 
        SET_VARSIZE(res, CALCGTSIZE(0));
 
index dfd57a99655fb4bfbee6d6df46607102d7f97d81..881d424065d8a8b691496ba659ca21e7034175f8 100644 (file)
@@ -611,7 +611,7 @@ DATA(insert OID = 3802 ( jsonb          PGNSP PGUID -1 f b C f t \054 0 0 3807 jsonb_in
 DESCR("Binary JSON");
 #define JSONBOID 3802
 DATA(insert OID = 3807 ( _jsonb            PGNSP PGUID -1 f b A f t \054 0 3802 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
-DATA(insert OID = 3801 ( gjsonb            PGNSP PGUID -1 f b C f t \054 0 0 3800 gjsonb_in gjsonb_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3801 ( gjsonb            PGNSP PGUID -1 f b U f t \054 0 0 3800 gjsonb_in gjsonb_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
 DATA(insert OID = 3800 ( _gjsonb       PGNSP PGUID -1 f b A f t \054 0 3801 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
 
 DATA(insert OID = 2970 ( txid_snapshot PGNSP PGUID -1 f b U f t \054 0 0 2949 txid_snapshot_in txid_snapshot_out txid_snapshot_recv txid_snapshot_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));