Re: BUG #19703: information_schema.usage_privileges omits a sequence owner's implicit USAGE privilege

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: imchifan(at)163(dot)com
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19703: information_schema.usage_privileges omits a sequence owner's implicit USAGE privilege
Date: 2026-09-20 15:49:45
Message-ID: 362684.1789919385@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Samriddha Kumar Tripathi 2026-09-20 16:18:00 Re: BUG #19704: ispell dictionary accepts trailing junk in numeric COMPOUNDFLAG
Previous Message David G. Johnston 2026-09-20 14:07:11 Re: BUG #19707: Reproduction of BUG #19553 on PostgreSQL 18.4: nested LEFT JOIN returns a constant instead of NULL