Re: Fix pg_upgrade to preserve datdba

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jan Wieck <jan(at)wi3ck(dot)info>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Robins Tharakan <tharakan(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix pg_upgrade to preserve datdba
Date: 2021-03-21 18:34:58
Message-ID: 388710.1616351698@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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=# create user joe;
CREATE ROLE
regression=# create database joe owner joe;
CREATE DATABASE
regression=# \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 = template0 ENCODING = 'SQL_ASCII' LOCALE = '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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-03-21 19:02:58 Re: default result formats setting
Previous Message Konstantin Knizhnik 2021-03-21 18:32:28 Re: Built-in connection pooler