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 1l8UVs-0001Sv-Fz for pgsql-docs@arkaria.postgresql.org; Sat, 06 Feb 2021 20:49:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l8UVL-0002Oi-Dk for pgsql-docs@arkaria.postgresql.org; Sat, 06 Feb 2021 20:48:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8UVK-0002Ob-Va for pgsql-docs@lists.postgresql.org; Sat, 06 Feb 2021 20:48:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8UVH-0001u6-V7 for pgsql-docs@lists.postgresql.org; Sat, 06 Feb 2021 20:48:29 +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 116KmQuT329138; Sat, 6 Feb 2021 15:48:26 -0500 From: Tom Lane To: tarest2@gmail.com cc: pgsql-docs@lists.postgresql.org Subject: Re: The synopsis of "ALTER DEFAULT PRIVILEGES" statement is too difficult to understand In-reply-to: <161255874662.10297.16360845410596491854@wrigleys.postgresql.org> References: <161255874662.10297.16360845410596491854@wrigleys.postgresql.org> Comments: In-reply-to PG Doc comments form message dated "Fri, 05 Feb 2021 20:59:06 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <329136.1612644506.1@sss.pgh.pa.us> Date: Sat, 06 Feb 2021 15:48:26 -0500 Message-ID: <329137.1612644506@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Doc comments form writes: > The syntax/synopsis of the "ALTER DEFAULT PRIVILEGES" statement on the > https://www.postgresql.org/docs/13/sql-alterdefaultprivileges.html page can > be simplified to the below form: > [ factor out privileges and object type ] Hmm. I can't get too excited about doing that unless we refactor the GRANT and REVOKE synopses similarly. The factorization seems a little weird too --- the sub-production is not just privileges, but privileges and target object type (or in GRANT/REVOKE, it'd be specific target object(s)). Maybe that's okay, but I'm not 100% sold on this way being any clearer. Maybe it'd help to split the GRANT and REVOKE cases completely, along the lines of ALTER DEFAULT PRIVILEGES [ FOR { ROLE | USER } target_role [, ...] ] [ IN SCHEMA schema_name [, ...] ] GRANT privilege_and_object_type TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ] ALTER DEFAULT PRIVILEGES [ FOR { ROLE | USER } target_role [, ...] ] [ IN SCHEMA schema_name [, ...] ] REVOKE [ GRANT OPTION FOR ] privilege_and_object_type FROM { [ GROUP ] role_name | PUBLIC } [, ...] [ CASCADE | RESTRICT ] where privilege_and_object_type is one of: { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER } [, ...] | ALL [ PRIVILEGES ] } ON TABLES ... etc etc ... regards, tom lane