| From: | Amul Sul <sulamul(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Cleanup: Use modern macro for text-to-CString conversion in plsample.c |
| Date: | 2026-04-17 12:54:58 |
| Message-ID: | CAAJ_b95-xMvUN1PEqxv8y6g-A-8k+fSgyv20kSZc9eF1wZAUPg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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 | Content-Type | Size |
|---|---|---|
| 0001-plsample-Use-TextDatumGetCString-for-text-to-CString.patch | application/x-patch | 1.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2026-04-17 13:47:08 | Re: Row pattern recognition |
| Previous Message | cca5507 | 2026-04-17 12:45:57 | Re: [PATCH] Fix hashed ScalarArrayOp semantics for NULL LHS with non-strict comparators |