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 1jxG8g-00021y-Dr for pgsql-general@arkaria.postgresql.org; Sun, 19 Jul 2020 20:42:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jxG8f-0005Yq-DO for pgsql-general@arkaria.postgresql.org; Sun, 19 Jul 2020 20:42:25 +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 1jxG8f-0005Yj-5d for pgsql-general@lists.postgresql.org; Sun, 19 Jul 2020 20:42:25 +0000 Received: from mail.am-soft.de ([83.218.36.120]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxG8X-0002ZZ-W3 for pgsql-general@lists.postgresql.org; Sun, 19 Jul 2020 20:42:24 +0000 Received: from mail.am-soft.de (localhost [127.0.0.1]) by mail.am-soft.de (Postfix) with ESMTP id 2DAF92BDEC99 for ; Sun, 19 Jul 2020 22:42:17 +0200 (CEST) Received: from tschoening-nb.fritz.box (unknown [77.78.163.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.am-soft.de (Postfix) with ESMTPSA id 0E6912BDEC8A for ; Sun, 19 Jul 2020 22:42:15 +0200 (CEST) Date: Sun, 19 Jul 2020 22:42:14 +0200 From: =?windows-1250?Q?Thorsten_Sch=F6ning?= Organization: AM-SoFT GmbH IT-Systeme Message-ID: <913009987.20200719224214@am-soft.de> To: pgsql-general@lists.postgresql.org Subject: Re: How to restore a dump containing CASTs into a database with a new user? In-Reply-To: <1834098334.20200719215112@am-soft.de> References: <1566481610.20200719202547@am-soft.de> <206414.1595183867@sss.pgh.pa.us> <1834098334.20200719215112@am-soft.de> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1250 Content-Transfer-Encoding: quoted-printable X-AV-Checked: ClamAV using ClamSMTP List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Guten Tag Thorsten Sch=F6ning, am Sonntag, 19. Juli 2020 um 21:51 schrieben Sie: > If they are not only created by superusers, how can I restore CASTs to > a database owned by some other user? There are no other users than > the one owning the database in my case. I've retried things and must have done something wrong before, but the following works now: > dropdb ams_sm_mtg > createdb --encoding=3DUTF-8 --locale=3Dde_DE.UTF-8 --owner=3Dams_sm_mtg -= -template=3Dtemplate0 ams_sm_mtg > psql --dbname=3Dams_sm_mtg > ALTER TYPE inet OWNER TO ams_sm_mtg; The latter is the important part and needs to be done as someone who owns the type right now. I might have missed issuing ALTER in the correct database before. The following doesn't work as well: > ams_sm_mtg=3D# SET ROLE ams_sm_mtg; > SET > ams_sm_mtg=3D> ALTER TYPE inet OWNER TO ams_sm_mtg; > ERROR: must be owner of type inet So only owners of types can give them to someone else. What I still don't understand is if that ownership is per database or per user or per cluster or per schema or ...? "\dT+" doesn't show that type in "ams_sm_mtg", only really customly created ones. But I could have different databases with different users deploying the same schema for the same apps and each fo those would need to own that type individually. Is that possible? Mit freundlichen Gr=FC=DFen, Thorsten Sch=F6ning --=20 Thorsten Sch=F6ning E-Mail: Thorsten.Schoening@AM-SoFT.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...........05151- 9468- 55 Fax...............05151- 9468- 88 Mobil..............0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Gesch=E4ftsf=FChrer: Andreas Muchow