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 1syu0n-002xML-Io for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2024 14:19:31 +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 1syu0m-001GEs-QJ for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2024 14:19:29 +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 1syu0l-001GEk-LD for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2024 14:19:28 +0000 Received: from mout-u-204.mailbox.org ([2001:67c:2050:101:465::204]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1syu0h-000Lvy-VU for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2024 14:19:27 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (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-204.mailbox.org (Postfix) with ESMTPS id 4XPX1x5R0dz9syr; Thu, 10 Oct 2024 16:19:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1728569957; 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=HZqVNbz/R9rhhwbYLCJHLb7Kx2ceMua0d7KvTNuyrYg=; b=l3h4l2TMBPx9050KQMetdygXJZIA6qsLEWBwqUN0G18egIzFOV9k+L7loomIBQWBNpPpFK alh+aIuAycNiPbH6A8R5m15iOBEbpre3nYrD7qA8UiPLQxC3DLxyLpLwEc335CgmcabQe3 ysc2HmJi1tV0KGQQDM6zRRv+Q6IFTlMuBBfrhGhMjwI0ZHobt+u0dr4DOd8nyybp1ypHrX wCgccOyh6R0sP1tp/POvm6253jnh6JIvj3zHS2Aj8Wvp73ws3ieFPRlaZxNZYUbHP/CSQG 5pWvqP2peAcSpNGMVSKgn71/J+LcZmP/1/d4KjSOXwqYsra51zrxwAa/gVT0ZA== Date: Thu, 10 Oct 2024 16:19:14 +0200 From: Erik Wienhold To: Dominique Devienne Cc: pgsql-general@lists.postgresql.org Subject: Re: Tablespace ACLs Message-ID: <04e246e5-6808-4050-871d-07efc1cea715@ewie.name> References: <711b77fc-f9e5-4637-8a2c-9cc1a3b3f4da@ewie.name> <833a8d75-09d7-4691-85bc-1ae0d16097e2@ewie.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <833a8d75-09d7-4691-85bc-1ae0d16097e2@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. On second thought, just guarding the pg_tablespace_size() call and reporting an unknown size when permissions are insufficient is better, so that \db+ still lists all tablespaces like \db does. 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", CASE WHEN pg_catalog.has_tablespace_privilege(t.oid, 'CREATE') OR pg_catalog.pg_has_role('pg_read_all_stats', 'USAGE') OR dattablespace IS NOT NULL -- is default tablespace THEN pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(t.oid)) ELSE null -- unknown size END AS "Size", pg_catalog.shobj_description(t.oid, 'pg_tablespace') AS "Description" FROM pg_catalog.pg_tablespace t LEFT JOIN pg_catalog.pg_database ON datname = pg_catalog.current_database() AND dattablespace = t.oid ORDER BY 1; -- Erik