Skip to content

Commit eeb0a98

Browse files
author
Artur Zakirov
committed
Issue #13. Add explain comment.
1 parent 6de4605 commit eeb0a98

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/rum_ts_utils.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy