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 1kFK6w-00015V-Vd for pgsql-committers@arkaria.postgresql.org; Mon, 07 Sep 2020 16:35:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kFK6N-00072P-B1 for pgsql-committers@arkaria.postgresql.org; Mon, 07 Sep 2020 16:34:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFK6N-00072I-3A for pgsql-committers@lists.postgresql.org; Mon, 07 Sep 2020 16:34:43 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kFK6K-0003oA-SW for pgsql-committers@lists.postgresql.org; Mon, 07 Sep 2020 16:34:41 +0000 Received: by mail-pj1-x1042.google.com with SMTP id n3so7613486pjq.1 for ; Mon, 07 Sep 2020 09:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Vt1myaa6nY0NllctSA6dSebBVQ2q6qii3VcMiALQg6o=; b=jiDyjh95Imdc2kacaQ76giXO8dS65db82HzX65Tw2wPMds7h/Se0lmYnD2SR6Mh8bA uL9tDR+0SBrs3gljUgUAMJsVJ25LuT3T2/86IJyw/tQvHD7NpevUNt1Hc+MbJqj9rG3i /JNch28IeAmZA5AKPFD+R2YFtjBcAtVQOE6PKmqMYc8uMrEh+tBQpceIE9PcVPujSyGd dEd7Fpy9K0pu7ktVp/jlTaQA7GnEqC4GNg2GbFUBlgAoJISVEQ9lW2x8q9WentCVCv+j IW7xLf4dUMjS3RCVfkXVdDyhTiNja2TPiD+WrQswWPIEGPoWSU3F4nzmwkiwKIn6qr0a Ep1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Vt1myaa6nY0NllctSA6dSebBVQ2q6qii3VcMiALQg6o=; b=gTDYAm/W/h4d7IMnrvmK4u+HjgyO7H1szH4Wsb+OV6Dnk5Vc/wWtZefjWDo6y/B0hS ibeCLT8nTKL+O0aUzIH41oPsnoaJ3m/t4fSI8RMDdo+yVplGrEHK4sL2zcOxwKoqYaie fL6cTpKFw7wxfFExx5dO2snfyLhV3ymncEnBoO2LdiVoOFbE/C8Votw4TiPYDDC2a86e 8u3nEYbdDUNlGjqn/0ZWD9Ymz7jBc3X/w02RIyiFKsgqfj3bIBp6h1eiZ47YEi5aiU16 4xEE8eobexUCJbdRjHJG7YuWEylOc+pvgO/TWr0oN/2uNjJ6yOqrnw9+li9SJ0CB0+Ew BlAA== X-Gm-Message-State: AOAM531Zis8G/iDYj687gY2AI3D7rd8pRevhhpVqIXn9KjVBkGZAHZx0 I4MmkFNpHJKzsr+LeDwI0fGg2RQ3PqSMA5RkgJw= X-Google-Smtp-Source: ABdhPJwyu6bQ/1a3/Vzqs7d6WvxC0K8sEmZ7oPaZueOUV2H6uCN/yxfsEUWMA7tYCttZLkXXGUzHE+eGpModPfsmxYY= X-Received: by 2002:a17:902:fe0b:: with SMTP id g11mr19977675plj.172.1599496479736; Mon, 07 Sep 2020 09:34:39 -0700 (PDT) MIME-Version: 1.0 References: <20200907142935.GA28809@alvherre.pgsql> <1668181.1599490126@sss.pgh.pa.us> In-Reply-To: <1668181.1599490126@sss.pgh.pa.us> From: Pavel Stehule Date: Mon, 7 Sep 2020 18:34:02 +0200 Message-ID: Subject: Re: pgsql: Refactor pg_get_line() to expose an alternative StringInfo-based To: Tom Lane Cc: Alvaro Herrera , pgsql-committers@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000007e85fa05aebbcb15" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --0000000000007e85fa05aebbcb15 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable po 7. 9. 2020 v 16:48 odes=C3=ADlatel Tom Lane napsal: > Alvaro Herrera writes: > > On 2020-Sep-07, Pavel Stehule wrote: > >> I tried to reuse this new API in pg_dump.c, and I had a problem with > >> private struct StringInfo. > > >> maybe there should be included directly with #include > "lib/stringinfo.h" ? > > > That's the right thing to do, yes. > > Yeah, if you want to use pg_get_line_append, you need to include > both those headers. > here is a patch diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 37e0d7ceab..0dcc518beb 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -72,6 +72,7 @@ #include "fe_utils/string_utils.h" #include "getaddrinfo.h" #include "getopt_long.h" +#include "lib/stringinfo.h" #include "mb/pg_wchar.h" #include "miscadmin.h" Regards Pavel > regards, tom lane > --0000000000007e85fa05aebbcb15 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
po 7. 9. 2020 v=C2=A016:48 odes=C3=AD= latel Tom Lane <tgl@sss.pgh.pa.us> napsal:
A= lvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2020-Sep-07, Pavel Stehule wrote:
>> I tried=C2=A0 to reuse this new API in pg_dump.c, and I had a prob= lem with
>> private struct StringInfo.

>> maybe there should be included directly with #include "lib/st= ringinfo.h" ?

> That's the right thing to do, yes.

Yeah, if you want to use pg_get_line_append, you need to include
both those headers.

here is a patch

diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb= /initdb.c
index 37e0d7ceab..0dcc518beb 100644
--- a/src/bin/initdb/in= itdb.c
+++ b/src/bin/initdb/initdb.c
@@ -72,6 +72,7 @@
=C2=A0#incl= ude "fe_utils/string_utils.h"
=C2=A0#include "getaddrinfo= .h"
=C2=A0#include "getopt_long.h"
+#include "lib= /stringinfo.h"
=C2=A0#include "mb/pg_wchar.h"
=C2=A0#i= nclude "miscadmin.h"
=C2=A0
Regards

Pavel




=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane
--0000000000007e85fa05aebbcb15--