Re: PG_GETARG_TEXT_PP vs PG_GETARG_TEXT_P - Mailing list pgsql-general

From Tom Lane
Subject Re: PG_GETARG_TEXT_PP vs PG_GETARG_TEXT_P
Date
Msg-id 3105047.1654981562@sss.pgh.pa.us
Whole thread Raw
In response to PG_GETARG_TEXT_PP vs PG_GETARG_TEXT_P  (Markur Sens <markursens@gmail.com>)
Responses Re: PG_GETARG_TEXT_PP vs PG_GETARG_TEXT_P  (Markur Sens <markursens@gmail.com>)
List pgsql-general
Markur Sens <markursens@gmail.com> writes:
> In the “Extending SQL” chapter I see both of these forms are mentioned. 
> But can’t find info about when to use which one.

PG_GETARG_TEXT_P returns a traditional-format, 4-byte-header value.

PG_GETARG_TEXT_PP is allowed to return either that or a 1-byte-header
value, in case that's what the input is.

PG_GETARG_TEXT_PP is preferred in new code since it can avoid one
step of palloc-and-copy-the-value; the only real downside is you
have to use the appropriate macros to get the string's start address
and length.

            regards, tom lane



pgsql-general by date:

Previous
From: Markur Sens
Date:
Subject: PG_GETARG_TEXT_PP vs PG_GETARG_TEXT_P
Next
From: Markur Sens
Date:
Subject: Re: PG_GETARG_TEXT_PP vs PG_GETARG_TEXT_P