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 1iei0n-0006F1-EN for pgsql-general@arkaria.postgresql.org; Tue, 10 Dec 2019 16:05:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iei0k-0006Lz-Iv for pgsql-general@arkaria.postgresql.org; Tue, 10 Dec 2019 16:05:18 +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 1iei0k-0006Ls-8l for pgsql-general@lists.postgresql.org; Tue, 10 Dec 2019 16:05:18 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iei0h-0008U1-4E for pgsql-general@lists.postgresql.org; Tue, 10 Dec 2019 16:05:17 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6243F2213F; Tue, 10 Dec 2019 11:05:13 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 10 Dec 2019 11:05:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=z 6DnhL8cE0EyLVJoi1x4oOcAQiFY6IKVDfEMXdvWtl0=; b=SM/sHxuKYVJIq9uPd 6g3goUvSCye+4osj8HVKCmT1hAb/SyJt4y5jBUXg7keL7VYvE47SfMSjJGS+YCo1 4EUADZQvysDKbtZnY71cCFEIyiNkni0YrXOsjbARfv/n0+mxz77WV7nPoWcPojdQ Od+69C1hJwXq7pdGdHrp20USsL32wmTBZ58p/y5OYF91c/wBzrXT2uQ/L5u9IGE8 vZf/xsQmKwpzRHJRth+FpJQcF9XKYvrWySa0OQt4pvvfLPfWmSFDCGcTCdshJT1r mToQwWk3WtwPC5Kt74uYkY2MfPuVD3gzeRHjW4mtvPxh990Yur9FfN1AYhxxaLUf lwIEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=z6DnhL8cE0EyLVJoi1x4oOcAQiFY6IKVDfEMXdvWt l0=; b=seDGy1WRQb8WLqSms7VRp6Qa8soMWHET8TCCfojyxJgnjdlyMS6+dpKD7 3zdAHcusiAT3LqTKzNDjBPCgjrOlWVkyjdMR5RDscbTwbfEdfuTFAKsh9XDnZ7Qy MCBR+ZJsNNThoUzaqJBYYRQYQzFmf+E5n1ufOE4mQo6Z1snN/dds9Z4bx/z1hi/n XOFoLBrgEd/rorkHbEaI/k1eHavBlgU/x2axGjG5ZO/uqkKy4vJQLJbEsoNmFAL1 qR9VUKEN5ccgxmBVfCyYYqCUToyzpipCtbBmqS7MM5Q9lAn/0iS20ft3Pu1/oh1I IxAZEkWJvjGSpaak3/CNBoABMaeig== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudelfedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecukfhppeejuddrvddu vddrudefledrudejnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrg hvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.2] (unknown [71.212.139.17]) by mail.messagingengine.com (Postfix) with ESMTPA id 7B1D180063; Tue, 10 Dec 2019 11:05:12 -0500 (EST) Subject: Re: PGUSER and initdb To: =?UTF-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= , "pgsql-generallists.postgresql.org" References: From: Adrian Klaver Message-ID: <61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com> Date: Tue, 10 Dec 2019 08:05:11 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/10/19 5:21 AM, Олег Самойлов wrote: > PGUSER doesn't work with initdb and pg_ctl initdb. Lets explain, where this can be important. For instance in MacOS the most convenient way to manage PostgresQL is homebrew. > > To install PostgresQL: > > brew install postgresql > > To upgrade: > > brew upgrade postgresql > > this will upgrade soft and to upgrade DB > > brew postgresql-upgrade-database > > The later command do: install previous version of PostgresQL, move postgresql dir to postgesql.old, run pg_upgrade and so on. Convenient. > > But this command don't have option to define name of superuser. The only variant to set name off superuser is to use PGUSER environment variable. But PGUSER understand only pg_upgrade, but not initdb. Hmm: https://www.postgresql.org/docs/12/app-initdb.html " -U username --username=username Selects the user name of the database superuser. This defaults to the name of the effective user running initdb. It is really not important what the superuser's name is, but one might choose to keep the customary name postgres, even if the operating system user's name is different. ... This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 33.14). " https://www.postgresql.org/docs/12/libpq-envars.html " PGUSER behaves the same as the user connection parameter. " Seems to me this is something that you need to bring up with the Brew maintainers. > > -- Adrian Klaver adrian.klaver@aklaver.com