Re: How to restore a dump containing CASTs into a database with a new user?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thorsten Schöning <tschoening(at)am-soft(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to restore a dump containing CASTs into a database with a new user?
Date: 2020-07-19 18:37:47
Message-ID: 206414.1595183867@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?utf-8?Q?Thorsten_Sch=C3=B6ning?= <tschoening(at)am-soft(dot)de> writes:
> Expectation was that whatever gets created in that DB is owned by the
> new user. But I'm running into the following error:

>> pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of type character varying or type inet

The error message seems pretty clear to me.

> Or can the CAST really only be created when the new DB-owner owns
> those types? Is that necessary per database then or globally for the
> public schema or one of the template databases or ...?

It's a security thing. A user who can create such a cast can thereby
change the behavior of other people's queries.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2020-07-19 19:01:32 Re: Re: PG 9.5.5 cores on AIX 7.1
Previous Message Thorsten Schöning 2020-07-19 18:25:47 How to restore a dump containing CASTs into a database with a new user?