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 1j1v3F-0000KB-Dq for pgsql-general@arkaria.postgresql.org; Wed, 12 Feb 2020 16:39:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j1v3B-00040o-Ku for pgsql-general@arkaria.postgresql.org; Wed, 12 Feb 2020 16:39:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j1v39-00040h-JN for pgsql-general@lists.postgresql.org; Wed, 12 Feb 2020 16:39:45 +0000 Received: from [66.111.4.27] (helo=out3-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j1v35-0001Gh-IZ for pgsql-general@postgresql.org; Wed, 12 Feb 2020 16:39:42 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D16BA21E5B; Wed, 12 Feb 2020 11:39:28 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 12 Feb 2020 11:39:28 -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=fm2; bh=W MyECtuJEzevqS2gNPZioJs8rcCClPXCZVxMHjq1GyE=; b=nTXfjeaSIB9O8rhtH ZN9hcTGBgUs6rEQ5LK86hclYA71o6NwPG/2PLAsjjdjJl05MDhj0JDCivt57YJpr pnA3h7BB9kzoZhrhPhuVKScHX3n5Jgx57RjRIhwPDSxECg+qhozjHjgRri82uY1Q 4jFuvFAi6m1Wr6llhTsHF0ZHcLqT4bUz1gnC7Q4ZPZsLWlpFxt5ydljCN5c7NtbF Q8j6it3L7ADXTKdv0crNJCXlKqCuEOQRJhmRpLZ2/lWjHze4ltAA5cwvjG9aN8yB RisIyBe3hI6TmEofnaKIy965FZvMYr30ay0I4lI2zz+DNm/XDBn05uT1a7J1U10Z xsEeQ== 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=fm2; bh=WMyECtuJEzevqS2gNPZioJs8rcCClPXCZVxMHjq1G yE=; b=bWM97Jje7t1mPyZ2pnTTZprikxmQxm62nltIPO4GeIqZh/avmoeyEHvnp 0gOtJZcW9McRLkTis5NILLLThutZ5ClfnnxuvaCK59RHHX3Xjt0mOWz8aTPOKV6G 8EsoDouGhw+RsfoKr1VxA6g/AJbHzXJJciKDR9bf7Uhr55swYiMazPNApd5hrFgJ 6B9N2ucFnsCFJRhAdaWBS97btR+esh0l8yJdRV2s8OUFP9+E5H4bvP8kHoor8NPA Ga1vjwg2Y6maovB7HnTEDH4zKknwCObDW50JAoAa7JMwOLei8XJATzgKTrRqe0KK uFhICuA+g99wS7Z/jMeBm7IXzH3UQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieehgdelvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepphhoshhtghhrvghsqh hlrdhorhhgnecukfhppeejuddrvdduvddruddvledrudelfeenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrse grkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id E8CA3328005A; Wed, 12 Feb 2020 11:39:27 -0500 (EST) Subject: Re: How to restore roles without changing postgres password To: Andrus , Justin , pgsql-general@postgresql.org References: <38D406CB287140A49F635258B634E072@dell2> <4D6B3F5D59EA48A0BF711C8E461D6388@dell2> From: Adrian Klaver Message-ID: <91c20b33-cbea-457f-4f43-00a7b8288d7f@aklaver.com> Date: Wed, 12 Feb 2020 08:39:27 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <4D6B3F5D59EA48A0BF711C8E461D6388@dell2> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.27 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/11/20 11:31 PM, Andrus wrote: > Hi! > Thank you. > >pg_dumpall creates an SQL file which is just a simple text file > >you can then edit sql removing postgres user from  the file > >This can be automated in a script that searches the generated sql file > for the postgres user  replacing it with a blank/empty line or adds -- > to the bringing of >the line which comments it out. > This script creates cluster copy in every night. So this should be done > automatically. > I have little experience with Linux. > Can you provide example, how it should it be done using sed or other tool. > There is also second user named dbandmin whose password  cannot changed > also. > It would be best if  CREATE ROLE and ALTER ROLE  clauses for postgres > and dbadmin users are removed for file. Then we would get all sorts of posts about why they are not showing up anymore. This suggestion is a non starter. > Or if this is not reasonable, same passwords or different role names can > used in both clusters. They can be, you just have to track/manipulate that yourself. What it comes down to is that the Postgres project is not the admin for everyone's install. > Also I dont understand why GRANTED BY clauses appear in file. This looks > like noice. > GRANT documentation > https://www.postgresql.org/docs/current/sql-grant.html > does not contain GRANTED BY clause. It looks like pg_dumpall generates > undocumented clause. It is not noise, see: ~/src/bin/pg_dump/pg_dumpall.cpg_dumpall.c /* * We don't track the grantor very carefully in the backend, so cope * with the possibility that it has been dropped. */ if (!PQgetisnull(res, i, 3)) { char *grantor = PQgetvalue(res, i, 3); fprintf(OPF, " GRANTED BY %s", fmtId(grantor)); } fprintf(OPF, ";\n"); > Andrus. -- Adrian Klaver adrian.klaver@aklaver.com