Re: Cleanup: Use modern macro for text-to-CString conversion in plsample.c - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Cleanup: Use modern macro for text-to-CString conversion in plsample.c
Date
Msg-id CAHGQGwHRAs4LQwtWM2OY0w3Z6kM3fCwnjGdy=nx4oGsCA3SC7w@mail.gmail.com
Whole thread
In response to Cleanup: Use modern macro for text-to-CString conversion in plsample.c  (Amul Sul <sulamul@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Skipping schema changes in publication
Next
From: Xuneng Zhou
Date:
Subject: Re: First draft of PG 19 release notes