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 1lO2un-00035W-De for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Mar 2021 18:35:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lO2um-0003Hn-BW for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Mar 2021 18:35:04 +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 1lO2um-0003Hg-4P for pgsql-hackers@lists.postgresql.org; Sun, 21 Mar 2021 18:35:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lO2uj-0007qM-9Y for pgsql-hackers@postgresql.org; Sun, 21 Mar 2021 18:35:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 12LIYw1w388711; Sun, 21 Mar 2021 14:34:58 -0400 From: Tom Lane To: Jan Wieck cc: Magnus Hagander , Robins Tharakan , Peter Eisentraut , "pgsql-hackers@postgresql.org" Subject: Re: Fix pg_upgrade to preserve datdba In-reply-to: <388155.1616351018@sss.pgh.pa.us> References: <1742698.1615221182@sss.pgh.pa.us> <1743618.1615222719@sss.pgh.pa.us> <4fbf92f2-ec91-f4fa-a259-f0968e34f3d7@wi3ck.info> <0b5d506d-70d2-1506-bbdf-89e6453c0289@wi3ck.info> <384713.1616345832@sss.pgh.pa.us> <2284b71d-af55-2625-f8c2-cedf1f1a70ca@wi3ck.info> <388155.1616351018@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 21 Mar 2021 14:23:38 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <388709.1616351698.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 21 Mar 2021 14:34:58 -0400 Message-ID: <388710.1616351698@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Needs a little more work than that --- we should allow it to respond > to the --no-owner switch, for example. But I think likely we can do > it where other object ownership is handled. I'll look in a bit. Actually ... said code already DOES do that, so now I'm confused. I tried regression=3D# create user joe; CREATE ROLE regression=3D# create database joe owner joe; CREATE DATABASE regression=3D# \q $ pg_dump -Fc joe >joe.dump $ pg_restore --create -f - joe.dump | more and I see -- -- Name: joe; Type: DATABASE; Schema: -; Owner: joe -- CREATE DATABASE joe WITH TEMPLATE =3D template0 ENCODING =3D 'SQL_ASCII' L= OCALE =3D 'C'; ALTER DATABASE joe OWNER TO joe; so at least in this case it's doing the right thing. We need a bit more detail about the context in which it's doing the wrong thing for you. regards, tom lane