Re: Cleanup: Use modern macro for text-to-CString conversion in plsample.c
Fujii Masao <masao.fujii@gmail.com>
From: Fujii Masao <masao.fujii@gmail.com>
To: Amul Sul <sulamul@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-20T12:20:22Z
Lists: pgsql-hackers
On Fri, Apr 17, 2026 at 9:55 PM Amul Sul <sulamul@gmail.com> wrote: > > Hi, > > I noticed that plsample.c uses an outdated method to convert text data > to a C string. This old method calls the textout function manually, > which adds unnecessary overhead. > > The attached patch replaces this with the TextDatumGetCString() macro. > This macro is more efficient and automatically handles "detoasting" > (decompressing/fetching) the data. > > Since plsample serves as a template for developers writing new > extensions, it should follow current best practices. This patch > updates the code in both the function and trigger handlers. LGTM. Regards, -- Fujii Masao
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
plsample: Use TextDatumGetCString() for text-to-CString conversion
- f1cfb48efb08 19 (unreleased) landed