Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h4oKy-0000ts-E6 for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Mar 2019 15:01:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h4oKx-0005aF-41 for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Mar 2019 15:01:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h4oKw-0005a8-Kf for pgsql-hackers@lists.postgresql.org; Fri, 15 Mar 2019 15:01:30 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h4oKl-0002Pa-Fq for pgsql-hackers@postgresql.org; Fri, 15 Mar 2019 15:01:29 +0000 Received: by mail-pg1-x52d.google.com with SMTP id r124so6670698pgr.3 for ; Fri, 15 Mar 2019 08:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=E6YZEvUQJncIVGncYq+18ss6xGsqLejbnDw6gXHkchc=; b=ZRSX5uHgA9ZsrSCYC+fQydVQKr6xYEkOhzFNAdYJd70g1G4BgU9pSvBexhMsBtEW70 SaUyJWwcOHbrzkniJGgW4dX+lxMu9JC/EaIxx5Fz0jZlqdAnnYn+nURgD7dARGxZ8KMV K+7DqZo8GsfNJQZZ9TaFAgovt4swWmCvVjW64= 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=E6YZEvUQJncIVGncYq+18ss6xGsqLejbnDw6gXHkchc=; b=qjM6vVcVplw4l8NZZD8rPyRIdUZ3hdgktVUaIkFsFN9VlEkWA2g7xoSo+fOxyNn6Mk VHmWSgr+pZqET2BWV6f6K963tmg8EQkiXjfhbCnQGufGX/7Ln69BRVA4svyH/mcOjZ6I 7Avvp1H/PSnBrQOwfd0LD5YLSQ87dY1xl6QtADiNGqgSQvPsJ+1Evm8nxZHTN8OR67Hu CaEOedWu2fUkSI/hnjk4NQkASq9R9aqlkVvE23ypsoajbUfwm4LpnG8SeyL5X36B0VEL /XKcHyTLiOYD+nhU30M52n0QVxBrHBU2z4ij9MoQuy/utNR0KvnFfW8oynmbDXqZKFfT PYGw== X-Gm-Message-State: APjAAAV2vwC8QeZTaChEaVoCPcaY5j1ylvhqqR/BKszlJulumy7fcPoT IPysMqEC0fyNti4AA12eGN60Ow== X-Google-Smtp-Source: APXvYqyaPjnAPYNME56drGRa+gDLFpAuUdjHyU7t2bFRGH5VOv24pBEI+yrgygBhXCVnemTFhCc1Yg== X-Received: by 2002:a62:445a:: with SMTP id r87mr4421437pfa.13.1552662076127; Fri, 15 Mar 2019 08:01:16 -0700 (PDT) Received: from rfd.leadboat.com (108-233-125-46.lightspeed.sntcca.sbcglobal.net. [108.233.125.46]) by smtp.gmail.com with ESMTPSA id q86sm7791393pfi.171.2019.03.15.08.01.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 08:01:14 -0700 (PDT) Date: Fri, 15 Mar 2019 08:01:12 -0700 From: Noah Misch To: Dagfinn Ilmari =?iso-8859-1?Q?Manns=E5ker?= Cc: Peter Eisentraut , pgsql-hackers Subject: Re: libpq environment variables in the server Message-ID: <20190315150112.GD2607362@rfd.leadboat.com> References: <33383613-690e-6f1b-d5ba-4957ff40f6ce@2ndquadrant.com> <744962da-c27f-c992-4058-364463857ee0@2ndquadrant.com> <20190303080620.GA1750246@rfd.leadboat.com> <35af0500-5eea-d2f0-339e-07a457a5f6bc@2ndquadrant.com> <20190315040053.GB2607362@rfd.leadboat.com> <872a3a54-a169-acfc-322a-f6c5b8e89ece@2ndquadrant.com> 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.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Mar 15, 2019 at 10:06:29AM +0000, Dagfinn Ilmari Mannsåker wrote: > Peter Eisentraut writes: > > > On 2019-03-15 05:00, Noah Misch wrote: > >> I consider the following style more idiomatic: > >> > >> { > >> local %ENV; > >> delete $ENV{PGAPPNAME}; > >> ... > >> } > > > > That doesn't work because the first line clears the entire environment. > > The solution to that is to do 'local %ENV = %ENV;', to assign a copy of > the original to the localised variable. That's the right thing, not what I wrote. We use that in src/bin/initdb/t/001_initdb.pl.