Re: BUG #19602: Vuln46: citext split_part silently returns NULL for a zero field position instead of raising core sp

From: JaeHyuck Sa <jaehyuck(dot)sa(dot)dev(at)gmail(dot)com>
To: Manu <manuelreyesbravo(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, 1217816127(at)qq(dot)com
Subject: Re: BUG #19602: Vuln46: citext split_part silently returns NULL for a zero field position instead of raising core sp
Date: 2026-11-11 01:22:47
Message-ID: CAKs5thwCELQ_0F7fkq7kZzp5d-c=-gCz0qYUO5v-6JCz5umY-g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Manu,

A few comments:

> - ALTER EXTENSION citext UPDATE TO '1.9' changes the -1 case from NULL
> to 'c' in an existing database;

split_part() is IMMUTABLE, so expression indexes and stored generated
columns built under 1.8 keep the old results, e.g. NULL where the
position is negative or past the last field. With the patch on master
(d0a4f66217c), an index scan on split_part(addr, '@', 2) and a seq
scan disagreed about 'nodomain' until I ran REINDEX. Maybe worth a
line in the commit message.

The new body also isn't inlined anymore. With 1.9, EXPLAIN VERBOSE
shows a plain function call, where 1.8 had
regexp_split_to_array(...)[2]. On a release build,
split_part(v, ',', 2) over 200000 rows went from about 80 ms to
250 ms. Is that acceptable?

> Since the function is part of the extension script, this needs citext 1.9.

Is this meant for master only? Branches before 18 have citext 1.6.

Regards,
Jaehyuck Sa

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-11-11 01:39:02 BUG #19861: Self-join elimination drops a VOLATILE predicate and changes the query result
Previous Message shihao zhong 2026-11-11 01:17:27 Re: BUG #19849: queries fail after ANALYZE with expression stats on arrays