Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wEncG-004PxQ-2d for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2026 12:20:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wEncE-002Muu-0C for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2026 12:20:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wEncD-002Muj-2V for pgsql-hackers@lists.postgresql.org; Mon, 20 Apr 2026 12:20:37 +0000 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wEncB-00000001vAN-3IDo for pgsql-hackers@lists.postgresql.org; Mon, 20 Apr 2026 12:20:36 +0000 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-7dbccf6a23dso2609032a34.2 for ; Mon, 20 Apr 2026 05:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776687635; cv=none; d=google.com; s=arc-20240605; b=GOXn/0u9DGOSko6D3s8ih5uDxrxGuuOopKUgsU7wJoqKzky52Hn3FSHFn4+v8LppQa fty5P3kM+Dzlgy9VkIoOnFQPT3X4V7a8+LMwRdgo97bQaMyVW/yF1VQPjEv0gobAansU oTD4JSvdNtyo5tOmJX4f4tWfppksOdoqGEEhgkLfcSs4vgNsQLVyf4nQWLqW0iavSnNV B/pmmbLSDdhD7x+NZn2z0qASoiyHaZg/n94DRJI+T2f5gYETjrnNhaxXROc4sRFdq1np wAlEEw4HQmwbxPs44nI3hOJhHWUomXYjEPGJYYcFf9VQQ3U6/jdLL7vx2/u44K4J3IBq LQNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4EmP5lYKMVxgd0DXxYNxFA2pz0dBIXCwv9zT94QOYFo=; fh=3hmI6alQkG3tVaYnSKTETtur/e6v+TpmyxTNHTxRj0M=; b=Tk3QkmaMkRtsKBehIkC9TRoYPFcSvcPiI/FXQOLTHG+benVW8EwC52eJbm5rid3QXn /7IxjbyuEqdAjNIxj/54Pfu6erkhGw2/Pkg13pITh2+nuEhelc77nUxeXDoKw0A3MyAG Qj4oylXLVmOqALZDweSVAiqfruB5+HOg7GM4J+QxsKLMO5sS7AGYlDGGG9iIUmHmudgz TH/GXtUfwq77INV+T2nsEp7vkNu3fo3One7wSh+W8an0Few9EGcAv8DbjZ6uEaORGHL4 wppzUN9htVIU3DAFcDbsIERfJ5yK9KAKEql0WnsKbG1fnSKZNBNWX5er6yl4j1UUPqdY Qlnw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776687635; x=1777292435; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4EmP5lYKMVxgd0DXxYNxFA2pz0dBIXCwv9zT94QOYFo=; b=fecb/z55jQbdjSp00ImDG6Xr5rDVGzyP1Eo1rSl8j2h+mLe5asmo/rHEbCOqfjYCb1 Oy5RQ6mTe1zlwXv0t+54zc+dsRA1XYJYOLSNXRvS1w1PlRM8oDbvd0WGJ84rZTEQFjwz +Et7as8LwrBeYXJGm5Y1N8K1Ia5XIDT5cLSWXiqI7xer5ONyNkYFb7ubba4asJkUvVco HCKzMRLlZ9FmjnDa79vcc4nnx6z7O7s2X+eaYmBYWAiUWQH4LCnWq/jHjzJyJQMx9A1v xUv7EWDzj6KYJPyJh3JcGJDT56pDV5DNYb7itkkC3yLzuXfl3kZuZLoSeSY9yJUkjGxc Ippw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776687635; x=1777292435; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4EmP5lYKMVxgd0DXxYNxFA2pz0dBIXCwv9zT94QOYFo=; b=iCdjdiSwnHG5Qd2owobGR5MfMpj+m1lGHiUeely6mbsKAYWZa5vnT88tdDA50Dsof4 5N5iqggRjgpZSJyBkJ0RfnOhUNvsLsPrYei6fQHHyLew3bEvIoecCKkh6owIFhDS7vFz dzuWoPZqVsW1UZjyuy5YxqXNkoUxF1abf7QLnrGYlIf/crieU1WkNdSQIbCqGbT4O7/3 h+1j0f1Ptzc+e4+vFjmkG1EJjAWiBT+YgFS2DBO2TW6feuYiSEvffHvqVBvrTxroeNRE lbgg/NYH+t36EnyPpX9S0WN49scy4xRlCDtoknvB0NrzqdhvQzb+0Twlgn2OfzlK8Fne Svbg== X-Gm-Message-State: AOJu0YzVmwheoPFnZdv9Mn7xmvFdo1W8BbwjT1rPyqTL5cFO6eLfevR0 KIvE38KB1qVFhphZ7izZ/6B6HRKHT4IZrXwZOdR93xA0XM5voyEo0o0fctdyDdaPm3YgKXEFCkT dTd/zfui6OWEhKiNIXNBRUP4oRKkOU38= X-Gm-Gg: AeBDietEIGpKQOTvOG9SyqW5EWzHSiOiRjdpwxtv05l95GNoE5xgGbEpA2uLd7tyZvr a+wPqemLIaMg1kP+hBC/AgMzDZFJvemzJ0/pYnErQUK3bA+WI/Y+LTIZuQesN2Vepg7GldoUbZu Sg04GTtAAKTYg/9VvSDslEr4zrmmMG6xe/CAKsZ6eDetaa5W+swRHr9Z463DpisoxL7QBckdfec DUNpM5b6Mkyx1S4GdnBV3e6LooTWI/SA1sMMPi/xLTuZzVI+15qoWp5/bEnBpkHosNLU7n4JraU PxX/i8paeQYDhifbCzdUyFdRpqdTxWHzyQagqoKmC4YcY60ihQwmNSYYApZTqkY= X-Received: by 2002:a05:6820:16a3:b0:67b:f1c8:edd8 with SMTP id 006d021491bc7-69462f6166emr7168663eaf.54.1776687635252; Mon, 20 Apr 2026 05:20:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fujii Masao Date: Mon, 20 Apr 2026 21:20:22 +0900 X-Gm-Features: AQROBzAsuvHPT8T2vHh3Z-PtTpZjX-8nz6uVkaReVxOMNUOhQ1jumZlfhl5LxBc Message-ID: Subject: Re: Cleanup: Use modern macro for text-to-CString conversion in plsample.c To: Amul Sul Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Apr 17, 2026 at 9:55=E2=80=AFPM Amul Sul wrote: > > 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. LGTM. Regards, --=20 Fujii Masao