Re: BUG #19703: information_schema.usage_privileges omits a sequence owner's implicit USAGE privilege - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #19703: information_schema.usage_privileges omits a sequence owner's implicit USAGE privilege
Date
Msg-id 362684.1789919385@sss.pgh.pa.us
Whole thread
In response to BUG #19703: information_schema.usage_privileges omits a sequence owner's implicit USAGE privilege  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #19703: information_schema.usage_privileges omits a sequence owner's implicit USAGE privilege
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> For a newly created sequence, has_sequence_privilege reports that the owner
> has USAGE, but information_schema.usage_privileges omits that privilege. The
> view reports the owner privilege only after the same USAGE privilege is
> redundantly granted explicitly.

I think the problem is that the "sequences" arm of usage_privileges
writes

            SELECT oid, relname, relnamespace, relkind, relowner, (aclexplode(coalesce(relacl, acldefault('r',
relowner)))).*FROM pg_class 

but the acldefault code for sequences is 's' not 'r', so the wrong
set of default ACL bits is injected.  We would see a bunch of
obviously-inapplicable privileges reported, except that the query
then applies a filter:

          AND c.prtype IN ('USAGE')

and we end up reporting nothing.

This appears to go clear back to 82e83f46a.

            regards, tom lane



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #19707: Reproduction of BUG #19553 on PostgreSQL 18.4: nested LEFT JOIN returns a constant instead of NULL
Next
From: Samriddha Kumar Tripathi
Date:
Subject: Re: BUG #19704: ispell dictionary accepts trailing junk in numeric COMPOUNDFLAG