File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -539,8 +539,14 @@ rum_extract_tsvector_internal(TSVector vector,
539539 if (we -> haspos )
540540 {
541541 posVec = _POSVECPTR (vector , we );
542+
543+ /*
544+ * In some cases compressed positions may take more memory than
545+ * uncompressed positions. So allocate memory with a margin.
546+ */
542547 posDataSize = VARHDRSZ + 2 * posVec -> npos * sizeof (WordEntryPos );
543548 posData = (bytea * ) palloc (posDataSize );
549+
544550 posDataSize = compress_pos (posData -> vl_dat , posVec -> pos , posVec -> npos ) + VARHDRSZ ;
545551 SET_VARSIZE (posData , posDataSize );
546552
@@ -1579,6 +1585,10 @@ rum_ts_join_pos(PG_FUNCTION_ARGS)
15791585
15801586 Assert (countRes <= (count1 + count2 ));
15811587
1588+ /*
1589+ * In some cases compressed positions may take more memory than
1590+ * uncompressed positions. So allocate memory with a margin.
1591+ */
15821592 size = VARHDRSZ + 2 * sizeof (WordEntryPos ) * countRes ;
15831593 result = palloc (size );
15841594
You can’t perform that action at this time.
0 commit comments