Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLuIE-00HETH-Kq for pgsql-general@arkaria.postgresql.org; Tue, 25 Jun 2024 00:44:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sLuIC-00Ctlz-UE for pgsql-general@arkaria.postgresql.org; Tue, 25 Jun 2024 00:44:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLuIC-00Ctlr-FJ for pgsql-general@lists.postgresql.org; Tue, 25 Jun 2024 00:44:16 +0000 Received: from mta-p5.oit.umn.edu ([134.84.196.205]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLuI9-002yCb-Ok for pgsql-general@postgresql.org; Tue, 25 Jun 2024 00:44:15 +0000 Received: from localhost (unknown [127.0.0.1]) by mta-p5.oit.umn.edu (Postfix) with ESMTP id 4W7R0s0c4Zz9vKZQ for ; Tue, 25 Jun 2024 00:44:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p5.oit.umn.edu ([127.0.0.1]) by localhost (mta-p5.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QYn_yI8nV4u4 for ; Mon, 24 Jun 2024 19:44:12 -0500 (CDT) Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p5.oit.umn.edu (Postfix) with ESMTPS id 4W7R0r54v4z9vKZK for ; Mon, 24 Jun 2024 19:44:12 -0500 (CDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mta-p5.oit.umn.edu 4W7R0r54v4z9vKZK DKIM-Filter: OpenDKIM Filter v2.11.0 mta-p5.oit.umn.edu 4W7R0r54v4z9vKZK Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2c716d15884so6443691a91.0 for ; Mon, 24 Jun 2024 17:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=d.umn.edu; s=google; t=1719276251; x=1719881051; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+ZnUzUpUj8yazQDNZ8HlL2cwD7ZCsxZdLhXJbM4nCR8=; b=Y5xd0gvFh33/z3GKYsk6mpx9o/QLYrOkkYlA5EwV2K07MA9i/CJos2k7i0oIt+pwG7 QPBfpvG/vHKDfc1QH6QUIZrdXOaR5A9nhzszKeO3mWQySHg7WZDYOVqijf//HwLmohFV HpQ0rQGKffG42PT+5yaWc0wSASmemMM2AvhNgT16I0GoLDpXw4Big7TFOD/OG+aN7KEK HCxGq1x0ePSUqFbEjuU0g4KC0eboGWD9t8TT/I7uHl/1tscFhB3BnNcQWpaVIGw4AzOS PBWXgEUCwCcTlzWmSzui6NXjltUDWNxI/NdJwnS012c8aH1uvBMa5zl29C0PMvRrrPCa ANTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719276251; x=1719881051; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+ZnUzUpUj8yazQDNZ8HlL2cwD7ZCsxZdLhXJbM4nCR8=; b=faeMmIaQ4NRAa8CUztiCdue62RYNccfLn/XNUOs5tpJbP/KbsslRPLxVrfZv04umwZ nTlx6uMWPprYgShLyeyD/I7xDzESPw+xouR6EyN5fMFwnVMNoi3xDOEn2vjHGS4PbPGN 7mu5ehLiXrjWUna20MiOrJMw692ObN3R0ACfDatSwUhwm2VN3bSNCBJ7+Ho0wnqotZYE s5H4s8Iah1yKTmzDuR2r6i5oR0KuZk6+5XwL4QDSSi3weMc7fwfHGC3Zsvd13GSQwOTZ pHjIPtUL0PiVzUbh6Fs9XR3rdE68PGo2Ey8+atwDJqR89apj+yaGS3TJ7Ngmqun1tHGw VIWw== X-Gm-Message-State: AOJu0Yya6YOz4TeowQriCt3VLWYMK7a4gxfJlxq78AMXKm76FaPrOU95 InQ0E6MglPvUA6X3LqGsoTjyWGmrUhCnMU1nIfl6VmsnxIretT4lcbF0icuCj0CvHhcPANSJyPl 3dE0GcmXi3guqC4jmrtMlssb7tVuzk79S3ClebSDsj9NGd0Xs8QNKeW9MRSeLyrkJVaQ4qTpaC+ mXVYGwpwo/gC7y9jfRjqBBsBWfiGQqCpkGdwyKy9hEoetELvIHCA== X-Received: by 2002:a17:90b:3901:b0:2c2:d813:bffa with SMTP id 98e67ed59e1d1-2c8614867dcmr4476383a91.43.1719276250827; Mon, 24 Jun 2024 17:44:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvsW2QPePLse8oiAlzDQhNnejmtaGFYJxaJ+XMmNpCNoNdtrjPcrvQgbLwV+NfP5YTzODmjhkg125+trcXnHo= X-Received: by 2002:a17:90b:3901:b0:2c2:d813:bffa with SMTP id 98e67ed59e1d1-2c8614867dcmr4476372a91.43.1719276250325; Mon, 24 Jun 2024 17:44:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Matt Zagrabelny Date: Mon, 24 Jun 2024 19:43:58 -0500 Message-ID: Subject: Re: schema privileges and drop role To: Adrian Klaver Cc: "pgsql-general@postgresql.org >> PG-General Mailing List" Content-Type: multipart/alternative; boundary="0000000000002bfef8061bac32cd" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002bfef8061bac32cd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Adrian, Thanks for the reply! On Mon, Jun 24, 2024 at 7:03=E2=80=AFPM Adrian Klaver wrote: > On 6/24/24 17:00, Matt Zagrabelny wrote: > > Greetings, > > > > I have a database that I recently changed the ownership for and now I a= m > > attempting to drop the previous owner of the database: > > > > test_db=3D# drop ROLE legacy_owner; > > ERROR: role "legacy_owner" cannot be dropped because some objects > > depend on it > > DETAIL: privileges for schema public > > > > I don't know where to look to find out what I need to alter to be able > > to remove the legacy role and internet searches came up fruitless. > > Generally best to start with the docs: > > https://www.postgresql.org/docs/current/sql-droprole.html > > "A role cannot be removed if it is still referenced in any database of > the cluster; an error will be raised if so. Before dropping the role, > you must drop all the objects it owns (or reassign their ownership) and > revoke any privileges the role has been granted on other objects. The > REASSIGN OWNED and DROP OWNED commands can be useful for this purpose; > see Section 22.4 for more discussion." > Cool. I gave it a try, but came up with the same error: test_db=3D# REASSIGN OWNED by legacy_owner TO new_owner; REASSIGN OWNED Time: 0.212 ms test_db=3D# drop role legacy_owner; ERROR: role "legacy_owner" cannot be dropped because some objects depend on it DETAIL: privileges for schema public test_db=3D# I'd still like to see how to list the "privileges for schema public", but I do appreciate the REASSIGN OWNED command. Thanks! -m > > > > > Does anyone have any hints or advice on where to look? > > > > Thanks for the help! > > > > -m > > -- > Adrian Klaver > adrian.klaver@aklaver.com > > --0000000000002bfef8061bac32cd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Adrian,

= Thanks for the reply!

On Mon, Jun 24, 2024 at 7:03=E2=80=AFPM Adrian K= laver <adrian.klaver@aklave= r.com> wrote:
On 6/24/24 17:00, Matt Zagrabelny wrote:
> Greetings,
>
> I have a database that I recently changed the ownership for and now I = am
> attempting to drop the previous owner of the database:
>
> test_db=3D# drop ROLE legacy_owner;
> ERROR: =C2=A0role "legacy_owner" cannot be dropped because s= ome objects
> depend on it
> DETAIL: =C2=A0privileges for schema public
>
> I don't know where to look to find out what I need to alter to be = able
> to remove the legacy role and internet searches came up fruitless.

Generally best to start with the docs:

https://www.postgresql.org/docs/current/s= ql-droprole.html

"A role cannot be removed if it is still referenced in any database of=
the cluster; an error will be raised if so. Before dropping the role,
you must drop all the objects it owns (or reassign their ownership) and revoke any privileges the role has been granted on other objects. The
REASSIGN OWNED and DROP OWNED commands can be useful for this purpose;
see Section 22.4 for more discussion."

=
Cool. I gave it a try, but came up with the same error:

=
test_db=3D# REASSIGN OWNED by legacy_owner TO new_owner;
REAS= SIGN OWNED
Time: 0.212 ms
test_db=3D# drop role legacy_owner;
ERRO= R: =C2=A0role "legacy_owner" cannot be dropped because some objec= ts depend on it
DETAIL: =C2=A0privileges for schema public
test_db=3D= #

I'd still like to see how to list the "= privileges for schema public", but I do appreciate the REASSIGN OWNED = command.

Thanks!

-m
=C2=A0

>
> Does anyone have any hints or advice on where to look?
>
> Thanks for the help!
>
> -m

--
Adrian Klaver
adrian.klave= r@aklaver.com

--0000000000002bfef8061bac32cd--