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 1sytl9-002veF-BQ for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2024 14:03:20 +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 1sytl8-00103C-I7 for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2024 14:03:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sytl8-001031-4K for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2024 14:03:18 +0000 Received: from mout-u-107.mailbox.org ([80.241.59.207]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sytl4-000Loy-4P for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2024 14:03:17 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4XPWgN3CsFz9snS; Thu, 10 Oct 2024 16:03:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1728568992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sDOwJbe9bqTuwT9BJBQTWOp27v+gOveAv09yg7eQti8=; b=h0jOFvCevVmOiED4+7AnOEisrxdIhC91BKKTEOhDDGzkijkL6ScSk/mFCX+eExGnJk4nsv CYPgSFRX/FdXaJj5q1q6R8dhb12uGScEvlpMEPeLoNpJrv/OsyW5GtEPFTRwTaDux/V0g3 PvpYwLoXyJ6gIQA/LSFvdl0hHi91INL4MC4cBQgR74pPY6NdA1n4T6+0Kx1/E9pXGbvIgX ajU7Y9EPcTdLiSPpBiNtgj9rpf3sSf7azqlRisdn43aIgFUf2mKgB6GPTgCa+1lGMp7tM+ VwMlmhBPhvZDA82uFYrBOxR1UEde5289MOrbcYJAmnL+FenqgXvExBxMIir3rA== Date: Thu, 10 Oct 2024 16:03:10 +0200 From: Erik Wienhold To: Dominique Devienne Cc: pgsql-general@lists.postgresql.org Subject: Re: Tablespace ACLs Message-ID: <833a8d75-09d7-4691-85bc-1ae0d16097e2@ewie.name> References: <711b77fc-f9e5-4637-8a2c-9cc1a3b3f4da@ewie.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <711b77fc-f9e5-4637-8a2c-9cc1a3b3f4da@ewie.name> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > On 2024-10-10 14:35 +0200, Dominique Devienne wrote: > > On a related but different matter, is it normal not having access to a > > single tablespace makes the whole output disappear? > > > > ddevienne=> \db+ > > ERROR: permission denied for tablespace hdd_data > > This lacks permission for executing pg_tablespace_size(). Granting > pg_read_all_stats should be sufficient. But I agree, omitting the > non-accessible tablespaces would be better IMO. Maybe something along those lines: SELECT spcname AS "Name", pg_catalog.pg_get_userbyid(spcowner) AS "Owner", pg_catalog.pg_tablespace_location(t.oid) AS "Location", pg_catalog.array_to_string(spcacl, E'\n') AS "Access privileges", spcoptions AS "Options", pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(t.oid)) AS "Size", pg_catalog.shobj_description(t.oid, 'pg_tablespace') AS "Description" FROM pg_catalog.pg_tablespace t LEFT JOIN pg_catalog.pg_database d ON datname = pg_catalog.current_database() AND dattablespace = t.oid WHERE pg_catalog.has_tablespace_privilege(t.oid, 'CREATE') OR pg_has_role('pg_read_all_stats', 'USAGE') OR dattablespace IS NOT NULL -- is default tablespace? ORDER BY 1; -- Erik