public inbox for [email protected]  
help / color / mirror / Atom feed
From: Fujii Masao <[email protected]>
To: Amul Sul <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Cleanup: Use modern macro for text-to-CString conversion in plsample.c
Date: Mon, 20 Apr 2026 21:20:22 +0900
Message-ID: <CAHGQGwHRAs4LQwtWM2OY0w3Z6kM3fCwnjGdy=nx4oGsCA3SC7w@mail.gmail.com> (raw)
In-Reply-To: <CAAJ_b95-xMvUN1PEqxv8y6g-A-8k+fSgyv20kSZc9eF1wZAUPg@mail.gmail.com>
References: <CAAJ_b95-xMvUN1PEqxv8y6g-A-8k+fSgyv20kSZc9eF1wZAUPg@mail.gmail.com>

On Fri, Apr 17, 2026 at 9:55 PM Amul Sul <[email protected]> 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





view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Cleanup: Use modern macro for text-to-CString conversion in plsample.c
  In-Reply-To: <CAHGQGwHRAs4LQwtWM2OY0w3Z6kM3fCwnjGdy=nx4oGsCA3SC7w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox