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 1k3JVm-00021B-N3 for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Aug 2020 13:31:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k3JVl-0007ol-Mb for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Aug 2020 13:31:17 +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 1k3JVl-0007oe-Bv for pgsql-hackers@lists.postgresql.org; Wed, 05 Aug 2020 13:31:17 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k3JVi-0001Uz-S1 for pgsql-hackers@lists.postgresql.org; Wed, 05 Aug 2020 13:31:16 +0000 Received: by mail-qk1-x72c.google.com with SMTP id m7so9454924qki.12 for ; Wed, 05 Aug 2020 06:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=NOc6kTd47KbzkEjd6T9zlwkY0AoQnThYfMTZCtC/rvo=; b=njODngUPi21qS38JUxjN2cyclj2g0OOABXdf2xI56dyx1SlwbThMPntKteNPZvY7N4 P0arhf5yKg3kn9k59S+d8PzFFK8DANSb7h/osxQn57LmAlKaSu76GiQh3tsbczbs8bvd AFhjxRst9X6RwuQR0dCsoDOHY5JiOeQ/5PHbyT1tpnOgvyEU8KqWzfi8UK89D3zrF/jz hf8Bw5AMWKyjBD3YzLoQZMSl25jLvZmmKOe4NTjLytjhjb18mMr9G1rwhM9//Q5sRqpx lB7Twa5GS36QRjvWWBbAzZUECWqBa6IO/Ykv3hLTGk2X+RxCQHyGvhqmc5rrkov7OVAA 16Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=NOc6kTd47KbzkEjd6T9zlwkY0AoQnThYfMTZCtC/rvo=; b=GuAPc3nN10QUDZ9byDxYzm0ZvUf/6bd/O9jtvkzduMD9DtMJ47DPpJhG3q85MG0sQk SuQh4TUMLdBS1+8m54qJlwEjHJ+zzMzs5HtaJUxO2IvBwap1CvHC5Z8gcI16/FmXy7jd uZ9TS7rFhrGjM45zX6YVzlp14VuAEK2mjCopapvUHb88b9NMg2LYTSBIP/0+dLdZDI0J t/ka8aanFrSnRhS2tB4ex9CEJ2FoKGdF3Bm1auBR1xEQCWYA717mw5+N3fk1eIBZ0eSD Er8WIArGTfmogf+c866YD5cEPkmDgKvvSN3kRCQcJnBZ1phGrE7ZeyPN86VpMudcNoxO odRA== X-Gm-Message-State: AOAM530tYbpuUNxF99fZqNq6hTJppDTtaW0vlACkgoBWqOgoIxDVbHY3 UBYD+8beFMxM/Ygpzk0aE7WebRz1Z/H3d7OSSVzcZ37hpdVf7nzxKREDNuscOPItKFhFOJxNo05 Kt6R+5W4GE8XvT0OHeQgpgjiZsFwKqoSWoJ+froB1N4ql3qXXCcJCMrFMYlztkvXfd3jx7Z4a8I i+4q1+jlZEh0ngIA== X-Google-Smtp-Source: ABdhPJz1ets4oZqhwhoVx0K1s5BxidjFKR96tY6V/OvKBTotHd2a0o88cF/jcaWQYQczb7HePxzZ6w== X-Received: by 2002:a05:620a:13f7:: with SMTP id h23mr3398058qkl.396.1596634273181; Wed, 05 Aug 2020 06:31:13 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id q13sm1674513qkn.85.2020.08.05.06.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 06:31:12 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 7CE962A0D0F; Wed, 5 Aug 2020 09:31:10 -0400 (-04) Date: Wed, 5 Aug 2020 09:31:10 -0400 From: Alvaro Herrera To: Asim Praveen Cc: Georgios , PostgreSQL Hackers Subject: Re: [PATCH] - Provide robust alternatives for replace_string Message-ID: <20200805133110.GA18474@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Aug-05, Asim Praveen wrote: > Please find attached a StringInfo based solution to this problem. It > uses fgetln instead of fgets such that a line is read in full, without > ever splitting it. never heard of fgetln, my system doesn't have a manpage for it, and we don't use it anywhere AFAICS. Are you planning to add something to src/common for it? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services