Re: BUG #18080: to_tsvector fails for long text input
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: uwe.binder@pass-consulting.com, pgsql-bugs@lists.postgresql.org
Date: 2023-09-22T17:48:59Z
Lists: pgsql-bugs
Attachments
- bound-lenwords-in-to_tsvector_byid.patch (text/x-diff) patch
I wrote: > Yeah. My thought about blocking the error had been to limit > prs.lenwords to MaxAllocSize/sizeof(ParsedWord) in this code. Concretely, as attached. This allows the given test case to complete, since it doesn't actually create very many distinct words. In other cases we could expect to fail when the array has to get enlarged, but that's just a normal implementation limitation. I looked for other places that might initialize lenwords to not-sane values, and didn't find any. BTW, the field order in ParsedWord is such that there's a fair amount of wasted pad space on 64-bit builds. I doubt we can get away with rearranging it in released branches; but maybe it's worth doing something about that in HEAD, to push out the point at which you hit the 1Gb limit. regards, tom lane
Commits
-
Pack struct ParsedWord more tightly.
- 036297cf1b84 17.0 landed
-
Limit to_tsvector_byid's initial array allocation to something sane.
- cf1c65070a89 17.0 landed
- a2799f53d519 14.10 landed
- 8465efc1a0e7 16.1 landed
- 71bb73f60be7 15.5 landed
- 52a676ef4fc8 13.13 landed
- 4a81ed29d3c9 12.17 landed
- 0fb91ed2b0af 11.22 landed