You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Any spelling of "public" in a Database usage is treated as the PUBLIC pseudo-role #11955
I have searched for an existing issue, and could not find anything. I believe this is a new bug.
Version
trunk (main)
What happened?
In the Database resource, the usage entries for schemas, foreign data wrappers and foreign servers treat any spelling of public (public, Public, PUBLIC) as the PUBLIC pseudo-role. The webhook folds the name to detect duplicates, and sanitizeGrantee (introduced by #10829) emits the bare PUBLIC keyword.
PostgreSQL only reserves the exact lowercase name. CREATE ROLE "Public" and CREATE ROLE "PUBLIC" succeed, and GRANT ... TO "Public" is a different ACL entry from GRANT ... TO PUBLIC. I checked this on PostgreSQL 15.20 and 18.7, with the same result:
create role public; -- ERROR: role name "public" is reserved
create role "Public"; -- ok
create role "PUBLIC"; -- okrevoke connect on database t from public;
grant connect on database t to "Public";
-- aclexplode: grantee 16385 ("Public") holds CONNECT, grantee 0 (PUBLIC) does not
A role with one of those names cannot be managed from the Database resource. A revoke entry meant for it revokes the privilege from every role instead.
Database-level permissions (#11906) follows the same rule, as the other usages do.
Changing this at once would break manifests that use PUBLIC today. A possible path: the webhook warns for any spelling other than lowercase public, saying that names will become case sensitive in a future release. After that window, sanitizeGrantee and the webhook match only the exact lowercase public.
Activity
feat(database): manage the privileges on a database declaratively (#1…
feat(database): manage the privileges on a database declaratively (cl…