Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o08RM-0008F3-GT for pgsql-general@arkaria.postgresql.org; Sat, 11 Jun 2022 21:14:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o08RL-00064v-Bd for pgsql-general@arkaria.postgresql.org; Sat, 11 Jun 2022 21:14:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o08RK-00064k-V4 for pgsql-general@lists.postgresql.org; Sat, 11 Jun 2022 21:14:39 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o08RI-0005yM-E8 for pgsql-general@lists.postgresql.org; Sat, 11 Jun 2022 21:14:38 +0000 Received: by mail-ej1-x62a.google.com with SMTP id y19so4216937ejq.6 for ; Sat, 11 Jun 2022 14:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=KyvyYa0tYQOLQ6ACMXFQR/cLZwKmsrclUD6mGaUOIQc=; b=YXNJXih0Hk1Iz532ds6ex4pNkQ/F2LizQB4nxgW7qPNnmIj3GsVR9jY/O+b0sMmORB +TtJOLzhQ+Yn6Jsb52MGfp5nMoewPEenBV6yw+aIBQkB7TCDu9vgn9d73sZRpB0GH9LU onvv+/B1cLkqIHEmcMm+AaQTiqiSArrQ7yfGVEyVmyuH36/hGme35nLatDUnCTaHyfEo ndqixfxYopO77qgBFMRLmY5GjuihFdzreqr3iqxnQoBvLnZmHlYgFhMSwIN0/UgTCo7j 20mkeYSFzKQ9R6ZZvq6tHm0rvVqTZpyCU4C/hiOD1JhGwKjoah/w4xAVlXycjgzvOEcJ KZ8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=KyvyYa0tYQOLQ6ACMXFQR/cLZwKmsrclUD6mGaUOIQc=; b=O3Mj6IFoGX4gM7kMh4Py6q0AjM4eQOva2U/SMtFimqLjHheIllNaglbB8GErjCxmPI X3jSR8aNsjI19RQ5wa7o2vFPXxg6uwVa8052yzzlwhNaFurvZWBz2geppS8iRSBU3nPe IdcAO9pXFwjVwnFRHD04knkdSvDLY3Y8VX5NK+1aoYfY6BBqOtprMWjmf0au6/rkrmy7 owHnq7CG18H1VunyJV5n5orh2rCMBIVR0N+1SLqzvq608wKtxyhj/UMlwZPoeKitSokp 1SiWtDK4L5g8L2BnMMtZNB75AMR2BgVRPL03yyKMHhOMHKhLY/1wPLEMp7zZdGFKIlZc qI+g== X-Gm-Message-State: AOAM530JTy08wulxeZHsfuDpbzb/6fcux1RNpjuHvgH74JKcEC8Di+1d eTojokyWPXI6x8eBuI8EAUM= X-Google-Smtp-Source: ABdhPJy/7+6JZ3VW9KWtjjglH6quWzrUQfzIQ8chpTsf4viKkmYqP8NflGEHVfyg7RVg0Lp7GoqGjA== X-Received: by 2002:a17:906:73d2:b0:712:3ca2:c5f with SMTP id n18-20020a17090673d200b007123ca20c5fmr5225482ejl.219.1654982075626; Sat, 11 Jun 2022 14:14:35 -0700 (PDT) Received: from smtpclient.apple (46-177-216.adsl.cyta.gr. [46.103.177.216]) by smtp.gmail.com with ESMTPSA id fr30-20020a170906891e00b006ff05d4726esm1509039ejc.50.2022.06.11.14.14.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Jun 2022 14:14:35 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Re: PG_GETARG_TEXT_PP vs PG_GETARG_TEXT_P From: Markur Sens In-Reply-To: <3105047.1654981562@sss.pgh.pa.us> Date: Sun, 12 Jun 2022 00:14:33 +0300 Cc: pgsql-general Content-Transfer-Encoding: quoted-printable Message-Id: <5C935137-83B0-4E61-BBEB-2D9D2840B8E9@gmail.com> References: <3105047.1654981562@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3696.100.31) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 12 Jun 2022, at 12:06 AM, Tom Lane wrote: >=20 > Markur Sens writes: >> In the =E2=80=9CExtending SQL=E2=80=9D chapter I see both of these = forms are mentioned.=20 >> But can=E2=80=99t find info about when to use which one. >=20 > PG_GETARG_TEXT_P returns a traditional-format, 4-byte-header value. >=20 > PG_GETARG_TEXT_PP is allowed to return either that or a 1-byte-header > value, in case that's what the input is. >=20 > 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. >=20 > regards, tom lane Ah Thanks. I wouldn=E2=80=99t have guessed that.=20 And I don=E2=80=99t see this mentioned in the header files either.=20 Is it worth adding a relevant comment in the documentation section?=20