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

From Amul Sul
Subject Cleanup: Use modern macro for text-to-CString conversion in plsample.c
Date
Msg-id CAAJ_b95-xMvUN1PEqxv8y6g-A-8k+fSgyv20kSZc9eF1wZAUPg@mail.gmail.com
Whole thread
Responses Re: Cleanup: Use modern macro for text-to-CString conversion in plsample.c
List pgsql-hackers
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.

--
Regards,
Amul Sul
EDB: http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: "cca5507"
Date:
Subject: Re: [PATCH] Fix hashed ScalarArrayOp semantics for NULL LHS with non-strict comparators
Next
From: Tatsuo Ishii
Date:
Subject: Re: Row pattern recognition