| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Haibo Yan <tristan(dot)yim(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com> |
| Subject: | Re: [PATCH v1] pg_stash_advice: Reject embedded NUL bytes in persistence files |
| Date: | 2026-11-18 02:22:34 |
| Message-ID: | 2B5642E4-9AFA-4E0C-B8A1-3FE5EE6EC722@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Nov 18, 2026, at 02:27, Haibo Yan <tristan(dot)yim(at)gmail(dot)com> wrote:
>
> Hi Chao,
>
> Thanks for reviewing. I haven't found a case where normal writes or
> a crash left an embedded NUL in pg_stash_advice.tsv. The writer uses a
> temporary file and durable_rename(), and SQL text input rejects NUL
> even with SQL_ASCII. I inserted the NUL by hand for the test.
>
> Other byte changes can go undetected. NUL is worth checking because
> the loader mistakes it for EOF, reports success, and can discard the
> remaining records on the next save.
>
> Best regards,
> Haibo
If this is defensive handling of a manually corrupted file, then the same concern may apply to many other text file readers. In that case, instead of adding a check specifically for the stash file, maybe a better way is to add a generic text file reader to handle all possible errors in a single place.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-11-18 02:24:50 | Re: create .abi-compliance-history file for v19 |
| Previous Message | Andrew Dunstan | 2026-11-18 02:22:07 | Re: create .abi-compliance-history file for v19 |