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 1lOnBz-0005KQ-8Q for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Mar 2021 19:59:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lOnBx-00051x-Bf for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Mar 2021 19:59:53 +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 1lOnBw-00051q-W4 for pgsql-hackers@lists.postgresql.org; Tue, 23 Mar 2021 19:59:53 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lOnBu-0005zQ-H1 for pgsql-hackers@postgresql.org; Tue, 23 Mar 2021 19:59:51 +0000 Received: by mail-qt1-x833.google.com with SMTP id c6so15918245qtc.1 for ; Tue, 23 Mar 2021 12:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wi3ck-info.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=xhZH7Swwj5WFNIM9wQMWKsL7HqcBaa7zqsNBIwFi7yY=; b=kotC45Ca/gBrNHltYa/S9xklG/KdVtHTB94yDrJLeRAznNBuKidFLhRaPHX7O7Y+t7 3iAvwx9S4rWCg1uxM9fTW6NT+7s1rZ2nmuOQbZ4AYhxeUZSR9gwur3JrafXQklSllyX7 9AqhmlExFkQnCPLh/FGfvmfJ+L2jz7cGBI24if1GPhlsKhYzOp1nu/1LJrzYrqcOE3+a IuzgndnZkp+tVJGfJ2huxpU01tIEQpaRP20won8TnomyZIqTa3k60WEqtdKvoYcIOPQX TbfUuoHwIh4K0B1BjhyLwbfCkO8KCPFOkhUi210/UHDkKsOpCgyAA1d7Xi6QOEVtP+tm 1DkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xhZH7Swwj5WFNIM9wQMWKsL7HqcBaa7zqsNBIwFi7yY=; b=QP5oXZ8hkwOKxh+cddKBc1Uf9I3+xNA+DBdNtpIdNcgmnf8fOo1AvG8TcakTQUFbOd 7OAs2ptnkDtm5tYWNOJmg3p1aT474idVLTNcjLtut5wIdGxXSEuOzVW5znK58dWq/kdp AeyI6DMqWnwPPaQ4q9kpppTQNeTzlLCyx1eaWe+pyTmKNySCZfOxivHst+AVxAPVgYIk 4Y+Ag4l0j2IHmFLZITXDfDRy93VJ6yAtsk8VVzZzS1uLhJJiaYTyYXnG2AVQm47NxWsY ftVdn/nqXezyKQheHQEBh3EQLrK7nZQqTD18gvPA1YP2QhRgBXrdrC8tZ1VfG9BMVAnU XXvA== X-Gm-Message-State: AOAM532vKWnT1oI9memvyezZMbDw+a7fiBlJIdoX56acKV5h5Po4Qa4P 7BCv9YQcEJX63RjYvkMnb/IEPwPoUi2TDWp6 X-Google-Smtp-Source: ABdhPJxpg4opVzgw9nn+/hjNshlyTh9OKE6uok8MAW/1CdXx+SsYJJg3+idnkZMX61Gnp0+9nHrhMQ== X-Received: by 2002:ac8:6696:: with SMTP id d22mr5970202qtp.67.1616529589191; Tue, 23 Mar 2021 12:59:49 -0700 (PDT) Received: from jupiter.onmars.janwieck.no-ip.info (pool-98-114-241-134.phlapa.fios.verizon.net. [98.114.241.134]) by smtp.gmail.com with ESMTPSA id h5sm12850366qko.83.2021.03.23.12.59.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Mar 2021 12:59:48 -0700 (PDT) Subject: Re: pg_upgrade failing for 200+ million Large Objects To: Tom Lane Cc: Bruce Momjian , Zhihong Yu , Andrew Dunstan , Magnus Hagander , Robins Tharakan , Peter Eisentraut , "pgsql-hackers@postgresql.org" References: <181907.1616253799@sss.pgh.pa.us> <147fa478-510b-18ef-5323-9c1725b2493c@wi3ck.info> <5bdcb010-ecdd-c69a-b441-68002fc38483@wi3ck.info> <3886649c-c77d-dfd7-08a4-d1606bc71254@wi3ck.info> <91ccdb0d-42fd-7413-4e7c-3d6445655d2e@wi3ck.info> <20210323145628.GD579@momjian.us> <8d8d3961-8e8b-3dbe-f911-6f418c5fb1d3@wi3ck.info> <20210323180646.GG579@momjian.us> <91b02dc1-f0d9-e50d-849c-18d9a66484fb@wi3ck.info> <985941.1616524546@sss.pgh.pa.us> <986904.1616525964@sss.pgh.pa.us> <6cccaa33-c263-b8a2-b064-985605d33d25@wi3ck.info> <988415.1616528159@sss.pgh.pa.us> From: Jan Wieck Message-ID: <872315a8-99fc-da4e-463d-784cfb5a025d@wi3ck.info> Date: Tue, 23 Mar 2021 15:59:48 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <988415.1616528159@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/23/21 3:35 PM, Tom Lane wrote: > Jan Wieck writes: >> The problem here is that pg_upgrade itself is invoking a shell again. It >> is not assembling an array of arguments to pass into exec*(). I'd be a >> happy camper if it did the latter. But as things are we'd have to add >> full shell escapeing for arbitrary strings. > > Surely we need that (and have it already) anyway? There are functions to shell escape a single string, like appendShellString() but that is hardly enough when a single optarg for --restore-option could look like any of --jobs 8 --jobs=8 --jobs='8' --jobs '8' --jobs "8" --jobs="8" --dont-bother-about-jobs When placed into a shell string, those things have very different effects on your args[]. I also want to say that we are overengineering this whole thing. Yes, there is the problem of shell quoting possibly going wrong as it passes from one shell to another. But for now this is all about passing a few numbers down from pg_upgrade to pg_restore (and eventually pg_dump). Have we even reached a consensus yet on that doing it the way, my patch is proposing, is the right way to go? Like that emitting BLOB TOC entries into SECTION_DATA when in binary upgrade mode is a good thing? Or that bunching all the SQL statements for creating the blob, changing the ACL and COMMENT and SECLABEL all in one multi-statement-query is. Maybe we should focus on those details before getting into all the parameter naming stuff. Regards, Jan -- Jan Wieck Principle Database Engineer Amazon Web Services