Re: Missing CFI() in SplitIdentifierString

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Missing CFI() in SplitIdentifierString
Date: 2026-12-02 06:47:23
Message-ID: 1886195.1796194043@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Julien Rouhaud <rjuju123(at)gmail(dot)com> writes:
> SplitIdentifierString can run pretty much forever without hitting a CFI. This
> is mostly due to scan_quoted_identifier having O(n2) complexity, but the same
> problem exists to a lesser degree in SplitIdentifierString.

> I hit that problem by setting by mistake (bug in a some client app) search_path
> to a big list of double quotes.

> Simple patch attached, adding a couple of CFI in the mentioned functions.

This seems like a pretty bad idea, because it will inject the
possibility of elog() into GUC callbacks that aren't supposed to
do that.

Why is this O(N^2), and can't we fix that?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Chen 2026-12-02 06:47:29 Re: [PATCH] Handle SQL NULL results from casts in JSON generation
Previous Message vignesh C 2026-12-02 06:45:52 Show the conflict log table in \dRs+ output