]> git.ipfire.org Git - thirdparty/postgresql.git/commit
plsample: Use TextDatumGetCString() for text-to-CString conversion
authorFujii Masao <fujii@postgresql.org>
Mon, 20 Apr 2026 23:37:17 +0000 (08:37 +0900)
committerFujii Masao <fujii@postgresql.org>
Mon, 20 Apr 2026 23:37:17 +0000 (08:37 +0900)
commitf1cfb48efb086f99f6995f5d4b8a7c3ee289d1f0
treec12e4ac750d9c839f3d7a4f2707eb7e03b485964
parentf0ac6d494b56b83cf49d328ee0c5dd20df937fce
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@gmail.com>
Discussion: https://postgr.es/m/CAAJ_b95-xMvUN1PEqxv8y6g-A-8k+fSgyv20kSZc9eF1wZAUPg@mail.gmail.com
src/test/modules/plsample/plsample.c