Re: Decision by Monday: PQescapeString() vs. encoding violation

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org, pgsql(at)j-davis(dot)com
Subject: Re: Decision by Monday: PQescapeString() vs. encoding violation
Date: 2025-02-15 20:09:48
Message-ID: ehstxpqkvdirfz7uk4gtuym5sihkh23qrwldl5lpywyxunoxvc@i4fvw3angrtg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-02-15 14:12:06 -0500, Tom Lane wrote:
> On closer inspection, PQescapeInternal already issues only one
> error message, since it does "return NULL" after detecting the
> first error. So this makes PQescapeStringInternal behave more
> like that.

This looks good to me.

I looked through the diff between what test_escape -v before/after this change
prints out, looks good to me.

> From 565b42cecf645b1dbde277512fd67836ee9081d1 Mon Sep 17 00:00:00 2001
> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> Date: Sat, 15 Feb 2025 14:10:33 -0500
> Subject: [PATCH v5] Make escaping functions retain trailing bytes of an
> invalid character.
>
> Instead of dropping the trailing byte(s) of an invalid or incomplete
> multibyte character, replace only the first byte with a known-invalid
> sequence, and process the rest normally. This seems less likely to
> confuse incautious callers than the behavior adopted in 5dc1e42b4.
>
> Author: Andres Freund <andres(at)anarazel(dot)de>

I think you deserve primary authorship for the change now...

Are you planning to push / backpatch, or should I?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-02-15 20:10:57 Re: Decision by Monday: PQescapeString() vs. encoding violation
Previous Message Tom Lane 2025-02-15 19:12:06 Re: Decision by Monday: PQescapeString() vs. encoding violation