Re: Decision by Monday: PQescapeString() vs. encoding violation
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Noah Misch <noah@leadboat.com>, Andrew Dunstan <andrew@dunslane.net>, pgsql-hackers@postgresql.org, pgsql@j-davis.com
Date: 2025-02-15T20:09:48Z
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@sss.pgh.pa.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@anarazel.de> I think you deserve primary authorship for the change now... Are you planning to push / backpatch, or should I? Greetings, Andres Freund
Commits
-
Make escaping functions retain trailing bytes of an invalid character.
- e782a63ccb76 15.12 landed
- d6d29b2133f1 13.20 landed
- c08309584ac5 14.17 landed
- 9f45e6a91d84 18.0 landed
- 991a60a9f23b 16.8 landed
- 3abe6e04cc69 17.4 landed
-
Fix handling of invalidly encoded data in escaping functions
- 5dc1e42b4fa6 18.0 cited