pgsql: plsample: Use TextDatumGetCString() for text-to-CString conversi

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: plsample: Use TextDatumGetCString() for text-to-CString conversi
Date: 2026-04-20 23:40:10
Message-ID: E1wEyDp-001vd9-1v@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

plsample: Use TextDatumGetCString() for text-to-CString conversion

Replace the outdated DatumGetCString(DirectFunctionCall1(textout, ...))
pattern with TextDatumGetCString(). The macro is the modern, more
efficient way to convert a text Datum to a C string as it avoids
unnecessary function call machinery and handles detoasting internally.

Since plsample serves as reference code for extension authors, it
should follow current idiomatic practices.

Author: Amul Sul <sulamul(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAAJ_b95-xMvUN1PEqxv8y6g-A-8k+fSgyv20kSZc9eF1wZAUPg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f1cfb48efb086f99f6995f5d4b8a7c3ee289d1f0

Modified Files
--------------
src/test/modules/plsample/plsample.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-04-20 23:47:36 pgsql: doc: Correct context description for some JIT support GUCs
Previous Message Tom Lane 2026-04-20 23:38:06 Re: pgsql: Clean up all relid fields of RestrictInfos during join removal.