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