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 1jxECE-00063h-Du for pgsql-general@arkaria.postgresql.org; Sun, 19 Jul 2020 18:37:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jxECB-00022M-2I for pgsql-general@arkaria.postgresql.org; Sun, 19 Jul 2020 18:37:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxECA-00022D-Qm for pgsql-general@lists.postgresql.org; Sun, 19 Jul 2020 18:37:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxEC8-0001Vt-3p for pgsql-general@lists.postgresql.org; Sun, 19 Jul 2020 18:37:54 +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 06JIblls206415; Sun, 19 Jul 2020 14:37:47 -0400 From: Tom Lane To: =?utf-8?Q?Thorsten_Sch=C3=B6ning?= cc: pgsql-general@lists.postgresql.org Subject: Re: How to restore a dump containing CASTs into a database with a new user? In-reply-to: <1566481610.20200719202547@am-soft.de> References: <1566481610.20200719202547@am-soft.de> Comments: In-reply-to =?utf-8?Q?Thorsten_Sch=C3=B6ning?= message dated "Sun, 19 Jul 2020 20:25:47 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <206413.1595183867.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 19 Jul 2020 14:37:47 -0400 Message-ID: <206414.1595183867@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?utf-8?Q?Thorsten_Sch=3DC3=3DB6ning?=3D 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 ow= ner 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