BUG #16097: ts_headline fails on text with html style tag

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: godstanis(at)gmail(dot)com
Subject: BUG #16097: ts_headline fails on text with html style tag
Date: 2019-11-06 15:28:28
Message-ID: 16097-4724fa53dd5a23d2@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16097
Logged by: Stanislav B.
Email address: godstanis(at)gmail(dot)com
PostgreSQL version: 12.0
Operating system: Linux. Ubuntu 18 and 16
Description:

'ts_headline' function behaves really strang on text with '<style>' tags.

Scenario #1:
Set up: any text with <style> tag, containing any text under 2043 symbols;
Result: works as expected, no problems.

Scenario #2:
Set up: any text (use the sample code at the bottom of my message) with
<style> tag, containing any text (but more than 2043-2045 symbols);
Result: fails to process correctly, text with empty "<style><style>" tag
returned.

Scenario #3:
Set up: Take THE SAME setup from #2 scenario, but just rename "style" tag to
anything else, let's use "stylk". (You can take the sample code below and
change the tag);
Result: works as expected, no problems.

As you see, the problem occurs only if we use "style" tag here.

Here is the minimum sample code to reproduce the error:

>> CODE START
select ts_headline(
'<h1>Ok</h1> <style type="text/css">.some-content {color:
grey} .some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} * {}</style> <p>Any
other content not affected</p>',
'anything'::tsquery,
'HighlightAll="1"'
);
>>CODE END

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-11-06 15:29:29 Re: PostgreSQL 12 installation fails because locale name contained non-english characters
Previous Message Devrim Gündüz 2019-11-06 15:12:14 Re: BUG #16085: Potential missing version information available for /usr/pgsql-12/lib/libpq.so.5